From d16df7f70df2e703ccb24ea0822b0c804235127d Mon Sep 17 00:00:00 2001 From: Branislav Katreniak Date: Mon, 12 Jan 2015 14:38:09 +0100 Subject: [PATCH] decodebin: do call set_queue_size in no_more_pads_cb Consider pipeline: gst-launch-1.0 playbin uri=http://example.com/a.ogg Consider 128kbit audio stream. As soon as uridecodebin detects the bitrate, it configures its input queue2 max-size to 32000 bytes. The 2MB buffer in multiqueue is nearly 2 orders of magnitude bigger. This non-deterministically drives queue2 buffer anywhere from 100% to 0% until multiqueue is filled. This patch sets multiqueue size to 5 buffers early in no_more_pads_cb. Partly reverts commit db771185ed750627a6a1824c42b651d739e1b4a4. https://bugzilla.gnome.org/show_bug.cgi?id=740689 --- gst/playback/gstdecodebin2.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index f0f1ab807c..53f946d2fa 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -2901,6 +2901,13 @@ no_more_pads_cb (GstElement * element, GstDecodeChain * chain) GST_DEBUG_OBJECT (element, "Setting group %p to complete", group); group->no_more_pads = TRUE; + /* this group has prerolled enough to not need more pads, + * we can probably set its buffering state to playing now */ + GST_DEBUG_OBJECT (group->dbin, "Setting group %p multiqueue to " + "'playing' buffering mode", group); + decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE, + (group->parent ? group->parent->seekable : TRUE), + (group->parent ? group->parent->adaptive_demuxer : FALSE)); CHAIN_MUTEX_UNLOCK (chain); EXPOSE_LOCK (chain->dbin); @@ -3316,6 +3323,13 @@ multi_queue_overrun_cb (GstElement * queue, GstDecodeGroup * group) queue); group->overrun = TRUE; + /* this group has prerolled enough to not need more pads, + * we can probably set its buffering state to playing now */ + GST_DEBUG_OBJECT (group->dbin, "Setting group %p multiqueue to " + "'playing' buffering mode", group); + decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE, + (group->parent ? group->parent->seekable : TRUE), + (group->parent ? group->parent->adaptive_demuxer : FALSE)); /* FIXME: We should make sure that everything gets exposed now * even if child chains are not complete because the will never