mirror of
https://github.com/mpv-player/mpv
synced 2025-03-03 12:47:49 +00:00
demux: allow increasing filepos only
The last demuxed file position (demuxer->filepos) is used to estimate the total playback percentage in files with possible timestamp resets (like MPEG-PS). Until know, reading from any stream set this position freely. This makes the position jump around. Fix this by allowing icnreasing file position only. Reset it on seeking. With crazy formats, this still could go wrong, but there's only so much you can do.
This commit is contained in:
parent
bf74a4cc46
commit
9e512c5a98
@ -500,7 +500,7 @@ static struct demux_packet *dequeue_packet(struct demux_stream *ds)
|
||||
ds->base_ts = ts;
|
||||
|
||||
// This implies this function is actually called from "the" user thread.
|
||||
if (pkt->pos >= 0)
|
||||
if (pkt->pos >= ds->in->d_user->filepos)
|
||||
ds->in->d_user->filepos = pkt->pos;
|
||||
|
||||
return pkt;
|
||||
@ -926,6 +926,7 @@ static void flush_locked(demuxer_t *demuxer)
|
||||
demuxer->in->eof = false;
|
||||
demuxer->in->last_eof = false;
|
||||
demuxer->in->idle = true;
|
||||
demuxer->filepos = -1; // implicitly synchronized
|
||||
}
|
||||
|
||||
// clear the packet queues
|
||||
|
Loading…
Reference in New Issue
Block a user