GNOME Bugzilla – Bug 724983
hlsdemux: Invalid timestamps generated for live streams and otherwise broken for live streams
Last modified: 2018-11-03 13:21:15 UTC
a) Currently hlsdemux generates timestamps by summing all the fragment durations in the playlist. Only that this will lead to invalid timestamps because the playlists are like a ringbuffer, only having a few fragments and not all since the beginning of time. We could keep all fragments around forever or try to assign a timestamp to the beginning of the playlist by looking at the sequence numbers of the fragments, but this is going to fail once we e.g. switch from one bitrate to another. Also it will fail if after a playlist update we have no old fragments around... we can't know how much gap there was in between. b) If we pause the pipeline, we will lack behind... and can easily get to a point where all fragments have disappeared already. We need to resync then, and probably always resync whenever we unpause. c) Due to us and the sender having different clocks, we will run out of sync at some point. Either being in the future for the sender (downloading fragments that don't exist yet) or too far in the past (downloading fragments that disappeared already). We need some resync logic for that. Probably rather unlikely case as it requires a lot of clock drift and everybody using HLS for such long-term live streaming doesn't deserve something else ;) a) and b) definitely need to be fixed, c) would be bonus if someone is bored :)
I think Andoni had some fixes for that in bug #698155, but those were dependent on the other feature additions... and are not applying to the 1.x version of the demuxer anyway.
a) is fixed by this here (hopefully): commit b3a72429107b5f9dea2633735314c07b065f233a Author: Sebastian Dröge <sebastian@centricular.com> Date: Sun Feb 23 15:18:22 2014 +0100 hlsdemux: Keep track of timestamps by adding them up during playback ...instead of adding them from the start of playlist every time. This among other things fixes timestamps for live streams, where the playlist is some kind of ringbuffer of fragments and thus adding from the beginning of the playlist will miss the past fragments. https://bugzilla.gnome.org/show_bug.cgi?id=724983
I also have a fix for this in bug #731982
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/134.