blob: 5e206e58e4f9623c573669cdb2aa37698aef36b2 [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001From 160181edf5fc73288abfe99fa04de4a550cd9c65 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 11 Feb 2016 12:53:20 -0800
Patrick Williams8b8bc412016-08-17 15:02:23 -05004Subject: [PATCH] Don't try to acquire buffer when src pad isn't active
5
Brad Bishop15ae2502019-06-18 21:44:24 -04006From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
7
Patrick Williams8b8bc412016-08-17 15:02:23 -05008This solves a race condition when setting the pipeline from PAUSE to
9NULL while the decoder loop is still running. Without this patch, the
10thread which interacts with the decode sink pad gets blocked here:
11
12 gst_element_change_state()
13 gst_element_change_state_func()
14 gst_element_pads_activate() --> Deactivating pads
15 activate_pads()
16 gst_pad_set_active()
17 gst_pad_activate_mode()
18 post_activate()
19 GST_PAD_STREAM_LOCK()
20
21while gst_omx_port_acquire_buffer() gets stalled forever in
22gst_omx_component_wait_message() waiting for a message that will never
23arrive:
24
25 gst_omx_video_dec_loop()
26 gst_omx_port_acquire_buffer()
27 gst_omx_component_wait_message()
Brad Bishop316dfdd2018-06-25 12:45:53 -040028
Patrick Williams8b8bc412016-08-17 15:02:23 -050029---
Patrick Williams520786c2023-06-25 16:20:36 -050030Upstream-Status: Pending
31
Patrick Williams8b8bc412016-08-17 15:02:23 -050032 omx/gstomxvideodec.c | 5 +++++
33 1 file changed, 5 insertions(+)
34
35diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
Brad Bishop15ae2502019-06-18 21:44:24 -040036index abe6e30..c4dc33f 100644
Patrick Williams8b8bc412016-08-17 15:02:23 -050037--- a/omx/gstomxvideodec.c
38+++ b/omx/gstomxvideodec.c
Brad Bishop15ae2502019-06-18 21:44:24 -040039@@ -1598,6 +1598,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
40 GstOMXAcquireBufferReturn acq_return;
Patrick Williams8b8bc412016-08-17 15:02:23 -050041 OMX_ERRORTYPE err;
42
43+ if (!gst_pad_is_active(GST_VIDEO_DECODER_SRC_PAD (self))) {
44+ GST_DEBUG_OBJECT (self, "Src pad not active, not acquiring buffer and flushing instead");
45+ goto flushing;
46+ }
47+
48 #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
49 port = self->eglimage ? self->egl_out_port : self->dec_out_port;
50 #else