#define AUTO_PREROLL_NOT_SEEKABLE_SIZE_TIME 10 * GST_SECOND
#define AUTO_PREROLL_SEEKABLE_SIZE_TIME 0
-/* whan playing, keep a max of 2MB of data but try to keep the number of buffers
+/* when playing, keep a max of 2MB of data but try to keep the number of buffers
* as low as possible (try to aim for 5 buffers) */
#define AUTO_PLAY_SIZE_BYTES 2 * 1024 * 1024
#define AUTO_PLAY_SIZE_BUFFERS 5
+#define AUTO_PLAY_ADAPTIVE_SIZE_BUFFERS 2
#define AUTO_PLAY_SIZE_TIME 0
#define DEFAULT_SUBTITLE_ENCODING NULL
GstCaps * caps, GstDecodeBin * decode_bin);
static void decodebin_set_queue_size (GstDecodeBin * dbin,
- GstElement * multiqueue, gboolean preroll, gboolean seekable);
+ GstElement * multiqueue, gboolean preroll, gboolean seekable,
+ gboolean adaptive_streaming);
static gboolean gst_decode_bin_autoplug_continue (GstElement * element,
GstPad * pad, GstCaps * caps);
* playing or prerolling. */
static void
decodebin_set_queue_size (GstDecodeBin * dbin, GstElement * multiqueue,
- gboolean preroll, gboolean seekable)
+ gboolean preroll, gboolean seekable, gboolean adaptive_streaming)
{
guint max_bytes, max_buffers;
guint64 max_time;
max_bytes = 0;
else if ((max_bytes = dbin->max_size_bytes) == 0)
max_bytes = AUTO_PLAY_SIZE_BYTES;
+ /* if we're after an adaptive streaming demuxer keep
+ * a lower number of buffers as they are usually very
+ * large */
if ((max_buffers = dbin->max_size_buffers) == 0)
- max_buffers = AUTO_PLAY_SIZE_BUFFERS;
+ max_buffers =
+ (adaptive_streaming ? AUTO_PLAY_ADAPTIVE_SIZE_BUFFERS :
+ AUTO_PLAY_SIZE_BUFFERS);
/* this is a multiqueue with disabled buffering, don't limit max_time */
if (dbin->use_buffering)
max_time = 0;
gst_object_unref (pad);
}
}
- decodebin_set_queue_size (dbin, mq, TRUE, seekable);
+ decodebin_set_queue_size (dbin, mq, TRUE, seekable,
+ (parent ? parent->adaptive_demuxer : FALSE));
group->overrunsig = g_signal_connect (mq, "overrun",
G_CALLBACK (multi_queue_overrun_cb), group);
"high-percent", group->dbin->high_percent, NULL);
}
decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE,
- (group->parent ? group->parent->seekable : TRUE));
+ (group->parent ? group->parent->seekable : TRUE),
+ (group->parent ? group->parent->adaptive_demuxer : FALSE));
GST_DEBUG_OBJECT (group->dbin, "Setting %s buffering to %d",
GST_ELEMENT_NAME (group->multiqueue), !ret);