summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Leggett <minfrin@sharp.fm>2016-12-18 19:46:55 +0000
committerSebastian Dröge <sebastian@centricular.com>2016-12-22 14:43:33 +0200
commit58713ade442e11a081b97834113e41b97dd9da3e (patch)
treea9ed7cb2115bf094fb939758f8152a02f47b63f5
parent98df98e65b4035792557a76d21897fd953875bca (diff)
omx*dec: Flush before we stop the srcpad loop
Flushing could otherwise hang if output port queue of pending buffers was empty https://bugzilla.gnome.org/show_bug.cgi?id=774654
-rw-r--r--omx/gstomxaudiodec.c12
-rw-r--r--omx/gstomxvideodec.c18
2 files changed, 15 insertions, 15 deletions
diff --git a/omx/gstomxaudiodec.c b/omx/gstomxaudiodec.c
index 6e9d6df..8b8e121 100644
--- a/omx/gstomxaudiodec.c
+++ b/omx/gstomxaudiodec.c
@@ -990,7 +990,12 @@ gst_omx_audio_dec_flush (GstAudioDecoder * decoder, gboolean hard)
gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE);
}
- /* 1) Wait until the srcpad loop is stopped,
+ /* 1) Flush the ports */
+ GST_DEBUG_OBJECT (self, "flushing ports");
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
+
+ /* 2) Wait until the srcpad loop is stopped,
* unlock GST_AUDIO_DECODER_STREAM_LOCK to prevent deadlocks
* caused by using this lock from inside the loop function */
GST_AUDIO_DECODER_STREAM_UNLOCK (self);
@@ -998,11 +1003,6 @@ gst_omx_audio_dec_flush (GstAudioDecoder * decoder, gboolean hard)
GST_DEBUG_OBJECT (self, "Flushing -- task stopped");
GST_AUDIO_DECODER_STREAM_LOCK (self);
- /* 2) Flush the ports */
- GST_DEBUG_OBJECT (self, "flushing ports");
- gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
- gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
-
/* 3) Resume components */
gst_omx_component_set_state (self->dec, OMX_StateExecuting);
gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE);
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index 6baaa48..79b4daa 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -2097,15 +2097,7 @@ gst_omx_video_dec_flush (GstVideoDecoder * decoder)
}
#endif
- /* 1) Wait until the srcpad loop is stopped,
- * 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_DEBUG_OBJECT (self, "Flushing -- task stopped");
- GST_VIDEO_DECODER_STREAM_LOCK (self);
-
- /* 2) Flush the ports */
+ /* 1) Flush the ports */
GST_DEBUG_OBJECT (self, "flushing ports");
gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
@@ -2117,6 +2109,14 @@ gst_omx_video_dec_flush (GstVideoDecoder * decoder)
}
#endif
+ /* 2) Wait until the srcpad loop is stopped,
+ * 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_DEBUG_OBJECT (self, "Flushing -- task stopped");
+ GST_VIDEO_DECODER_STREAM_LOCK (self);
+
/* 3) Resume components */
gst_omx_component_set_state (self->dec, OMX_StateExecuting);
gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE);