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
This commit is contained in:
wm4 2019-09-26 19:52:10 +02:00
parent f44e480242
commit c1956e82c2
1 changed files with 3 additions and 0 deletions

View File

@ -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)