mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
omxaudioenc: Release the audio encoder stream lock before acquiring an input buffer
Otherwise the srcpad task might block on this lock and no buffers ever become available again.
This commit is contained in:
parent
3da6d8bfa3
commit
b45197c0d7
1 changed files with 16 additions and 2 deletions
|
@ -973,6 +973,11 @@ gst_omx_audio_enc_event (GstBaseAudioEncoder * encoder, GstEvent * event)
|
|||
return FALSE;
|
||||
self->eos = TRUE;
|
||||
|
||||
/* Make sure to release the base class stream lock, otherwise
|
||||
* _loop() can't call _finish_frame() and we might block forever
|
||||
* because no input buffers are released */
|
||||
GST_BASE_AUDIO_ENCODER_STREAM_UNLOCK (self);
|
||||
|
||||
/* Send an EOS buffer to the component and let the base
|
||||
* class drop the EOS event. We will send it later when
|
||||
* the EOS buffer arrives on the output port. */
|
||||
|
@ -981,6 +986,9 @@ gst_omx_audio_enc_event (GstBaseAudioEncoder * encoder, GstEvent * event)
|
|||
buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS;
|
||||
gst_omx_port_release_buffer (self->in_port, buf);
|
||||
}
|
||||
|
||||
GST_BASE_AUDIO_ENCODER_STREAM_LOCK (self);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1003,14 +1011,20 @@ gst_omx_audio_enc_drain (GstOMXAudioEnc * self)
|
|||
if (self->eos)
|
||||
return GST_FLOW_OK;
|
||||
|
||||
/* Make sure to release the base class stream lock, otherwise
|
||||
* _loop() can't call _finish_frame() and we might block forever
|
||||
* because no input buffers are released */
|
||||
GST_BASE_AUDIO_ENCODER_STREAM_UNLOCK (self);
|
||||
|
||||
/* Send an EOS buffer to the component and let the base
|
||||
* class drop the EOS event. We will send it later when
|
||||
* the EOS buffer arrives on the output port. */
|
||||
acq_ret = gst_omx_port_acquire_buffer (self->in_port, &buf);
|
||||
if (acq_ret != GST_OMX_ACQUIRE_BUFFER_OK)
|
||||
if (acq_ret != GST_OMX_ACQUIRE_BUFFER_OK) {
|
||||
GST_BASE_AUDIO_ENCODER_STREAM_LOCK (self);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
GST_BASE_AUDIO_ENCODER_STREAM_UNLOCK (self);
|
||||
g_mutex_lock (self->drain_lock);
|
||||
self->draining = TRUE;
|
||||
buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS;
|
||||
|
|
Loading…
Reference in a new issue