On Thu, Jul 05, 2012 at 09:43:42PM +0200, Tino Keitel wrote:
> Hi,
> 
> I'm a daily user of the RAOP output plugin.
Me too
> As such, I intend to bring
> back the plugin.  Max, you listed some issues in your mail from Jan
> 28th 2011 that need to be resolved.
> I also noticed some
> usability/stability issues, especially when enabling/disabling or power
> cycling RAOP outputs.
Ack
> I have 2 Airport Express devices to test the
> output, so I will try to solve all these and issues.  I also would
> welcome testers with AppleTV2/3 devices.
> 
> Furthermore, it would be nice to get patches from other people in the
> case that there are any fixes somewhere that never got published.

I tried these modifications, and my setup got more stable, but
I still occasionally experience problems.

---
commit 9cf49e5d7be53a77722a7a83ab803da289ef7206
Author: Kurt Van Dijck <kurt.van.di...@skynet.be>
Date:   Fri Feb 24 06:57:15 2012 +0100

    raop_output: fixed raop_session inbalance
    
    raop_session_free called from raop_output_finish,
    not from raop_output_remove.
    In raop_output_remove, do close the ntp_server & control port.
    
    Add missing mutex unlock calls
    
    Signed-off-by: Kurt Van Dijck <kurt.van.di...@skynet.be>

diff --git a/src/output/raop_output_plugin.c b/src/output/raop_output_plugin.c
index 68d6897..76d60c6 100644
--- a/src/output/raop_output_plugin.c
+++ b/src/output/raop_output_plugin.c
@@ -770,6 +770,11 @@ raop_output_finish(struct audio_output *ao)
        g_mutex_free(rd->control_mutex);
        ao_base_finish(&rd->base);
        g_free(rd);
+
+       if (raop_session->raop_list == NULL) {
+               raop_session_free(raop_session);
+               raop_session = NULL;
+       }
 }
 
 #define RAOP_VOLUME_MIN -30
@@ -867,12 +872,13 @@ raop_output_remove(struct raop_data *rd)
                prev = iter;
                iter = iter->next;
        }
-       g_mutex_unlock(raop_session->list_mutex);
 
        if (raop_session->raop_list == NULL) {
-               raop_session_free(raop_session);
-               raop_session = NULL;
+               ntp_server_close(&raop_session->ntp);
+               close(raop_session->ctrl.fd);
+               raop_session->ctrl.fd = -1;
        }
+       g_mutex_unlock(raop_session->list_mutex);
 }
 
 static void
@@ -908,10 +914,10 @@ raop_output_open(struct audio_output *ao, struct 
audio_format *audio_format, GEr
                raop_session->data_fd = open_udp_socket(NULL, &myport,
                                                        error_r);
                if (raop_session->data_fd < 0)
-                       return false;
+                       goto fail_locked;
 
                if (!ntp_server_open(&raop_session->ntp, error_r))
-                       return false;
+                       goto fail_locked;
 
                raop_session->ctrl.fd =
                        open_udp_socket(NULL, &raop_session->ctrl.port,
@@ -919,8 +925,7 @@ raop_output_open(struct audio_output *ao, struct 
audio_format *audio_format, GEr
                if (raop_session->ctrl.fd < 0) {
                        ntp_server_close(&raop_session->ntp);
                        raop_session->ctrl.fd = -1;
-                       g_mutex_unlock(raop_session->list_mutex);
-                       return false;
+                       goto fail_locked;
                }
        }
        g_mutex_unlock(raop_session->list_mutex);
@@ -943,6 +948,9 @@ raop_output_open(struct audio_output *ao, struct 
audio_format *audio_format, GEr
        }
        g_mutex_unlock(raop_session->list_mutex);
        return true;
+fail_locked:
+       g_mutex_unlock(raop_session->list_mutex);
+       return false;
 }
 
 static size_t
@@ -991,8 +999,10 @@ raop_output_play(struct audio_output *ao, const void 
*chunk, size_t size,
                        while (iter) {
                                if (!send_control_command(&raop_session->ctrl, 
iter,
                                                          
&raop_session->play_state,
-                                                         error_r))
+                                                         error_r)) {
+                                       
g_mutex_unlock(raop_session->list_mutex);
                                        goto erexit;
+                               }
 
                                iter = iter->next;
                        }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to