1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-08 16:07:16 +00:00

demux: late streams on start shouldn't restrict the seek range

If a stream starts later than the others at the start of the file, it
shouldn't restrict the seek range to the time stamp where it begins.
This is similar to the previous commit, just for the other end.
This commit is contained in:
wm4 2018-05-13 16:32:12 +02:00
parent 2fc59ea8b3
commit 75b2e6ed67

View File

@ -508,13 +508,19 @@ static void update_seek_ranges(struct demux_cached_range *range)
range->is_bof = true;
range->is_eof = true;
double min_start_pts = MP_NOPTS_VALUE;
double max_end_pts = MP_NOPTS_VALUE;
for (int n = 0; n < range->num_streams; n++) {
struct demux_queue *queue = range->streams[n];
if (queue->ds->selected && queue->ds->eager) {
range->seek_start = MP_PTS_MAX(range->seek_start, queue->seek_start);
if (queue->is_bof) {
min_start_pts = MP_PTS_MIN(min_start_pts, queue->seek_start);
} else {
range->seek_start =
MP_PTS_MAX(range->seek_start, queue->seek_start);
}
if (queue->is_eof) {
max_end_pts = MP_PTS_MAX(max_end_pts, queue->seek_end);
@ -533,6 +539,8 @@ static void update_seek_ranges(struct demux_cached_range *range)
if (range->is_eof)
range->seek_end = max_end_pts;
if (range->is_bof)
range->seek_start = min_start_pts;
// Sparse stream behavior is not very clearly defined, but usually we don't
// want it to restrict the range of other streams, unless