diff options
author | wm4 <wm4@nowhere> | 2015-08-03 17:02:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-03 17:02:06 +0200 |
commit | b8591a31e52d42c178a321ace237c175b08631b1 (patch) | |
tree | 5c7a357eef27ca4580f8bde781d311e54c80547a /player/audio.c | |
parent | bbbb2d9723e009378c52c6552810a1b648696cd2 (diff) | |
download | mpv-b8591a31e52d42c178a321ace237c175b08631b1.tar.bz2 mpv-b8591a31e52d42c178a321ace237c175b08631b1.tar.xz |
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.
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 7 |
1 files 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. |