mirror of https://github.com/mpv-player/mpv
audio: don't try to send partial samples to AO at EOF
At least with PCM it's possible to get an audio stream that doesn't end at a multiple of whole sample per channel. At least ao_alsa refuses to accept that part of input, and so EOF detection in fill_audio_out_buffers didn't trigger until the 0.04 second sanity check (as there "was still audio not sent to AO left"). Change the logic to detect EOF if there's less than one sample per channel of unsent data left.
This commit is contained in:
parent
e7d3e63a3f
commit
a66cce61ad
|
@ -2170,7 +2170,8 @@ static int fill_audio_out_buffers(struct MPContext *mpctx)
|
|||
format_change = true;
|
||||
else if (mpctx->d_audio->eof) {
|
||||
audio_eof = 1;
|
||||
if (sh_audio->a_out_buffer_len == 0)
|
||||
int unitsize = ao_data.channels * af_fmt2bits(ao_data.format) / 8;
|
||||
if (sh_audio->a_out_buffer_len < unitsize)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue