seek on filesrc with TS file

Mathieu Duponchelle mathieu at centricular.com
Thu May 20 15:00:40 UTC 2021


Hey, as I said I think this would be best discussed in a gitlab issue,
with sample code / input :)

On 5/20/21 1:27 PM, Marianna S. Buschle via gstreamer-devel wrote:
> I have tried debugging the error from `tsdemux`, it comes from here:
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/gst/mpegtsdemux/tsdemux.c#L919
>
> And the source for that function is here:
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/gst/mpegtsdemux/mpegtspacketizer.c#L2377
>
> This is the debug info of the first seek, which works:
>
> 0:00:06.959642670 199456 0x7fe7a4019800 DEBUG                tsdemux
> tsdemux.c:967:gst_ts_demux_srcpad_event:<tsdemux0:video_0_0041> Got event
> seek
> 0:00:06.959684979 199456 0x7fe7a4019800 DEBUG                tsdemux
> tsdemux.c:873:gst_ts_demux_do_seek: seek event, seek event: 0x7fe760013420,
> time 99:99:99.999999999, seq-num 375, GstEventSeek, rate=(double)1,
> format=(GstFormat)time,
> flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH+GST_SEEK_FLAG_ACCURATE,
> cur-type=(GstSeekType)set, cur=(gint64)0, stop-type=(GstSeekType)none,
> stop=(gint64)-1, trickmode-interval=(guint64)0;
> 0:00:06.959698294 199456 0x7fe7a4019800 LOG                  tsdemux
> tsdemux.c:890:gst_ts_demux_do_seek:<tsdemux0> Before seek, output segment
> time segment start=0:00:00.125000000, offset=0:00:00.000000000,
> stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00,
> time=0:00:00.125000000, base=0:00:00.000000000, position 0:00:03.925000000,
> duration 99:99:99.999999999
> 0:00:06.959707360 199456 0x7fe7a4019800 DEBUG                tsdemux
> tsdemux.c:901:gst_ts_demux_do_seek:<tsdemux0> After seek, update 1 output
> segment now time segment start=0:00:00.000000000, offset=0:00:00.000000000,
> stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x01,
> time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000,
> duration 99:99:99.999999999
> 0:00:06.959713536 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2400:mpegts_packetizer_ts_to_offset: Searching offset for
> ts 0:00:00.000000000
> 0:00:06.959716922 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2407:mpegts_packetizer_ts_to_offset: pcr is in current
> group
> 0:00:06.959720421 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2445:mpegts_packetizer_ts_to_offset:
> nextgroup:0x7fe7a001a6f0, prevgroup:(nil)
> 0:00:06.959722987 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2452:mpegts_packetizer_ts_to_offset: In group or after
> last one
> 0:00:06.959726146 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2475:mpegts_packetizer_ts_to_offset: Using prev PCR 0
> offset 375
> 0:00:06.959729468 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2477:mpegts_packetizer_ts_to_offset: Using last PCR
> 101700000 offset 151527
> 0:00:06.959733665 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2485:mpegts_packetizer_ts_to_offset: Returning offset 375
> for ts 0:00:00.000000000
> 0:00:06.959742243 199456 0x7fe7a4019800 DEBUG             mpegtsbase
> mpegtsbase.c:1357:mpegts_base_sink_event:<mpegtsparse2-0> Got event
> flush-start
> 0:00:06.959749358 199456 0x7fe7a4019800 DEBUG             mpegtsbase
> mpegtsbase.c:1357:mpegts_base_sink_event:<tsdemux0> Got event flush-start
> 0:00:06.959783354 199456 0x7fe7a4009060 DEBUG                tsdemux
> tsdemux.c:3250:gst_ts_demux_push_pending_data:<tsdemux0:video_0_0041>
> Returned flushing
> 0:00:06.959795268 199456 0x7fe7a4009060 DEBUG                tsdemux
> tsdemux.c:3252:gst_ts_demux_push_pending_data:<tsdemux0:video_0_0041>
> combined flushing
> 0:00:06.959801322 199456 0x7fe7a4009060 LOG                  tsdemux
> tsdemux.c:3282:gst_ts_demux_push_pending_data: Cleared PES data. returning
> flushing
> 0:00:06.959861517 199456 0x7fe7a4019800 DEBUG             mpegtsbase
> mpegtsbase.c:1357:mpegts_base_sink_event:<mpegtsparse2-0> Got event
> flush-stop
> 0:00:06.959871566 199456 0x7fe7a4019800 DEBUG             mpegtsbase
> mpegtsbase.c:1357:mpegts_base_sink_event:<tsdemux0> Got event flush-stop
> 0:00:06.960077437 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:619:mpegts_packetizer_flush: Flushing
> 0:00:06.960096515 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1946:_close_current_group: Closing group and resetting
> current
> 0:00:06.960103353 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1925:_append_group_values: First PCR:0:59:59.879411111
> offset:375 PCR_offset:0:00:00.000000000
> 0:00:06.960107998 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1930:_append_group_values: Last PCR: +0:00:03.766666666
> offset: +151152
> 0:00:06.960111306 199456 0x7fe7a4019800 DEBUG                tsdemux
> tsdemux.c:1959:gst_ts_demux_stream_flush: flushing stream 0x7fe7a001cce0
> 0:00:06.960114489 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:619:mpegts_packetizer_flush: Flushing
> 0:00:06.960126381 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1946:_close_current_group: Closing group and resetting
> current
> 0:00:06.960131801 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1925:_append_group_values: First PCR:0:59:59.879411111
> offset:376 PCR_offset:0:00:00.000000000
> 0:00:06.960135974 199456 0x7fe7a4019800 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:1930:_append_group_values: Last PCR: +0:00:03.833333333
> offset: +153972
>
> And here for the second, which fails:
>
> 0:00:09.914908872 199456 0x7fe754012d90 DEBUG                tsdemux
> tsdemux.c:967:gst_ts_demux_srcpad_event:<tsdemux0:video_0_0041> Got event
> seek
> 0:00:09.914957580 199456 0x7fe754012d90 DEBUG                tsdemux
> tsdemux.c:873:gst_ts_demux_do_seek: seek event, seek event: 0x7fe74c004e00,
> time 99:99:99.999999999, seq-num 601, GstEventSeek, rate=(double)1,
> format=(GstFormat)time,
> flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH+GST_SEEK_FLAG_ACCURATE,
> cur-type=(GstSeekType)set, cur=(gint64)0, stop-type=(GstSeekType)none,
> stop=(gint64)-1, trickmode-interval=(guint64)0;
> 0:00:09.914982068 199456 0x7fe754012d90 LOG                  tsdemux
> tsdemux.c:890:gst_ts_demux_do_seek:<tsdemux0> Before seek, output segment
> time segment start=0:00:00.125000000, offset=0:00:00.000000000,
> stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x01,
> time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:03.491666666,
> duration 99:99:99.999999999
> 0:00:09.915008650 199456 0x7fe754012d90 DEBUG                tsdemux
> tsdemux.c:901:gst_ts_demux_do_seek:<tsdemux0> After seek, update 1 output
> segment now time segment start=0:00:00.000000000, offset=0:00:00.000000000,
> stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x01,
> time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000,
> duration 99:99:99.999999999
> 0:00:09.915014344 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2400:mpegts_packetizer_ts_to_offset: Searching offset for
> ts 0:00:00.000000000
> 0:00:09.915018148 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2407:mpegts_packetizer_ts_to_offset: pcr is in current
> group
> 0:00:09.915021668 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2445:mpegts_packetizer_ts_to_offset:
> nextgroup:0x7fe7a001a720, prevgroup:(nil)
> 0:00:09.915024799 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2452:mpegts_packetizer_ts_to_offset: In group or after
> last one
> 0:00:09.915028582 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2475:mpegts_packetizer_ts_to_offset: Using prev PCR 0
> offset 18446744073709551615
> 0:00:09.915031580 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2477:mpegts_packetizer_ts_to_offset: Using last PCR
> 90900000 offset 135735
> 0:00:09.915036435 199456 0x7fe754012d90 DEBUG       mpegtspacketizer
> mpegtspacketizer.c:2485:mpegts_packetizer_ts_to_offset: Returning offset
> 18446744073709551615 for ts 0:00:00.000000000
> 0:00:09.915039441 199456 0x7fe754012d90 WARN                 tsdemux
> tsdemux.c:917:gst_ts_demux_do_seek: Couldn't convert start position to an
> offset
> 0:00:09.915042629 199456 0x7fe754012d90 WARN              mpegtsbase
> mpegtsbase.c:1721:mpegts_base_handle_seek_event: seeking failed error
> 0:00:09.915045761 199456 0x7fe754012d90 WARN                 tsdemux
> tsdemux.c:974:gst_ts_demux_srcpad_event: seeking failed
> 0:00:09.915053277 199456 0x7fe754012d90 DEBUG                tsdemux
> tsdemux.c:967:gst_ts_demux_srcpad_event:<tsdemux0:video_0_0041> Got event
> seek
> 0:00:09.915056853 199456 0x7fe754012d90 WARN                 tsdemux
> tsdemux.c:974:gst_ts_demux_srcpad_event: seeking failed
>
> The problem seems to be this:
> mpegtspacketizer.c:2485:mpegts_packetizer_ts_to_offset: Returning offset
> 18446744073709551615 for ts 0:00:00.000000000
>
> Which is actually -1 and comes from here:
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/gst/mpegtsdemux/mpegtspacketizer.c#L2453
> which actually comes from this pcr_table:
> pcrtable = get_pcr_table (packetizer, pcr_pid);
>
> But no idea why that is -1 in the table, I don't actually know anything
> about the mpegts internals...
>
> Could it be that something is being set wrong after the first seek?
>
>
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list