diff options
author | wm4 <wm4@nowhere> | 2018-09-07 21:32:01 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | 0fa38121a6ce6baed277b17a1ca1e28f5978343f (patch) | |
tree | 6eb9c65d2781199fd6cf563541635adb6d0ed344 /demux | |
parent | b9be20b529de8f47e795d9a869299548d8788528 (diff) | |
download | mpv-0fa38121a6ce6baed277b17a1ca1e28f5978343f.tar.bz2 mpv-0fa38121a6ce6baed277b17a1ca1e28f5978343f.tar.xz |
demux_timeline: fix off by one error, rearrange weird code
This code set pkt->stream to a value which I'm not sure whether it's
correct. A recent commit overwrote it with a value that is definitely
correct.
There appears to be an off by one error. No fucking clue whether this
was somehow correct, but applying an apparent fix does not seem to break
anything, so whatever.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_timeline.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index c34619a6d2..d0c1740e9e 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -272,7 +272,7 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt return true; // reader will retry } - if (pkt->stream < 0 || pkt->stream > seg->num_stream_map) + if (pkt->stream < 0 || pkt->stream >= seg->num_stream_map) goto drop; if (!p->dash) { @@ -285,8 +285,8 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt pkt->end = seg->end; } - pkt->stream = seg->stream_map[pkt->stream]; - if (pkt->stream < 0) + int vs_index = seg->stream_map[pkt->stream]; + if (vs_index < 0) goto drop; // for refresh seeks, demux.c prefers monotonically increasing packet pos @@ -294,7 +294,7 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt if (pkt->pos >= 0) pkt->pos |= (seg->index & 0x7FFFULL) << 48; - struct virtual_stream *vs = p->streams[pkt->stream]; + struct virtual_stream *vs = p->streams[vs_index]; if (pkt->pts != MP_NOPTS_VALUE && pkt->pts >= seg->end) { // Trust the keyframe flag. Might not always be a good idea, but will |