summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-12 11:54:08 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-12 11:54:08 +0200
commita66cce61ad0d62c9b4c24a9262b7182f865aca5b (patch)
tree43d2d151d2abae2c2f10d64b8e241b33aa8aa409
parente7d3e63a3f97b17f20780914b90132b3a1f72909 (diff)
downloadmpv-a66cce61ad0d62c9b4c24a9262b7182f865aca5b.tar.bz2
mpv-a66cce61ad0d62c9b4c24a9262b7182f865aca5b.tar.xz
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.
-rw-r--r--mplayer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mplayer.c b/mplayer.c
index f74bb24830..fc3356d085 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -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;
}
}