summaryrefslogtreecommitdiff
path: root/omx/gstomxaudioenc.c
diff options
context:
space:
mode:
authorJulien Isorce <jisorce@oblong.com>2017-07-20 09:43:19 +0100
committerJulien Isorce <jisorce@oblong.com>2017-08-17 14:01:27 +0100
commiteec88a965106d66e1b327b9bc15a114b6b0f262e (patch)
treeda603bb7b2bc641b56e70ff4b19baad84061cfc5 /omx/gstomxaudioenc.c
parent7dda0e7f176a988abf5aea0aa336d30c03382f2b (diff)
downloadgst-omx-eec88a965106d66e1b327b9bc15a114b6b0f262e.tar.gz
omx{audio,video}{dec,enc}: sequentially disable ports because buffers are not shared
For the history, the parallel disable port has been introduced by: "00be69f omxvideodec: Disable output port when setting a new format" and then replicated to videoenc, audiodec and audioenc. This is only required to do 'parallel' if buffers are shared between ports. But for decoders and encoders the input and output buffer are of different nature by definition (bitstream vs images). So they cannot be shared. Also starting from IL 1.2.0 it is written in the spec that the parallel disable is not allowed and will return an error. Except when buffers are shared. Again here we know in advance that they are not shared so let's always do a sequential disable. Tested on Desktop, rpi and zynqultrascaleplus. https://bugzilla.gnome.org/show_bug.cgi?id=786348
Diffstat (limited to 'omx/gstomxaudioenc.c')
-rw-r--r--omx/gstomxaudioenc.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c
index a03eccc..f9c2581 100644
--- a/omx/gstomxaudioenc.c
+++ b/omx/gstomxaudioenc.c
@@ -694,23 +694,34 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
/* The local port_def is now obsolete so get it again. */
gst_omx_port_get_port_definition (self->enc_in_port, &port_def);
} else {
+ /* Disabling at the same time input port and output port is only
+ * required when a buffer is shared between the ports. This cannot
+ * be the case for a encoder because its input and output buffers
+ * are of different nature. So let's disable ports sequencially.
+ * Starting from IL 1.2.0, this point has been clarified.
+ * OMX_SendCommand will return an error if the IL client attempts to
+ * call it when there is already an on-going command being processed.
+ * The exception is for buffer sharing above and the event
+ * OMX_EventPortNeedsDisable will be sent to request disabling the
+ * other port at the same time. */
if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone)
return FALSE;
- if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone)
- return FALSE;
if (gst_omx_port_wait_buffers_released (self->enc_in_port,
5 * GST_SECOND) != OMX_ErrorNone)
return FALSE;
- if (gst_omx_port_wait_buffers_released (self->enc_out_port,
- 1 * GST_SECOND) != OMX_ErrorNone)
- return FALSE;
if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
- if (gst_omx_port_deallocate_buffers (self->enc_out_port) != OMX_ErrorNone)
- return FALSE;
if (gst_omx_port_wait_enabled (self->enc_in_port,
1 * GST_SECOND) != OMX_ErrorNone)
return FALSE;
+
+ if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_wait_buffers_released (self->enc_out_port,
+ 1 * GST_SECOND) != OMX_ErrorNone)
+ return FALSE;
+ if (gst_omx_port_deallocate_buffers (self->enc_out_port) != OMX_ErrorNone)
+ return FALSE;
if (gst_omx_port_wait_enabled (self->enc_out_port,
1 * GST_SECOND) != OMX_ErrorNone)
return FALSE;