adaptivedemux: Don't be too aggressive with seek ranges

When an accurate seek is requested on a live stream, only requests the
exact value for the "starting position" (i.e. start in forward playback
and stop in reverse playback).

https://bugzilla.gnome.org/show_bug.cgi?id=782698
This commit is contained in:
Edward Hervey 2017-05-16 17:29:35 +02:00 committed by Edward Hervey
parent 34d8ddd92d
commit b104fb203a

View file

@ -1560,27 +1560,28 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
changed = TRUE; changed = TRUE;
} }
if (!(flags & GST_SEEK_FLAG_ACCURATE)) { /* Adjust the requested start/stop position if it falls beyond the live
/* If the accurate flag is not set, we allow seeking before the start * seek range.
* to map to the start for live cases, since those can return a "moving * The only case where we don't adjust is for the starting point of
* target" based on wall time. * an accurate seek (start if forward and stop if backwards)
*/ */
if (start_type == GST_SEEK_TYPE_SET && start < range_start) { if (start_type == GST_SEEK_TYPE_SET && start < range_start &&
(rate < 0 || !(flags & GST_SEEK_FLAG_ACCURATE))) {
GST_DEBUG_OBJECT (demux, GST_DEBUG_OBJECT (demux,
"Non accurate seek before live stream start, setting to range start: %" "seek before live stream start, setting to range start: %"
GST_TIME_FORMAT, GST_TIME_ARGS (range_start)); GST_TIME_FORMAT, GST_TIME_ARGS (range_start));
start = range_start; start = range_start;
changed = TRUE; changed = TRUE;
} }
/* truncate stop position also if set */ /* truncate stop position also if set */
if (stop_type == GST_SEEK_TYPE_SET && stop > range_stop) { if (stop_type == GST_SEEK_TYPE_SET && stop > range_stop &&
(rate > 0 || !(flags & GST_SEEK_FLAG_ACCURATE))) {
GST_DEBUG_OBJECT (demux, GST_DEBUG_OBJECT (demux,
"Non accurate seek beyong now, setting to: %" "seek ending after live start, adjusting to: %"
GST_TIME_FORMAT, GST_TIME_ARGS (range_stop)); GST_TIME_FORMAT, GST_TIME_ARGS (range_stop));
stop = range_stop; stop = range_stop;
changed = TRUE; changed = TRUE;
} }
}
if (start_type == GST_SEEK_TYPE_SET && GST_CLOCK_TIME_IS_VALID (start) && if (start_type == GST_SEEK_TYPE_SET && GST_CLOCK_TIME_IS_VALID (start) &&
(start < range_start || start > range_stop)) { (start < range_start || start > range_stop)) {