diff options
-rw-r--r-- | player/audio.c | 7 | ||||
-rw-r--r-- | player/core.h | 2 | ||||
-rw-r--r-- | player/loadfile.c | 13 |
3 files changed, 1 insertions, 21 deletions
diff --git a/player/audio.c b/player/audio.c index c6e7411e2a..c5c3e1e9d7 100644 --- a/player/audio.c +++ b/player/audio.c @@ -352,13 +352,11 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize) res = audio_decode(d_audio, mpctx->ao_buffer, a); if (skip_samples <= mp_audio_buffer_samples(mpctx->ao_buffer)) { mp_audio_buffer_skip(mpctx->ao_buffer, skip_samples); - mpctx->ao_buffer_playable_samples = 0; if (res < 0) return res; return audio_decode(d_audio, mpctx->ao_buffer, playsize); } mp_audio_buffer_clear(mpctx->ao_buffer); - mpctx->ao_buffer_playable_samples = 0; if (res < 0) return res; } @@ -458,15 +456,11 @@ int fill_audio_out_buffers(struct MPContext *mpctx, double endpts) } } - assert(mpctx->ao_buffer_playable_samples <= - mp_audio_buffer_samples(mpctx->ao_buffer)); - struct mp_audio data; mp_audio_buffer_peek(mpctx->ao_buffer, &data); data.samples = MPMIN(data.samples, playsize); int played = write_to_ao(mpctx, &data, playflags, written_audio_pts(mpctx)); assert(played >= 0 && played <= data.samples); - mpctx->ao_buffer_playable_samples = playsize - played; if (played > 0) { mp_audio_buffer_skip(mpctx->ao_buffer, played); @@ -485,7 +479,6 @@ void clear_audio_output_buffers(struct MPContext *mpctx) if (mpctx->ao) { ao_reset(mpctx->ao); mp_audio_buffer_clear(mpctx->ao_buffer); - mpctx->ao_buffer_playable_samples = 0; } } diff --git a/player/core.h b/player/core.h index 5e60568c97..5927091233 100644 --- a/player/core.h +++ b/player/core.h @@ -225,8 +225,6 @@ typedef struct MPContext { struct ao *ao; double ao_pts; struct mp_audio_buffer *ao_buffer; // queued audio; passed to ao_play() later - int ao_buffer_playable_samples; // part of the part of the buffer the AO - // hasn't accepted yet with play() struct vo *video_out; diff --git a/player/loadfile.c b/player/loadfile.c index 89f893cc25..05f4646d0a 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -174,19 +174,8 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask) mpctx->initialized_flags &= ~INITIALIZED_AO; if (ao) { // Note: with gapless_audio, stop_play is not correctly set - if (opts->gapless_audio || mpctx->stop_play == AT_END_OF_FILE) { - struct mp_audio data; - mp_audio_buffer_peek(mpctx->ao_buffer, &data); - int samples = mpctx->ao_buffer_playable_samples; - assert(samples <= data.samples); - if (samples > 0) { - int played = ao_play(ao, data.planes, samples, - AOPLAY_FINAL_CHUNK); - if (played < samples) - MP_WARN(mpctx, "Audio output truncated at end.\n"); - } + if (opts->gapless_audio || mpctx->stop_play == AT_END_OF_FILE) ao_drain(ao); - } ao_uninit(ao); } mpctx->ao = NULL; |