0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch 1.6 KB

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