diff options
author | wm4 <wm4@nowhere> | 2016-02-09 22:19:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-09 22:19:01 +0100 |
commit | b7f6dfc19ad1a051a8365c055c2a9629cb2341b4 (patch) | |
tree | 844e9126376e657278a70a3762cc46540e4adf95 /player/audio.c | |
parent | 668ba7441aed3157474e03cbb1ff24430919fa85 (diff) | |
download | mpv-b7f6dfc19ad1a051a8365c055c2a9629cb2341b4.tar.bz2 mpv-b7f6dfc19ad1a051a8365c055c2a9629cb2341b4.tar.xz |
player: force refresh seek when changing audio filters
Unfortunately I see no better solution.
The refresh seek is skipped if the amount of buffered audio is not
overly huge.
Unfortunately softvol af_volume insertion still can cause this issue,
because it's outside of the normal dynamic filter chain changing code.
Move the video refresh call to reinit_video_filters() to make it more
uniform along with the audio code.
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c index 27be10a4de..9634891283 100644 --- a/player/audio.c +++ b/player/audio.c @@ -147,8 +147,23 @@ int reinit_audio_filters(struct MPContext *mpctx) if (!ao_c) return 0; + double delay = 0; + if (ao_c->af->initialized > 0) + delay = af_calc_delay(ao_c->af); + af_uninit(ao_c->af); - return recreate_audio_filters(mpctx) < 0 ? -1 : 1; + if (recreate_audio_filters(mpctx) < 0) + return -1; + + // Only force refresh if the amount of dropped buffered data is going to + // cause "issues" for the A/V sync logic. + if (mpctx->audio_status == STATUS_PLAYING && + mpctx->playback_pts != MP_NOPTS_VALUE && delay > 0.2) + { + queue_seek(mpctx, MPSEEK_ABSOLUTE, mpctx->playback_pts, + MPSEEK_EXACT, true); + } + return 1; } // Call this if opts->playback_speed or mpctx->speed_factor_* change. |