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
This commit is contained in:
Guillaume Desmottes 2017-07-10 15:00:58 +02:00 committed by Nicolas Dufresne
parent 136714c6ed
commit 3f5d98a360

View file

@ -1775,8 +1775,18 @@ static gboolean
gst_omx_video_enc_propose_allocation (GstVideoEncoder * encoder, gst_omx_video_enc_propose_allocation (GstVideoEncoder * encoder,
GstQuery * query) 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); 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 return
GST_VIDEO_ENCODER_CLASS GST_VIDEO_ENCODER_CLASS
(gst_omx_video_enc_parent_class)->propose_allocation (encoder, query); (gst_omx_video_enc_parent_class)->propose_allocation (encoder, query);