mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
ao_coreaudio: prevent buffer underruns to output garbage
This was removed in d427b4fd
. I now found a sample that causes underruns when
moving to a chapter and apparently this is also a problem when taking
screenshots.
This commit is contained in:
parent
721071a5ec
commit
ca678dce4d
@ -109,7 +109,12 @@ static OSStatus render_cb_lpcm(void *ctx, AudioUnitRenderActionFlags *aflags,
|
||||
AudioBuffer buf = buffer_list->mBuffers[0];
|
||||
int requested = buf.mDataByteSize;
|
||||
|
||||
buf.mDataByteSize = mp_ring_read(p->buffer, buf.mData, requested);
|
||||
if (mp_ring_buffered(p->buffer) < requested) {
|
||||
ca_msg(MSGL_V, "buffer underrun\n");
|
||||
audio_pause(ao);
|
||||
} else {
|
||||
mp_ring_read(p->buffer, buf.mData, requested);
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user