From 3c3361217c96337270b112e52f9eb6cc5931b390 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Aug 2016 11:26:57 +0200 Subject: player: offset demuxer on start/seek properly with audio/sub delay Assume you use a large value like --audio-delay=20. Then until now the player would just have seeked normally to a "too late" position, and played silence for about 20 seconds until audio in the correct time range is coming again. Change this by offsetting seeks by the right amount. This works for both external and muxed files. If a seek isn't precise, then it works only for external files. This might cause issues with very large delay options. Hr-seek skipping could take a lot of time (especially because it affects video too), the demuxer queue could overflow, and other weird corner cases could appear. But we just try this on best-effort basis, and if the user uses extreme values we don't guarantee good behavior. --- player/loadfile.c | 1 + 1 file changed, 1 insertion(+) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 94d0b2bd5d..3d04a3720d 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -208,6 +208,7 @@ void reselect_demux_stream(struct MPContext *mpctx, struct track *track) double pts = get_current_time(mpctx); if (pts == MP_NOPTS_VALUE) pts = 0; + pts += get_track_seek_offset(mpctx, track); demux_seek(track->demuxer, pts, 0); } } -- cgit v1.2.3