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;
gst_omx_video_dec_drain (self, FALSE);
gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
+
+ /* Wait until the srcpad loop is finished,
+ * unlock GST_VIDEO_DECODER_STREAM_LOCK to prevent deadlocks
+ * caused by using this lock from inside the loop function */
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
gst_pad_stop_task (GST_VIDEO_DECODER_SRC_PAD (decoder));
GST_VIDEO_DECODER_STREAM_LOCK (self);
GST_DEBUG_OBJECT (self, "Need to disable and drain encoder");
gst_omx_video_enc_drain (self, FALSE);
gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
+
+ /* Wait until the srcpad loop is finished,
+ * unlock GST_VIDEO_ENCODER_STREAM_LOCK to prevent deadlocks
+ * caused by using this lock from inside the loop function */
+ GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder));
+ GST_VIDEO_ENCODER_STREAM_LOCK (self);
if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone)
return FALSE;