blob: 85fea67be41aae460751253b5c68a6f917f09581 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From cfb432fcd8868c7a4f32010c61e47e2bf0ff80c6 Mon Sep 17 00:00:00 2001
Patrick Williams8b8bc412016-08-17 15:02:23 -05002From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
3Date: Mon, 25 May 2015 14:53:35 +0200
4Subject: [PATCH] Don't try to acquire buffer when src pad isn't active
5
6This solves a race condition when setting the pipeline from PAUSE to
7NULL while the decoder loop is still running. Without this patch, the
8thread which interacts with the decode sink pad gets blocked here:
9
10 gst_element_change_state()
11 gst_element_change_state_func()
12 gst_element_pads_activate() --> Deactivating pads
13 activate_pads()
14 gst_pad_set_active()
15 gst_pad_activate_mode()
16 post_activate()
17 GST_PAD_STREAM_LOCK()
18
19while gst_omx_port_acquire_buffer() gets stalled forever in
20gst_omx_component_wait_message() waiting for a message that will never
21arrive:
22
23 gst_omx_video_dec_loop()
24 gst_omx_port_acquire_buffer()
25 gst_omx_component_wait_message()
Brad Bishop316dfdd2018-06-25 12:45:53 -040026
Patrick Williams8b8bc412016-08-17 15:02:23 -050027---
28 omx/gstomxvideodec.c | 5 +++++
29 1 file changed, 5 insertions(+)
30
31diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
Brad Bishop316dfdd2018-06-25 12:45:53 -040032index d12ee8f..fb0100a 100644
Patrick Williams8b8bc412016-08-17 15:02:23 -050033--- a/omx/gstomxvideodec.c
34+++ b/omx/gstomxvideodec.c
Brad Bishop316dfdd2018-06-25 12:45:53 -040035@@ -1250,6 +1250,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
Patrick Williams8b8bc412016-08-17 15:02:23 -050036 GstClockTimeDiff deadline;
37 OMX_ERRORTYPE err;
38
39+ if (!gst_pad_is_active(GST_VIDEO_DECODER_SRC_PAD (self))) {
40+ GST_DEBUG_OBJECT (self, "Src pad not active, not acquiring buffer and flushing instead");
41+ goto flushing;
42+ }
43+
44 #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
45 port = self->eglimage ? self->egl_out_port : self->dec_out_port;
46 #else