From c1956e82c2da01aba64251b885a3e8d5ab7179d3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Sep 2019 19:52:10 +0200 Subject: audio: make playback end with --end and --audio-spdif In spdif mode, there are hacks that try to cut audio on frame boundaries (blame spdif, which is a hack in itself). The "alignment" is used in a bunch of places, but --end does not respect it. This leads to some audio that can't be pushed because the alignment is off (I don't know why, not do I care), which puts audio into an underrun state forever. Fix this by discarding unusable extra samples if no new data can be expected. Fixes: #6935 --- player/audio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/player/audio.c b/player/audio.c index 22a87c91eb..308b27aec1 100644 --- a/player/audio.c +++ b/player/audio.c @@ -975,6 +975,9 @@ void fill_audio_out_buffers(struct MPContext *mpctx) audio_eof &= partial_fill; + if (audio_eof && playsize < align) + playsize = 0; + // With gapless audio, delay this to ao_uninit. There must be only // 1 final chunk, and that is handled when calling ao_uninit(). if (audio_eof && !opts->gapless_audio) -- cgit v1.2.3