summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-07-03 05:11:26 -0400
committerWim Taymans <wim.taymans@collabora.co.uk>2009-07-14 18:52:15 +0200
commitdbb8a331de95d486a80a055029f4af9e9d82d87e (patch)
treef383ce3927e13ce1181f7513fc5251d2ef507922
parentb2e9f0a7c9123284b6a806a59b519f9e1e9f2392 (diff)
pulsesink: Emit stream-status leave message
Fixes #587695
-rw-r--r--ext/pulse/pulsesink.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index 836e71f17..71fa3e7f0 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -918,6 +918,26 @@ gst_pulseringbuffer_pause (GstRingBuffer * buf)
return res;
}
+static void
+mainloop_leave_defer_cb (pa_mainloop_api * api, void *userdata)
+{
+ GstPulseSink *pulsesink = GST_PULSESINK (userdata);
+ GstMessage *message;
+ GValue val = { 0 };
+
+ g_value_init (&val, G_TYPE_POINTER);
+ g_value_set_pointer (&val, g_thread_self ());
+
+ GST_DEBUG_OBJECT (pulsesink, "posting LEAVE stream status");
+ message = gst_message_new_stream_status (GST_OBJECT (pulsesink),
+ GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT (pulsesink));
+ gst_message_set_stream_status_object (message, &val);
+ gst_element_post_message (GST_ELEMENT (pulsesink), message);
+
+ pulsesink->pa_defer_ran = TRUE;
+ pa_threaded_mainloop_signal (pulsesink->mainloop, 0);
+}
+
/* stop playback, we flush everything. */
static gboolean
gst_pulseringbuffer_stop (GstRingBuffer * buf)
@@ -959,6 +979,16 @@ cleanup:
pa_operation_cancel (o);
pa_operation_unref (o);
}
+
+ GST_DEBUG_OBJECT (psink, "scheduling stream status");
+ psink->pa_defer_ran = FALSE;
+ pa_mainloop_api_once (pa_threaded_mainloop_get_api (psink->mainloop),
+ mainloop_leave_defer_cb, psink);
+
+ GST_DEBUG_OBJECT (psink, "waiting for stream status");
+ while (psink->pa_defer_ran == FALSE)
+ pa_threaded_mainloop_wait (psink->mainloop);
+
pa_threaded_mainloop_unlock (psink->mainloop);
return res;