mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user