From bc8627ed7c2a186619ddd7134bc70f0dc20d3d9c Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Thu, 15 Dec 2022 15:17:33 +0100 Subject: [PATCH] coreaudio: change drop/paused handling Don't set *is_silence to true in case of underrun, if some data was written. --- modules/audio_output/coreaudio_common.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c index 36fdd2ca78fc..f7c4c647f85e 100644 --- a/modules/audio_output/coreaudio_common.c +++ b/modules/audio_output/coreaudio_common.c @@ -165,9 +165,14 @@ ca_Render(audio_output_t *p_aout, uint64_t host_time, lock_lock(p_sys); - if (p_sys->b_paused) - goto drop; + { + if (is_silence != NULL) + *is_silence = true; + memset(data, 0, bytes); + lock_unlock(p_sys); + return; + } if (!p_sys->started) { @@ -206,7 +211,11 @@ ca_Render(audio_output_t *p_aout, uint64_t host_time, { vlc_frame_t *f = p_sys->p_out_chain; if (f == NULL) - goto drop; + { + memset(data, 0, bytes); + lock_unlock(p_sys); + return; + } size_t tocopy = f->i_buffer > bytes ? bytes : f->i_buffer; @@ -244,14 +253,6 @@ ca_Render(audio_output_t *p_aout, uint64_t host_time, } lock_unlock(p_sys); - - return; - -drop: - memset(data, 0, bytes); - if (is_silence != NULL) - *is_silence = true; - lock_unlock(p_sys); } void