1From 160181edf5fc73288abfe99fa04de4a550cd9c65 Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Thu, 11 Feb 2016 12:53:20 -0800 4Subject: [PATCH] Don't try to acquire buffer when src pad isn't active 5 6From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com> 7 8This 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() 28 29--- 30Upstream-Status: Pending 31 32 omx/gstomxvideodec.c | 5 +++++ 33 1 file changed, 5 insertions(+) 34 35diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c 36index abe6e30..c4dc33f 100644 37--- a/omx/gstomxvideodec.c 38+++ b/omx/gstomxvideodec.c 39@@ -1598,6 +1598,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) 40 GstOMXAcquireBufferReturn acq_return; 41 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 51