diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2017-07-06 14:19:19 +0200 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2017-08-09 17:01:15 -0400 |
commit | f2b0b66e396ab604963d9d943b75ee006e0fa1c8 (patch) | |
tree | 4ceacffaf4ecfa1ef34055ca1e3eb10424f06f32 /omx/gstomxvideodec.c | |
parent | 0ee8213ab23e5c2a8704d603d8e1a90a1bf9ebc5 (diff) | |
download | gst-omx-f2b0b66e396ab604963d9d943b75ee006e0fa1c8.tar.gz |
omxvideoenc/dec: declare latency on zynqultrascaleplus
The OMX specification doesn't provide any API to expose the latency
introduced by encoders and decoders. We implemented this as a custom
extension as declaring the latency is needed for live pipelines like
video conferencing.
https://bugzilla.gnome.org/show_bug.cgi?id=785125
Diffstat (limited to 'omx/gstomxvideodec.c')
-rw-r--r-- | omx/gstomxvideodec.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 31be4df..70307ec 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -1987,6 +1987,35 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self) return (err == OMX_ErrorNone); } +#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS +static void +gst_omx_video_dec_set_latency (GstOMXVideoDec * self) +{ + GstClockTime latency; + OMX_ALG_PARAM_REPORTED_LATENCY param; + OMX_ERRORTYPE err; + + GST_OMX_INIT_STRUCT (¶m); + err = + gst_omx_component_get_parameter (self->dec, + (OMX_INDEXTYPE) OMX_ALG_IndexParamReportedLatency, ¶m); + + if (err != OMX_ErrorNone) { + GST_WARNING_OBJECT (self, "Couldn't retrieve latency: %s (0x%08x)", + gst_omx_error_to_string (err), err); + return; + } + + GST_DEBUG_OBJECT (self, "retrieved latency of %d ms", + (guint32) param.nLatency); + + /* Convert to ns */ + latency = param.nLatency * GST_MSECOND; + + gst_video_encoder_set_latency (GST_VIDEO_ENCODER (self), latency, latency); +} +#endif + static gboolean gst_omx_video_dec_disable (GstOMXVideoDec * self) { @@ -2282,6 +2311,10 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, gst_buffer_replace (&self->codec_data, state->codec_data); self->input_state = gst_video_codec_state_ref (state); +#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS + gst_omx_video_dec_set_latency (self); +#endif + self->downstream_flow_ret = GST_FLOW_OK; return TRUE; } |