From 5e364c1d7b3a9c3eecf0808736d3e9c73de3fcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 7 Mar 2014 17:09:24 +0100 Subject: [PATCH] decodebin: Buffer up to 5 seconds in multiqueue buffering mode 2 seconds might be too small for some container formats, e.g. MPEGTS with some video codec and AAC/ADTS audio with 700ms long buffers. The video branch of multiqueue can run full while the audio branch is completely empty, especially because there are usually more queues downstream on the audio branch. --- gst/playback/gstdecodebin2.c | 10 +++++++--- gst/playback/gsturidecodebin.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 9ebebfa1c6..b7628ed620 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -3194,9 +3194,13 @@ decodebin_set_queue_size (GstDecodeBin * dbin, GstElement * multiqueue, max_bytes = AUTO_PREROLL_SIZE_BYTES; if (preroll || (max_buffers = dbin->max_size_buffers) == 0) max_buffers = AUTO_PREROLL_SIZE_BUFFERS; - if (preroll || (max_time = dbin->max_size_time) == 0) - max_time = seekable ? AUTO_PREROLL_SEEKABLE_SIZE_TIME : - AUTO_PREROLL_NOT_SEEKABLE_SIZE_TIME; + if (preroll || (max_time = dbin->max_size_time) == 0) { + if (dbin->use_buffering && !preroll) + max_time = 5 * GST_SECOND; + else + 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). */ diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 11aed25390..cd8976674b 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1837,7 +1837,7 @@ make_decoder (GstURIDecodeBin * decoder) if ((max_bytes = decoder->buffer_size) == -1) max_bytes = 2 * 1024 * 1024; if ((max_time = decoder->buffer_duration) == -1) - max_time = 2 * GST_SECOND; + max_time = 5 * GST_SECOND; g_object_set (decodebin, "max-size-bytes", max_bytes, "max-size-buffers", (guint) 0, "max-size-time", max_time, NULL);