summaryrefslogtreecommitdiff
path: root/omx/gstomxaudioenc.c
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2013-03-09 14:14:40 +0100
committerJosep Torra <n770galaxy@gmail.com>2013-03-09 14:14:40 +0100
commitbd071327daab59482aac93ed526064ceb4131818 (patch)
treeed99ef8e97240fd0eea706308eafde8363bf392b /omx/gstomxaudioenc.c
parent7423e3e0232bc7267916133638c2b2563148a7a6 (diff)
downloadgst-omx-bd071327daab59482aac93ed526064ceb4131818.tar.gz
omx: Fix deadlock in encoders and add explainatory comments.
Diffstat (limited to 'omx/gstomxaudioenc.c')
-rw-r--r--omx/gstomxaudioenc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c
index 280187d..e49cc0a 100644
--- a/omx/gstomxaudioenc.c
+++ b/omx/gstomxaudioenc.c
@@ -634,7 +634,13 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
GST_DEBUG_OBJECT (self, "Need to disable and drain encoder");
gst_omx_audio_enc_drain (self);
gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
+
+ /* Wait until the srcpad loop is finished,
+ * unlock GST_AUDIO_ENCODER_STREAM_LOCK to prevent deadlocks
+ * caused by using this lock from inside the loop function */
+ GST_AUDIO_ENCODER_STREAM_UNLOCK (self);
gst_pad_stop_task (GST_AUDIO_ENCODER_SRC_PAD (encoder));
+ GST_AUDIO_ENCODER_STREAM_LOCK (self);
if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone)
return FALSE;