summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-08-29 12:20:56 +0530
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-09-05 09:22:32 +0530
commit7c40a91c31aa4bcbb191f7c6a5d222edf9dfd9d1 (patch)
tree8dba63f8917a9ab7c08b2d2773a38c94d35f40c3
parent76267ec55d5432197ddff3254702551d54132205 (diff)
downloadgst-omx-7c40a91c31aa4bcbb191f7c6a5d222edf9dfd9d1.tar.gz
omxvideoenc: drain encoder on ALLOCATION and DRAIN queries
Ensure that the encoder releases all its input buffers when requested by upstream. Encoder input buffers may be shared with downstreaming (when using dmabuf), upstream may then request the encoder to drain when reconfiguring before destroying its buffers. Also drain on ALLOCATION query as we already do in kmssink as that notify of a format change. Fix "decoder ! encoder" pipeline when decoding a file with different resolutions on Zynq.
-rw-r--r--omx/gstomxvideoenc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index f266596..1d302bd 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -231,6 +231,8 @@ static GstCaps *gst_omx_video_enc_getcaps (GstVideoEncoder * encoder,
GstCaps * filter);
static gboolean gst_omx_video_enc_decide_allocation (GstVideoEncoder * encoder,
GstQuery * query);
+static gboolean gst_omx_video_enc_sink_query (GstVideoEncoder * encoder,
+ GstQuery * query);
static GstFlowReturn gst_omx_video_enc_drain (GstOMXVideoEnc * self);
@@ -488,6 +490,8 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
video_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_omx_video_enc_getcaps);
video_encoder_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_omx_video_enc_decide_allocation);
+ video_encoder_class->sink_query =
+ GST_DEBUG_FUNCPTR (gst_omx_video_enc_sink_query);
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_sink_template_caps =
@@ -3295,3 +3299,27 @@ gst_omx_video_enc_decide_allocation (GstVideoEncoder * encoder,
return TRUE;
}
+
+static gboolean
+gst_omx_video_enc_sink_query (GstVideoEncoder * encoder, GstQuery * query)
+{
+ GstOMXVideoEnc *self = GST_OMX_VIDEO_ENC (encoder);
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_ALLOCATION:
+ case GST_QUERY_DRAIN:
+ {
+ GST_DEBUG_OBJECT (encoder, "%s query: drain encoder",
+ GST_QUERY_TYPE_NAME (query));
+
+ gst_omx_video_enc_drain (self);
+ return TRUE;
+ }
+ default:
+ break;
+ }
+
+ return
+ GST_VIDEO_ENCODER_CLASS (gst_omx_video_enc_parent_class)->sink_query
+ (encoder, query);
+}