summaryrefslogtreecommitdiff
path: root/gst/playback
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-07-23 12:36:15 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-07-23 12:46:48 +0200
commit73646bd04f4755ae3709ae4bd10b122e74358711 (patch)
tree6359657ea383394e787d861407651d84e802f02e /gst/playback
parent5c038192e25e6bfc68de326d6f249592b9532cd5 (diff)
playbin: Go asynchronously from READY to PAUSED
We now add all our elements to uridecodebin *after* GstBin::change_state(READY->PAUSED), so we need to post async-start and async-done messages ourselves if we want to work async. https://bugzilla.gnome.org/show_bug.cgi?id=733495
Diffstat (limited to 'gst/playback')
-rw-r--r--gst/playback/gstplaybin2.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
index 23801292a..75499a1c1 100644
--- a/gst/playback/gstplaybin2.c
+++ b/gst/playback/gstplaybin2.c
@@ -431,6 +431,7 @@ struct _GstPlayBin
GMutex dyn_lock;
/* if we are shutting down or not */
gint shutdown;
+ gboolean async_pending; /* async-start has been emitted */
GMutex elements_lock;
guint32 elements_cookie;
@@ -1270,6 +1271,35 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
}
static void
+do_async_start (GstPlayBin * playbin)
+{
+ GstMessage *message;
+
+ playbin->async_pending = TRUE;
+
+ message = gst_message_new_async_start (GST_OBJECT_CAST (playbin));
+ GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (playbin),
+ message);
+}
+
+static void
+do_async_done (GstPlayBin * playbin)
+{
+ GstMessage *message;
+
+ if (playbin->async_pending) {
+ GST_DEBUG_OBJECT (playbin, "posting ASYNC_DONE");
+ message =
+ gst_message_new_async_done (GST_OBJECT_CAST (playbin),
+ GST_CLOCK_TIME_NONE);
+ GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (playbin),
+ message);
+
+ playbin->async_pending = FALSE;
+ }
+}
+
+static void
init_group (GstPlayBin * playbin, GstSourceGroup * group)
{
/* store the array for the different channels */
@@ -3510,6 +3540,10 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
GST_PLAY_BIN_SHUTDOWN_UNLOCK (playbin);
+ if (configure) {
+ do_async_done (playbin);
+ }
+
return;
shutdown:
@@ -5442,6 +5476,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
GST_LOG_OBJECT (playbin, "clearing shutdown flag");
memset (&playbin->duration, 0, sizeof (playbin->duration));
g_atomic_int_set (&playbin->shutdown, 0);
+ do_async_start (playbin);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
async_down:
@@ -5485,8 +5520,10 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
goto failure;
}
+ ret = GST_STATE_CHANGE_ASYNC;
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+ do_async_done (playbin);
/* FIXME Release audio device when we implement that */
break;
case GST_STATE_CHANGE_PAUSED_TO_READY: