mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
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
This commit is contained in:
parent
7dda0e7f17
commit
eec88a9651
4 changed files with 72 additions and 28 deletions
|
@ -843,23 +843,34 @@ gst_omx_audio_dec_set_format (GstAudioDecoder * decoder, GstCaps * caps)
|
|||
return FALSE;
|
||||
needs_disable = FALSE;
|
||||
} 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 decoder 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->dec_in_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (self->dec_in_port,
|
||||
5 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (out_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_deallocate_buffers (self->dec_out_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_enabled (self->dec_in_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (out_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_deallocate_buffers (out_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2053,23 +2053,34 @@ gst_omx_video_dec_disable (GstOMXVideoDec * self)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* 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 decoder 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->dec_in_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (self->dec_in_port,
|
||||
5 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (out_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_enabled (self->dec_in_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
if (gst_omx_port_set_enabled (out_port, FALSE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_buffers_released (out_port,
|
||||
1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -1003,23 +1003,34 @@ gst_omx_video_enc_disable (GstOMXVideoEnc * self)
|
|||
/* The decoder is returned to initial state */
|
||||
self->disabled = FALSE;
|
||||
} 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;
|
||||
|
|
Loading…
Reference in a new issue