deadlock after seek

Patrick Fischer patrick.fischer at vitec.com
Thu Apr 6 07:30:10 UTC 2023


Hello List

I have a problem with seek.
Occasionally it happens that I have a deadlock when I try to reverse. Happens every 5-20 times.

I have had this problem for several years now.
It is a mobile app on Android and iOS. So far the problem is only known to occur on Android, but that doesn't mean it can't occur on iOS.

The structure of my pipeline
httpsoupsrc -> src-queue -> typefind -> demux -> audioqueue -> aacparse -> capsfilter -> appsink
                                                     (so from demux) -> videoqueue -> h264parse -> capsfilter -> appsink


For the implementation of the Seek function I tried different approaches. My current implementation looks like this:

static void
seek_to_time(CustomData *customData,
             gint64 seekToPos)
{
    if (!GST_CLOCK_TIME_IS_VALID (customData->duration)) {
        LOGW ("Seek failed! Invalid duration\n");
    }
    LOGI ("seek_to_time to %" G_GINT64_FORMAT "\n", seekToPos);
    if(!gst_element_seek_simple(customData->pipeline, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),seekToPos))
    {
        LOGW ("Seek failed!\n");
    }
    g_usleep(500); // just to test, no change with or without
    LOGI ("seek_to_time to %" G_GINT64_FORMAT " done\n", seekToPos);

    GstState current, pending;
    GstStateChangeReturn stateChange = gst_element_get_state(customData->pipeline, &current, &pending, 0*GST_SECOND);

    gst_element_set_state (GST_ELEMENT (customData->pipeline), GST_STATE_PLAYING);
}

With the debugger I can see that it hangs at gst_element_get_state.
There it never comes back. I also did it with a timeout it didn't change anything unfortunately.


When I look into the logfile, I see that I often get the following log output:
16:49:22.216 W ../gst/gstpad.c:4677:gst_pad_push_data:<ts-demuxer:audio_0_04da> Got data flow before segment event
16:49:22.216 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<AACqueue1:sink> Got data flow before segment event
16:49:22.216 W ../gst/gstpad.c:4677:gst_pad_push_data:<AACqueue1:src> Got data flow before segment event
16:49:22.216 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<AACparse1:sink> Got data flow before segment event
16:49:22.258 W ../gst/gstpad.c:4677:gst_pad_push_data:<ts-demuxer:video_0_04d9> Got data flow before segment event
16:49:22.258 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<H264queue0:sink> Got data flow before segment event
16:49:22.258 W ../gst/gstpad.c:4677:gst_pad_push_data:<H264queue0:src> Got data flow before segment event
16:49:22.258 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<H264parse0:sink> Got data flow before segment event
16:49:22.261 W ../gst/gstpad.c:4677:gst_pad_push_data:<H264parse0:src> Got data flow before segment event
16:49:22.261 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<H264capsfilter0:sink> Got data flow before segment event
16:49:22.261 W ../gst/gstpad.c:4677:gst_pad_push_data:<H264capsfilter0:src> Got data flow before segment event
16:49:22.261 W ../gst/gstpad.c:4416:gst_pad_chain_data_unchecked:<H264appsink0:sink> Got data flow before segment event

This one worries me, but it also sometimes occurs when there is no deadlock.
Could the "Got data flow before segment event" problem have something to do with the hang?
I just can't figure out the problem.
Does anyone have any ideas what I can investigate further?

Regards
Patrick

Patrick Fischer
Software Developer
o: 
+49 4307 8358 0
patrick.fischer at vitec.com
www.vitec.com


Legal Notice
 Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this e-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this e-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately. Neither VITEC S.A. (66 Avenue des Champs Elysées – 75008 Paris - France) nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. VITEC GmbH, Lise-Meitner-Str. 15, 24223 Schwentinental
 Geschäftsführer/Managing Director: Philippe Wetzel
 HRB Plön 1584 / Steuernummer: 2029706365 / VATnumber: DE134878603
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230406/c94f0145/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image653352.png
Type: image/png
Size: 30451 bytes
Desc: image653352.png
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230406/c94f0145/attachment-0001.png>


More information about the gstreamer-devel mailing list