After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759108 - hlsdemux: add support for snapping seek flags
hlsdemux: add support for snapping seek flags
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2015-12-07 04:23 UTC by Duncan Palmer
Modified: 2015-12-08 22:44 UTC
See Also:
GNOME target: ---
GNOME version: ---

Honour seek snap flags (2.57 KB, patch)
2015-12-07 04:27 UTC, Duncan Palmer
none Details | Review
Honor seek snap flags (2.53 KB, patch)
2015-12-07 04:34 UTC, Duncan Palmer
needs-work Details | Review
Honour seek snap flags (2.50 KB, patch)
2015-12-08 04:16 UTC, Duncan Palmer
committed Details | Review

Description Duncan Palmer 2015-12-07 04:23:46 UTC
Seeking to a position which not near a segment boundary can result in the seek taking quite a while to complete. There are a couple of scenarios;
- The bitrate of the connection not much more than the bitrate of the variant; in this case, we have to wait for the data between segment start and seek position to download before our initial frame can be decoded. This can take a couple of seconds.
- The stream is high bitrate and/or encrypted, and we're running on a slow embedded processor. So, even tho data before the start position is not decoded, it still takes significant time to process it. Again, this can increase the time taken to seek by the order of seconds.

This problem can be avoided by using the seek snap flags to seek to a segment boundary only.
Comment 1 Duncan Palmer 2015-12-07 04:27:42 UTC
Created attachment 316862 [details] [review]
Honour seek snap flags
Comment 2 Duncan Palmer 2015-12-07 04:34:57 UTC
Created attachment 316863 [details] [review]
Honor seek snap flags

Correct the comment.
Comment 3 Sebastian Dröge (slomo) 2015-12-07 12:07:29 UTC
Review of attachment 316863 [details] [review]:

Looks almost good, thanks for the patch

::: ext/hls/gsthlsdemux.c
@@ +350,3 @@
+    gboolean update;
+    gst_segment_do_seek (&demux->segment, rate, format, flags, start_type,
+        current_pos, stop_type, stop, &update);

You could just pass NULL for update
Comment 4 Duncan Palmer 2015-12-08 04:16:52 UTC
Created attachment 316912 [details] [review]
Honour seek snap flags

I should have looked further than the comment block on gst_segment_do_seek(); updated patch attached.
Comment 5 Sebastian Dröge (slomo) 2015-12-08 07:58:32 UTC
commit 612f16936cf1523860aa86c188d30f478034e625
Author: Duncan Palmer <>
Date:   Mon Dec 7 14:10:30 2015 +1000

    hlsdemux: add support for seeking to fragment boundaries
    Setting the seek flags to GST_SEEK_FLAG_SNAP_* will change the seek
    target time to a segment boundary.
    Based on original work by Ben Willers <>.
Comment 6 Sebastian Dröge (slomo) 2015-12-08 07:59:03 UTC
Now we should ideally do exactly the same for dashdemux and mssdemux :)
Comment 7 Duncan Palmer 2015-12-08 22:44:35 UTC
Yes, that occurred to me as well. I see you've raised another issue on it. I'd like to spend a bit of time with dash demux at least. But it could be a couple of months before that time materialises...