From a3b24f0241bd55a005a072ba8ddcd53e0fdbf827 Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Tue, 18 Aug 2015 15:16:25 +0300 Subject: decodebin: If extra buffers are going to be required, we're still prerolling --- gst/playback/gstdecodebin2.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'gst') diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 1d0383c16..dd2a09703 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -3487,13 +3487,14 @@ multi_queue_overrun_cb (GstElement * queue, GstDecodeGroup * group) GST_LOG_OBJECT (dbin, "multiqueue '%s' (%p) is full", GST_OBJECT_NAME (queue), queue); - /* this group has prerolled enough to not need more pads, - * we can probably set its buffering state to playing now */ if (!group->no_more_pads && group->parent->demuxer && !group->extra_buffer_required) { group->overrun = FALSE; group->extra_buffer_required = TRUE; } else { + /* 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); group->overrun = TRUE; @@ -3512,6 +3513,7 @@ multi_queue_overrun_cb (GstElement * queue, GstDecodeGroup * group) EXPOSE_LOCK (dbin); if (dbin->decode_chain) { if (gst_decode_chain_is_complete (dbin->decode_chain)) { + group->extra_buffer_required = FALSE; if (!gst_decode_bin_expose (dbin)) GST_WARNING_OBJECT (dbin, "Couldn't expose group"); } else { @@ -3523,7 +3525,7 @@ multi_queue_overrun_cb (GstElement * queue, GstDecodeGroup * group) if (group->extra_buffer_required) { GST_DEBUG_OBJECT (group->dbin, "Setting group %p multiqueue to 'extra_buffer_required' mode", group); - decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE, + decodebin_set_queue_size (group->dbin, group->multiqueue, TRUE, (group->parent ? group->parent->seekable : TRUE), group->extra_buffer_required); } @@ -3697,7 +3699,8 @@ decodebin_set_queue_size_full (GstDecodeBin * dbin, GstElement * multiqueue, /* takes queue limits, initially we only queue up up to the max bytes limit, * with a default of 2MB. we use the same values for buffering mode. */ if (preroll || (max_bytes = dbin->max_size_bytes) == 0) - max_bytes = AUTO_PREROLL_SIZE_BYTES; + max_bytes = AUTO_PREROLL_SIZE_BYTES + (preroll + && extra_buffer_required ? DEFAULT_EXTRA_SIZE_BUFFERS_BYTES : 0); if (preroll || (max_buffers = dbin->max_size_buffers) == 0) max_buffers = AUTO_PREROLL_SIZE_BUFFERS; if (preroll || (max_time = dbin->max_size_time) == 0) { @@ -3707,15 +3710,13 @@ decodebin_set_queue_size_full (GstDecodeBin * dbin, GstElement * multiqueue, max_time = seekable ? AUTO_PREROLL_SEEKABLE_SIZE_TIME : AUTO_PREROLL_NOT_SEEKABLE_SIZE_TIME; } - } else if (extra_buffer_required) { - max_bytes = AUTO_PREROLL_SIZE_BYTES + DEFAULT_EXTRA_SIZE_BUFFERS_BYTES; - max_buffers = AUTO_PREROLL_SIZE_BUFFERS; - if ((max_time = dbin->max_size_time) == 0) - max_time = seekable ? AUTO_PREROLL_SEEKABLE_SIZE_TIME : - AUTO_PREROLL_NOT_SEEKABLE_SIZE_TIME; } else { /* update runtime limits. At runtime, we try to keep the amount of buffers * in the queues as low as possible (but at least 5 buffers). */ + + /* dbin->use_buffering == TRUE and use_buffering == FALSE (see above if) + * happens when we do buffering but it happens already in downstream + * groups */ if (dbin->use_buffering) max_bytes = 0; else if ((max_bytes = dbin->max_size_bytes) == 0) -- cgit v1.2.3