summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-13 16:32:12 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:34 +0200
commit75b2e6ed67f429835e555ebea894e14d036fde46 (patch)
tree6f8f958d48fe4fbc478d5b6e2895e68692b7d17a
parent2fc59ea8b34691a66811a6481b2a6f0a61ed62e5 (diff)
downloadmpv-75b2e6ed67f429835e555ebea894e14d036fde46.tar.bz2
mpv-75b2e6ed67f429835e555ebea894e14d036fde46.tar.xz
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.
-rw-r--r--demux/demux.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c
index aba950b9ab..f386c3c2ae 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -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