summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-03 01:59:40 +0200
committerwm4 <wm4@nowhere>2014-09-03 02:00:18 +0200
commit9e512c5a98fc5cf827611a809e43698197831b3d (patch)
treeb371a0c3c636740c302bd04748b11aa5bc6054e3 /demux
parentbf74a4cc4665f152212c0e165bbe2a20d535021c (diff)
downloadmpv-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')
-rw-r--r--demux/demux.c3
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