blob: 815a7c2b6e7a54b382991be09bfba245990fcb6a [file] [log] [blame]
Patrick Williams8b8bc412016-08-17 15:02:23 -05001From 2e111e52f96f0b942abda120c30a876629bd73fc Mon Sep 17 00:00:00 2001
2From: =?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()
26---
27 omx/gstomxvideodec.c | 5 +++++
28 1 file changed, 5 insertions(+)
29
30diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
31index cd24944..57a61dd 100644
32--- a/omx/gstomxvideodec.c
33+++ b/omx/gstomxvideodec.c
34@@ -1247,6 +1247,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
35 GstClockTimeDiff deadline;
36 OMX_ERRORTYPE err;
37
38+ if (!gst_pad_is_active(GST_VIDEO_DECODER_SRC_PAD (self))) {
39+ GST_DEBUG_OBJECT (self, "Src pad not active, not acquiring buffer and flushing instead");
40+ goto flushing;
41+ }
42+
43 #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
44 port = self->eglimage ? self->egl_out_port : self->dec_out_port;
45 #else
46--
471.8.3.2
48