summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-04-26 12:29:16 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-06-08 09:53:01 +0200
commit431eac07bffd7019fbbad0464b2a2df95d29ed66 (patch)
treeae0d3197f6968aa206a19f1aca6b24d7cecedb8b
parent84483f3d7a0d826c4698a48362bad017a1f43388 (diff)
downloadgst-omx-431eac07bffd7019fbbad0464b2a2df95d29ed66.tar.gz
omxvideodec: implement propose_allocation
Tell upstream about how many buffer we plan to use so they can adjust their own number of buffers accordingly if needed. Same logic as the existing gst_omx_video_enc_propose_allocation(). https://bugzilla.gnome.org/show_bug.cgi?id=795746
-rw-r--r--omx/gstomxvideodec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index 53cc2e2..e885a99 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -74,6 +74,8 @@ static GstFlowReturn gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
static GstFlowReturn gst_omx_video_dec_finish (GstVideoDecoder * decoder);
static gboolean gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec,
GstQuery * query);
+static gboolean gst_omx_video_dec_propose_allocation (GstVideoDecoder * bdec,
+ GstQuery * query);
static GstFlowReturn gst_omx_video_dec_drain (GstVideoDecoder * decoder);
@@ -178,6 +180,8 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
video_decoder_class->drain = GST_DEBUG_FUNCPTR (gst_omx_video_dec_drain);
video_decoder_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_omx_video_dec_decide_allocation);
+ video_decoder_class->propose_allocation =
+ GST_DEBUG_FUNCPTR (gst_omx_video_dec_propose_allocation);
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_src_template_caps =
@@ -3232,3 +3236,21 @@ gst_omx_video_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
return TRUE;
}
+
+static gboolean
+gst_omx_video_dec_propose_allocation (GstVideoDecoder * bdec, GstQuery * query)
+{
+ GstOMXVideoDec *self = GST_OMX_VIDEO_DEC (bdec);
+ guint size, num_buffers;
+
+ size = self->dec_in_port->port_def.nBufferSize;
+ num_buffers = self->dec_in_port->port_def.nBufferCountMin + 1;
+
+ GST_DEBUG_OBJECT (self,
+ "request at least %d buffers of size %d", num_buffers, size);
+ gst_query_add_allocation_pool (query, NULL, size, num_buffers, 0);
+
+ return
+ GST_VIDEO_DECODER_CLASS
+ (gst_omx_video_dec_parent_class)->propose_allocation (bdec, query);
+}