gst-plugins-good: pulsesink: additional error condition checking

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Fri Jan 20 08:24:18 PST 2012


Module: gst-plugins-good
Branch: master
Commit: 3168b77e0421e234ae6c453dd36bd3b1d36a8474
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=3168b77e0421e234ae6c453dd36bd3b1d36a8474

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Fri Jan 20 16:46:21 2012 +0100

pulsesink: additional error condition checking

---

 ext/pulse/pulsesink.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index 3c61770..11e9c89 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -2955,8 +2955,11 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
         GST_INFO_OBJECT (element, "new pa main loop thread");
         if (!(mainloop = pa_threaded_mainloop_new ()))
           goto mainloop_failed;
+        if (pa_threaded_mainloop_start (mainloop) < 0) {
+          pa_threaded_mainloop_free (mainloop);
+          goto mainloop_start_failed;
+        }
         mainloop_ref_ct = 1;
-        pa_threaded_mainloop_start (mainloop);
         g_mutex_unlock (pa_shared_resource_mutex);
       } else {
         GST_INFO_OBJECT (element, "reusing pa main loop thread");
@@ -3002,6 +3005,13 @@ mainloop_failed:
         ("pa_threaded_mainloop_new() failed"), (NULL));
     return GST_STATE_CHANGE_FAILURE;
   }
+mainloop_start_failed:
+  {
+    g_mutex_unlock (pa_shared_resource_mutex);
+    GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
+        ("pa_threaded_mainloop_start() failed"), (NULL));
+    return GST_STATE_CHANGE_FAILURE;
+  }
 state_failure:
   {
     if (transition == GST_STATE_CHANGE_NULL_TO_READY) {



More information about the gstreamer-commits mailing list