diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-11-14 14:05:43 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-11-14 14:08:40 +0100 |
commit | 3b4fd71270371f2cdd09405b5803b27828df0358 (patch) | |
tree | 9ab4ba20ebc78c19283f4063ee78cad584f339e2 | |
parent | cdc5fc2c6646081956c41411f331d0bd2b7e03e4 (diff) |
playbin2: Make subtitle error handling more robust and ignore late errors too
Make sure, to only "simulate" subtitle no-more-pads if it was still
pending and also handle errors in the subtitle pipeline as warnings
after the subtitles prerolled.
Don't set the suburidecodebin to READY after errors, handle_message
will usually be called from the streaming thread and doing that
from there is obviously not a good idea.
-rw-r--r-- | gst/playback/gstplaybin2.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 209008f20..c497e9aae 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -300,6 +300,7 @@ struct _GstSourceGroup GstElement *uridecodebin; GstElement *suburidecodebin; gint pending; + gboolean sub_pending; gulong pad_added_id; gulong pad_removed_id; @@ -2001,7 +2002,7 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg) group = playbin->curr_group; /* If we get an error of the subtitle uridecodebin transform * them into warnings and disable the subtitles */ - if (group && group->pending && group->suburidecodebin) { + if (group && group->suburidecodebin) { GstObject *srcparent = gst_object_get_parent (GST_OBJECT_CAST (msg->src)); if (G_UNLIKELY (gst_object_has_ancestor (msg->src, GST_OBJECT_CAST @@ -2056,9 +2057,11 @@ gst_play_bin_handle_message (GstBin * bin, GstMessage * msg) gst_object_ref (group->suburidecodebin); gst_bin_remove (bin, group->suburidecodebin); gst_element_set_locked_state (group->suburidecodebin, FALSE); - gst_element_set_state (group->suburidecodebin, GST_STATE_READY); - no_more_pads_cb (NULL, group); + if (group->sub_pending) { + group->sub_pending = FALSE; + no_more_pads_cb (NULL, group); + } } if (srcparent) @@ -2493,6 +2496,9 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group) if (group->pending > 0) group->pending--; + if (group->suburidecodebin == decodebin) + group->sub_pending = FALSE; + if (group->pending == 0) { /* we are the last group to complete, we will configure the output and then * signal the other waiters. */ @@ -2926,6 +2932,9 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target) /* we have 2 pending no-more-pads */ group->pending = 2; + group->sub_pending = TRUE; + } else { + group->sub_pending = FALSE; } /* release the group lock before setting the state of the decodebins, they @@ -2947,7 +2956,10 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target) /* Might already be removed because of an error message */ if (GST_OBJECT_PARENT (suburidecodebin) == GST_OBJECT_CAST (playbin)) gst_bin_remove (GST_BIN_CAST (playbin), suburidecodebin); - group->pending = 1; + if (group->sub_pending) { + group->pending--; + group->sub_pending = FALSE; + } gst_element_set_state (suburidecodebin, GST_STATE_READY); GST_SOURCE_GROUP_UNLOCK (group); } |