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
This commit is contained in:
Duncan Palmer 2015-02-16 09:25:03 +10:00 committed by Thiago Santos
parent 90d428a553
commit bf3e35a598

View file

@ -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);