diff options
author | Duncan Palmer <dpalmer@digisoft.tv> | 2015-02-16 09:25:03 +1000 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-03-24 08:17:47 -0300 |
commit | bf3e35a598afda180c4f392726043b272dffc1b0 (patch) | |
tree | c7ba36e681fca73a776f82a45701de1e167c4e62 /gst/playback/gstdecodebin2.c | |
parent | 90d428a553ab601ad690aafd1ad9050f4d4b22b6 (diff) |
decodebin2: Set multiqueue sizes before use-buffering.
This fixes a race where the use-buffering property on a multiqueue was
set before the queue depth was changed from it's high preroll limits to
lower playback limits. This resulted in buffering messages being emitted
by the multiqueue in the short window between use-buffering being
set and the queue depth being reset.
https://bugzilla.gnome.org/show_bug.cgi?id=744308
Diffstat (limited to 'gst/playback/gstdecodebin2.c')
-rw-r--r-- | gst/playback/gstdecodebin2.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 94ebda98f..9973ecf25 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -286,6 +286,9 @@ static void type_found (GstElement * typefind, guint probability, static void decodebin_set_queue_size (GstDecodeBin * dbin, GstElement * multiqueue, gboolean preroll, gboolean seekable); +static void decodebin_set_queue_size_full (GstDecodeBin * dbin, + GstElement * multiqueue, gboolean use_buffering, gboolean preroll, + gboolean seekable); static gboolean gst_decode_bin_autoplug_continue (GstElement * element, GstPad * pad, GstCaps * caps); @@ -3508,19 +3511,28 @@ gst_decode_chain_start_free_hidden_groups_thread (GstDecodeChain * chain) g_thread_unref (thread); } -/* configure queue sizes, this depends on the buffering method and if we are - * playing or prerolling. */ static void decodebin_set_queue_size (GstDecodeBin * dbin, GstElement * multiqueue, gboolean preroll, gboolean seekable) { - guint max_bytes, max_buffers; - guint64 max_time; gboolean use_buffering; /* get the current config from the multiqueue */ g_object_get (multiqueue, "use-buffering", &use_buffering, NULL); + decodebin_set_queue_size_full (dbin, multiqueue, use_buffering, preroll, + seekable); +} + +/* configure queue sizes, this depends on the buffering method and if we are + * playing or prerolling. */ +static void +decodebin_set_queue_size_full (GstDecodeBin * dbin, GstElement * multiqueue, + gboolean use_buffering, gboolean preroll, gboolean seekable) +{ + guint max_bytes, max_buffers; + guint64 max_time; + GST_DEBUG_OBJECT (multiqueue, "use buffering %d", use_buffering); if (preroll || use_buffering) { @@ -3595,7 +3607,7 @@ gst_decode_group_new (GstDecodeBin * dbin, GstDecodeChain * parent) gst_object_unref (pad); } } - decodebin_set_queue_size (dbin, mq, TRUE, seekable); + decodebin_set_queue_size_full (dbin, mq, FALSE, TRUE, seekable); group->overrunsig = g_signal_connect (mq, "overrun", G_CALLBACK (multi_queue_overrun_cb), group); @@ -4005,6 +4017,9 @@ gst_decode_group_reset_buffering (GstDecodeGroup * group) CHAIN_MUTEX_UNLOCK (chain); } + decodebin_set_queue_size_full (group->dbin, group->multiqueue, !ret, + FALSE, (group->parent ? group->parent->seekable : TRUE)); + if (ret) { /* all chains are buffering already, no need to do it here */ g_object_set (group->multiqueue, "use-buffering", FALSE, NULL); @@ -4013,8 +4028,6 @@ gst_decode_group_reset_buffering (GstDecodeGroup * group) "low-percent", group->dbin->low_percent, "high-percent", group->dbin->high_percent, NULL); } - decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE, - (group->parent ? group->parent->seekable : TRUE)); GST_DEBUG_OBJECT (group->dbin, "Setting %s buffering to %d", GST_ELEMENT_NAME (group->multiqueue), !ret); |