mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 17:12:36 +00:00
player: write final audo chunk only if there is audio left
Don't call ao_play() if there's nothing left. Of course this still asks the AO to play internally buffered audio by setting drain=true.
This commit is contained in:
parent
e403140201
commit
8438c557cf
@ -169,10 +169,12 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
|
||||
mp_audio_buffer_peek(ao->buffer, &data);
|
||||
int samples = ao->buffer_playable_samples;
|
||||
assert(samples <= data.samples);
|
||||
int played = ao_play(ao, data.planes, samples,
|
||||
AOPLAY_FINAL_CHUNK);
|
||||
if (played < samples)
|
||||
MP_WARN(ao, "Audio output truncated at end.\n");
|
||||
if (samples > 0) {
|
||||
int played = ao_play(ao, data.planes, samples,
|
||||
AOPLAY_FINAL_CHUNK);
|
||||
if (played < samples)
|
||||
MP_WARN(ao, "Audio output truncated at end.\n");
|
||||
}
|
||||
}
|
||||
ao_uninit(ao, drain);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user