Decoding deadlock hint during seek

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Fri Jul 17 06:46:56 UTC 2020


Hi Olivier

I think that there are two thread. One is the mainapplication and one
is the decoder.
sink_event come from the main application but the decoding is on another thread.

static gboolean
gst_mpp_video_dec_sink_event (GstVideoDecoder * decoder, GstEvent * event)
{
  GstMppVideoDec *self = GST_MPP_VIDEO_DEC (decoder);
  gboolean ret;

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_FLUSH_START:
      GST_DEBUG_OBJECT (self, "flush start");
      gst_mpp_video_dec_unlock (self);
      break;
    default:
      break;
  }

  ret = GST_VIDEO_DECODER_CLASS (parent_class)->sink_event (decoder, event);

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_FLUSH_START:
      gst_pad_stop_task (decoder->srcpad);

If the decoding thread is working and we are in FLUSH_START I don't
need to stop here the the decoder because should be stop later
int the flash but in gst_v4l2_video_dec_sink_event, we do similar
things but forcing maybe before to unlock the pad.

Michael


      GST_DEBUG_OBJECT (self, "flush done");
      break;
    default:
      break;
  }

  return ret;
}

On Thu, Jul 16, 2020 at 8:16 PM Olivier Crête
<olivier.crete at collabora.com> wrote:
>
> Hi,
>
> On Thu, 2020-07-16 at 20:01 +0200, Michael Nazzareno Trimarchi wrote:
>
> From the stacktrace look like that I'm here
>
>
> GST_PAD_STREAM_LOCK (pad); <----- pad is already locked
>
> GST_PAD_STREAM_UNLOCK (pad);
>
>
> Can someone explain me this code?
>
>
> This pattern is used to ensure that the pad lock has been released by other code before proceding further. Normally after stopping a task. So if it stops there, you want to look at the other thread holding the lock and find out why it's not stopping, there is probably somethign blocking downstream.
>
> Olivier
>
>
> On Thu, Jul 16, 2020 at 7:51 PM Michael Nazzareno Trimarchi
>
> <
>
> michael at amarulasolutions.com
>
> > wrote:
>
>
> Hi
>
>
> This is more straight forward and happen using QTMultimedia and seek on mpp
>
>
> Michael
>
>
> On Thu, Jul 16, 2020 at 7:23 PM David Ing <
>
> ding at panopto.com
>
> > wrote:
>
>
> In the past, I have encountered deadlocks when a part of my pipeline has a demuxer or a tee, or basically some kind of element which "splits" a single stream into multiple streams.  The outputs (source pads) of all such elements should always be attached to some kind of queue because a queue is a thread boundary.
>
>
> So I guess step 1 is to analyze your pipeline and make sure you have queues in the right places.
>
>
> If you are still stuck then sometimes you can add more queues into random spots in your pipeline to see if that fixes the problem.
>
>
>
> On Thu, Jul 16, 2020 at 7:16 AM Michael Nazzareno Trimarchi <
>
> michael at amarulasolutions.com
>
> > wrote:
>
>
> Hi all
>
>
> 1   __libc_do_syscall                         libc-do-syscall.S
>
>             48   0xb4f10054
>
> 2   __lll_lock_wait                           lowlevellock.c
>
>             46   0xb4f0de42
>
> 3   __GI___pthread_mutex_lock                 pthread_mutex_lock.c
>
>             113  0xb4f088ac
>
> 4   g_rec_mutex_lock                          gthread-posix.c
>
>             308  0xb4b87120
>
> 5   gst_pad_stop_task                         gstpad.c
>
>             6301 0xaddf1d68
>
> 6   gst_mpp_video_dec_sink_event              gstmppvideodec.c
>
>             786  0xac00e816
>
> 7   gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 8   gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 9   gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 10  gst_base_transform_sink_eventfunc         gstbasetransform.c
>
>             1910 0xadeaed82
>
> 11  gst_capsfilter_sink_event                 gstevent.h
>
>             436  0xad5547e2
>
> 12  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 13  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 14  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 15  gst_base_parse_sink_event_default         gstbaseparse.c
>
>             1466 0xade96b6a
>
> 16  gst_h264_parse_event                      gsth264parse.c
>
>             2905 0xac0752d8
>
> 17  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 18  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 19  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 20  gst_multi_queue_sink_event                gstmultiqueue.c
>
>             2274 0xad56cb50
>
> 21  gst_pad_send_event_unchecked              gstpad.c
>
>             5760 0xadde88d8
>
> 22  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 23  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 24  gst_qtdemux_push_event                    qtdemux.c
>
>             1007 0xac98f082
>
> 25  gst_qtdemux_do_seek                       qtdemux.c
>
>             1659 0xac99efca
>
> 26  gst_qtdemux_handle_src_event              qtdemux.c
>
>             1791 0xac99efca
>
> 27  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 28  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 29  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 30  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 31  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 32  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 33  gst_base_parse_handle_seek                gstevent.h
>
>             436  0xade92c4e
>
> 34  gst_base_parse_src_event_default          gstbaseparse.c
>
>             1635 0xade92c4e
>
> 35  gst_h264_parse_src_event                  gsth264parse.c
>
>             2942 0xac079b50
>
> 36  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 37  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 38  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 39  gst_base_transform_src_eventfunc          gstbasetransform.c
>
>             1962 0xadeaf226
>
> 40  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 41  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 42  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 43  gst_video_decoder_src_event_default       gstvideodecoder.c
>
>             1494 0xad7b9ba6
>
> 44  gst_pad_send_event_unchecked              gstpad.c
>
>             5761 0xadde8aec
>
> 45  gst_pad_push_event_unchecked              gstpad.c
>
>             5406 0xadde8fa6
>
> 46  gst_pad_push_event                        gstpad.c
>
>             5543 0xaddf0cbc
>
> 47  event_forward_func                        gstevent.h
>
>             436  0xaddf0f7e
>
>
> Need some help/idea how debug decoder deadlock on seek on video decoding.
>
>
> Michael
>
>
>
> --
>
> Michael Nazzareno Trimarchi
>
> Amarula Solutions BV
>
> COO Co-Founder
>
> Cruquiuskade 47 Amsterdam 1018 AM NL
>
> T. +31(0)851119172
>
> M. +39(0)3479132170
>
> [`as]
>
> https://www.amarulasolutions.com
>
>
> _______________________________________________
>
> gstreamer-devel mailing list
>
> gstreamer-devel at lists.freedesktop.org
>
>
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> _______________________________________________
>
> gstreamer-devel mailing list
>
> gstreamer-devel at lists.freedesktop.org
>
>
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
>
> --
>
> Michael Nazzareno Trimarchi
>
> Amarula Solutions BV
>
> COO Co-Founder
>
> Cruquiuskade 47 Amsterdam 1018 AM NL
>
> T. +31(0)851119172
>
> M. +39(0)3479132170
>
> [`as]
>
> https://www.amarulasolutions.com
>
>
>
>
>
> --
>
> Olivier Crête
> olivier.crete at collabora.com
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



-- 
Michael Nazzareno Trimarchi
Amarula Solutions BV
COO Co-Founder
Cruquiuskade 47 Amsterdam 1018 AM NL
T. +31(0)851119172
M. +39(0)3479132170
[`as] https://www.amarulasolutions.com


More information about the gstreamer-devel mailing list