decodebin: Buffer up to 5 seconds in multiqueue buffering mode
authorSebastian Dröge <sebastian@centricular.com>
Fri, 7 Mar 2014 16:09:24 +0000 (17:09 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 7 Mar 2014 16:09:24 +0000 (17:09 +0100)
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
gst/playback/gsturidecodebin.c

index 9ebebfa..b7628ed 100644 (file)
@@ -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). */
index 11aed25..cd89766 100644 (file)
@@ -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);