From b8591a31e52d42c178a321ace237c175b08631b1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 3 Aug 2015 17:02:06 +0200 Subject: audio: fix --end handling (again) Commit c5818046 fixed one case of audio EOF handling, and caused a new one. This time, the ao_buffer doesn't actually contain everyting that should be played - because if --end is used, only a part of it is played. Of course this is stupid, and it will be changed later. For now, this smaller change fixes the bug. Fixes #2189. --- player/audio.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/player/audio.c b/player/audio.c index f5f9bd3e60..5b19e2fc0c 100644 --- a/player/audio.c +++ b/player/audio.c @@ -594,18 +594,15 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) if (audio_eof && !opts->gapless_audio) playflags |= AOPLAY_FINAL_CHUNK; - if (mpctx->paused) - playsize = 0; - struct mp_audio data; mp_audio_buffer_peek(mpctx->ao_buffer, &data); - data.samples = MPMIN(data.samples, playsize); + data.samples = MPMIN(data.samples, mpctx->paused ? 0 : playsize); int played = write_to_ao(mpctx, &data, playflags); assert(played >= 0 && played <= data.samples); mp_audio_buffer_skip(mpctx->ao_buffer, played); mpctx->audio_status = STATUS_PLAYING; - if (audio_eof && !mp_audio_buffer_samples(mpctx->ao_buffer)) { + if (audio_eof && !playsize) { mpctx->audio_status = STATUS_DRAINING; // Wait until the AO has played all queued data. In the gapless case, // we trigger EOF immediately, and let it play asynchronously. -- cgit v1.2.3