From 9cd77b164433e925ee9055ac64d5599713724410 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 9 Apr 2018 17:54:05 +0200 Subject: [PATCH] fakevideosink: request an extra buffer if enable-last-sample is enabled If the 'enable-last-sample' property is enabled, fakevideosink will keep a reference on last rendered buffer which may lead to buffer starvation in the pipeline. Request one extra buffer in this case so we always have a buffer flying in the pipeline. https://bugzilla.gnome.org/show_bug.cgi?id=795109 --- gst/debugutils/gstfakevideosink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst/debugutils/gstfakevideosink.c b/gst/debugutils/gstfakevideosink.c index 0bf0948eb0..4b98dfa97e 100644 --- a/gst/debugutils/gstfakevideosink.c +++ b/gst/debugutils/gstfakevideosink.c @@ -52,8 +52,10 @@ G_DEFINE_TYPE (GstFakeVideoSink, gst_fake_video_sink, GST_TYPE_BIN); static gboolean gst_fake_video_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) { + GstFakeVideoSink *self = GST_FAKE_VIDEO_SINK (parent); GstCaps *caps; GstVideoInfo info; + guint min_buffers = 1; if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION) return gst_pad_query_default (pad, parent, query); @@ -62,7 +64,11 @@ gst_fake_video_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) if (!gst_video_info_from_caps (&info, caps)) return FALSE; - gst_query_add_allocation_pool (query, NULL, info.size, 1, 0); + /* Request an extra buffer if we are keeping a ref on the last rendered buffer */ + if (gst_base_sink_is_last_sample_enabled (GST_BASE_SINK (self->child))) + min_buffers++; + + gst_query_add_allocation_pool (query, NULL, info.size, min_buffers, 0); gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, NULL); gst_query_add_allocation_meta (query,