summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-04-14 22:13:21 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2011-04-14 22:14:50 +0200
commit2bb91c4880b2b7d8bd7641f226c35389d3b7bb45 (patch)
tree70005079f6d0188d060e7a09d2f4586c0b5f9682
parentef3712b4270c02239a3bdb358a9491ea51b5bf3b (diff)
playbin2: ensure proper PAUSED_TO_READY cleanup
... since going async to PAUSED might fail, and never making it to PAUSED subsequently skips going down to READY. Fixes #647781.
-rw-r--r--gst/playback/gstplaybin2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
index 05a2294b0..4185c38b9 100644
--- a/gst/playback/gstplaybin2.c
+++ b/gst/playback/gstplaybin2.c
@@ -3642,6 +3642,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret;
GstPlayBin *playbin;
+ gboolean do_save = FALSE;
playbin = GST_PLAY_BIN (element);
@@ -3660,6 +3661,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
}
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
+ async_down:
/* FIXME unlock our waiting groups */
GST_LOG_OBJECT (playbin, "setting shutdown flag");
g_atomic_int_set (&playbin->shutdown, 1);
@@ -3673,6 +3675,13 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
GST_PLAY_BIN_DYN_UNLOCK (playbin);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
+ /* we go async to PAUSED, so if that fails, we never make it to PAUSED
+ * an no state change PAUSED to READY passes here,
+ * though it is a nice-to-have ... */
+ if (!g_atomic_int_get (&playbin->shutdown)) {
+ do_save = TRUE;
+ goto async_down;
+ }
memset (&playbin->duration, 0, sizeof (playbin->duration));
/* unlock so that all groups go to NULL */
@@ -3699,6 +3708,9 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
{
guint i;
+ /* also do missed state change down to READY */
+ if (do_save)
+ save_current_group (playbin);
/* Deactive the groups, set the uridecodebins to NULL
* and unref them.
*/