From 3f5d98a360d657e904fadedb4804b03952204f63 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 10 Jul 2017 15:00:58 +0200 Subject: [PATCH] omxvideoenc: ensure enough buffers are allocated in the pool Handle allocation query and ensure enough buffers are allocated in the negotiated pool. This help preventing buffer starvation in the pipeline. https://bugzilla.gnome.org/show_bug.cgi?id=785122 --- omx/gstomxvideoenc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 9803a9fb39..baf73c4f78 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -1775,8 +1775,18 @@ static gboolean gst_omx_video_enc_propose_allocation (GstVideoEncoder * encoder, GstQuery * query) { + GstOMXVideoEnc *self = GST_OMX_VIDEO_ENC (encoder); + guint num_buffers; + gsize size = self->input_state->info.size; + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); + num_buffers = self->enc_in_port->port_def.nBufferCountMin + 1; + GST_DEBUG_OBJECT (self, + "request at least %d buffers of size %" G_GSIZE_FORMAT, num_buffers, + size); + gst_query_add_allocation_pool (query, NULL, size, num_buffers, 0); + return GST_VIDEO_ENCODER_CLASS (gst_omx_video_enc_parent_class)->propose_allocation (encoder, query);