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,26 +1560,27 @@ 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 &&
GST_DEBUG_OBJECT (demux, (rate < 0 || !(flags & GST_SEEK_FLAG_ACCURATE))) {
"Non accurate seek before live stream start, setting to range start: %" GST_DEBUG_OBJECT (demux,
GST_TIME_FORMAT, GST_TIME_ARGS (range_start)); "seek before live stream start, setting to range start: %"
start = range_start; GST_TIME_FORMAT, GST_TIME_ARGS (range_start));
changed = TRUE; start = range_start;
} changed = TRUE;
/* truncate stop position also if set */ }
if (stop_type == GST_SEEK_TYPE_SET && stop > range_stop) { /* truncate stop position also if set */
GST_DEBUG_OBJECT (demux, if (stop_type == GST_SEEK_TYPE_SET && stop > range_stop &&
"Non accurate seek beyong now, setting to: %" (rate > 0 || !(flags & GST_SEEK_FLAG_ACCURATE))) {
GST_TIME_FORMAT, GST_TIME_ARGS (range_stop)); GST_DEBUG_OBJECT (demux,
stop = range_stop; "seek ending after live start, adjusting to: %"
changed = TRUE; GST_TIME_FORMAT, GST_TIME_ARGS (range_stop));
} stop = range_stop;
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) &&