From ae7228c6a363a54249cc754089e12c2042811216 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 13 Jul 2014 20:07:14 +0200 Subject: audio: drop buffered audio when switching tracks or filters No reason to wait until the audio has been played. This isn't a problem with gapless audio disabled, and since gapless is now default, this behavior might be perceived as regression. CC: @mpv-player/stable --- player/command.c | 1 + player/loadfile.c | 1 + 2 files changed, 2 insertions(+) diff --git a/player/command.c b/player/command.c index 159367a028..5451c13a16 100644 --- a/player/command.c +++ b/player/command.c @@ -3055,6 +3055,7 @@ static bool reinit_filters(MPContext *mpctx, enum stream_type mediatype) case STREAM_VIDEO: return reinit_video_filters(mpctx) >= 0; case STREAM_AUDIO: + clear_audio_output_buffers(mpctx); return reinit_audio_filters(mpctx) >= 0; } return false; diff --git a/player/loadfile.c b/player/loadfile.c index ce25070a79..08adcb615e 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -532,6 +532,7 @@ void mp_switch_track_n(struct MPContext *mpctx, int order, enum stream_type type uninit |= mpctx->opts->fixed_vo && track ? 0 : INITIALIZED_VO; uninit_player(mpctx, uninit); } else if (type == STREAM_AUDIO) { + clear_audio_output_buffers(mpctx); uninit_player(mpctx, INITIALIZED_AO | INITIALIZED_ACODEC); } else if (type == STREAM_SUB) { uninit_player(mpctx, INITIALIZED_SUB); -- cgit v1.2.3