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.
This commit is contained in:
Sebastian Dröge 2009-07-10 17:08:40 +02:00
parent 8515117573
commit 3d751d190d

View file

@ -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: