From 3d751d190d89c10210d2bf0dd4c6019bd4ddc217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 10 Jul 2009 17:08:40 +0200 Subject: [PATCH] playbin2: Make it possible for READY->PAUSED to succeed after it failed the first time If READY->PAUSED failed in the source element we would've swapped the current and next group already. To allow READY->PAUSED to succeed after the first failure we have to swap the current and next group back again. This also ensure that we're again in the same state as before the failed state change and not at the next group. This was especially a problem for playbin2 pipelines that use the new mounting support in giosrc as the source would fail for READY->PAUSED the first time, the application mounts the location and then tries to go READY->PAUSED again (and this time it would succeed). Fixes bug #588078. --- gst/playback/gstplaybin2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index fae56b9c1a..8631755834 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -2821,8 +2821,22 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition) } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - if (ret == GST_STATE_CHANGE_FAILURE) + if (ret == GST_STATE_CHANGE_FAILURE) { + if (transition == GST_STATE_CHANGE_READY_TO_PAUSED) { + GstSourceGroup *curr_group; + + curr_group = playbin->curr_group; + if (curr_group && curr_group->valid) { + /* unlink our pads with the sink */ + deactivate_group (playbin, curr_group); + } + + /* Swap current and next group back */ + playbin->curr_group = playbin->next_group; + playbin->next_group = curr_group; + } return ret; + } switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: