Some derived classes (at least dashdemux) expose a seeking range
based on wall clock. This means that a subsequent seek to the start
of this range will be before the allowed range.
To solve this, seeks without the ACCURATE flag are allowed to seek
before the start for live streams, in which case the segment is
shifted to start at the start of the new seek range. If there is
an end position, is is shifted too, to keep the duration constant.
https://bugzilla.gnome.org/show_bug.cgi?id=753751
gst_event_unref (event);
return FALSE;
}
+
+ if (!(flags & GST_SEEK_FLAG_ACCURATE)) {
+ /* If the accurate flag is not set, we allow seeking before the start
+ * to map to the start for live cases, since those can return a "moving
+ * target" based on wall time.
+ */
+ if (start < range_start) {
+ guint64 dt = range_start - start;
+ GST_DEBUG_OBJECT (demux,
+ "Non accurate seek before live stream start, offsetting by %"
+ GST_TIME_FORMAT, GST_TIME_ARGS (dt));
+ start = range_start;
+ if (stop != GST_CLOCK_TIME_NONE)
+ stop += dt;
+ }
+ }
+
if (start < range_start || start >= range_stop) {
GST_MANIFEST_UNLOCK (demux);
GST_API_UNLOCK (demux);