diff options
author | wm4 <wm4@nowhere> | 2014-09-03 01:59:40 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-03 02:00:18 +0200 |
commit | 9e512c5a98fc5cf827611a809e43698197831b3d (patch) | |
tree | b371a0c3c636740c302bd04748b11aa5bc6054e3 /demux/demux.c | |
parent | bf74a4cc4665f152212c0e165bbe2a20d535021c (diff) | |
download | mpv-9e512c5a98fc5cf827611a809e43698197831b3d.tar.bz2 mpv-9e512c5a98fc5cf827611a809e43698197831b3d.tar.xz |
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.
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c index b9ddc56e77..a42fef0925 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -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 |