summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-14 14:29:21 +0100
committerwm4 <wm4@nowhere>2015-02-14 14:29:21 +0100
commitde0f3747ee13c300f9b073a6a3da984318aed40a (patch)
treed13084574304af46cb925886440822e07f34c8ed /demux
parentbf46f4c99714d2df105c3c004aa96680b4dda749 (diff)
downloadmpv-de0f3747ee13c300f9b073a6a3da984318aed40a.tar.bz2
mpv-de0f3747ee13c300f9b073a6a3da984318aed40a.tar.xz
demux: fix dropped subtitle packets with the new stream switching
If the previous subtitle packet is too far back, and the refresh seek won't pick it up, and the packet never comes again. As a consequence, the refresh mode was never stopped on the subtitle stream, which caused all packets to be discarded. Fix by assuming the file position is monotonically increasing; then it will resume even if a packet _after_ the intended resume point is returned. This introduces a new requirement on how the demuxer behaves. (I'm not sure if mp4 actually satisfies this requirement in all cases.) Fixes a regression introduced by commit f9f2e1cc.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c4
-rw-r--r--demux/demux.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 50fc32cb96..61c8e40b8c 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -309,8 +309,8 @@ int demux_add_packet(struct sh_stream *stream, demux_packet_t *dp)
if (ds->refreshing) {
// Resume reading once the old position was reached (i.e. we start
// returning packets where we left off before the refresh).
- drop = true;
- if (dp->pos == ds->last_pos)
+ drop = dp->pos <= ds->last_pos;
+ if (dp->pos >= ds->last_pos)
ds->refreshing = false;
}
diff --git a/demux/demux.h b/demux/demux.h
index c580a22b18..acab2db2ba 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -195,7 +195,8 @@ typedef struct demuxer {
bool rel_seeks;
// Enable fast track switching hacks. This requires from the demuxer:
// - seeking is somewhat reliable; packet contents must not change
- // - packet position (demux_packet.pos) is set, not negative, and unique
+ // - packet position (demux_packet.pos) is set, not negative, unique, and
+ // monotonically increasing
// - seeking leaves packet positions invariant
bool allow_refresh_seeks;