1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-02 20:28:02 +00:00

demux_timeline: enable refresh seeks in some situations

Play a trick to make the packet pos field monotonically increasing over
segment boundaries if the source demuxers return monotonically
increasing pos values. This allows the demuxer to uniquely identify
packets with the pos field, and can do refresh seeks using that.

Normally, the packet pos field is used as a fallback for determining the
playback position if the demuxer returns no proper duration. But
demux_timeline.c always will, and the packet pos fields usually make no
sense in relation to the returned file size anyway if the timeline
source demuxers originate from separate streams.
This commit is contained in:
wm4 2016-08-07 13:53:34 +02:00
parent 78bcbe289e
commit 39ae261cc5

View File

@ -197,6 +197,11 @@ static int d_fill_buffer(struct demuxer *demuxer)
if (pkt->stream < 0)
goto drop;
// for refresh seeks, demux.c prefers monotonically increasing packet pos
// since the packet pos is meaningless anyway for timeline, use it
if (pkt->pos >= 0)
pkt->pos |= (seg->index & 0x7FFFULL) << 48;
struct virtual_stream *vs = &p->streams[pkt->stream];
if (pkt->pts != MP_NOPTS_VALUE && pkt->pts >= seg->end) {