summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-04-30 08:32:39 (GMT)
committerWim Taymans <wim.taymans@collabora.co.uk>2009-04-30 08:32:39 (GMT)
commit28afc6e59103f6f7c3d72ba7c74df3f6c883aaf4 (patch)
treeaee21370db48edac414cc0c91d741a8b01a48fd2
parentde0a2575fc277cbe18979f18c58a799376f21e49 (diff)
pulsesink: make sure we always signal waiters
Always signal the waiters in the async callbacks. Especially for the volume callbacks since this might cause deadlocks.
-rw-r--r--ext/pulse/pulsesink.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index 41817f1..cba945b 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -313,19 +313,20 @@ gst_pulsering_context_subscribe_cb (pa_context * c,
if (t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT | PA_SUBSCRIPTION_EVENT_CHANGE) &&
t != (PA_SUBSCRIPTION_EVENT_SINK_INPUT | PA_SUBSCRIPTION_EVENT_NEW))
- return;
+ goto done;
if (!pbuf->stream)
- return;
+ goto done;
if (idx != pa_stream_get_index (pbuf->stream))
- return;
+ goto done;
/* Actually this event is also triggered when other properties of
* the stream change that are unrelated to the volume. However it is
* probably cheaper to signal the change here and check for the
* volume when the GObject property is read instead of querying it always. */
+done:
/* inform streaming thread to notify */
g_atomic_int_compare_and_exchange (&psink->notify, 0, 1);
}
@@ -482,8 +483,7 @@ gst_pulsering_stream_request_cb (pa_stream * s, size_t length, void *userdata)
if (pbuf->in_commit && (length >= rbuf->spec.segsize)) {
/* only signal when we are waiting in the commit thread
- * and got request for atleast a segment
- */
+ * and got request for atleast a segment */
pa_threaded_mainloop_signal (psink->mainloop, 0);
}
}
@@ -1480,14 +1480,17 @@ gst_pulsesink_sink_input_info_cb (pa_context * c, const pa_sink_input_info * i,
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
if (!i)
- return;
+ goto done;
if (!pbuf->stream)
- return;
+ goto done;
g_assert (i->index == pa_stream_get_index (pbuf->stream));
psink->volume = pa_sw_volume_to_linear (pa_cvolume_max (&i->volume));
+
+done:
+ pa_threaded_mainloop_signal (psink->mainloop, 0);
}
static gdouble
@@ -1550,15 +1553,18 @@ gst_pulsesink_sink_info_cb (pa_context * c, const pa_sink_info * i, int eol,
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
if (!i)
- return;
+ goto done;
if (!pbuf->stream)
- return;
+ goto done;
g_assert (i->index == pa_stream_get_device_index (pbuf->stream));
g_free (psink->device_description);
psink->device_description = g_strdup (i->description);
+
+done:
+ pa_threaded_mainloop_signal (psink->mainloop, 0);
}
static gchar *