[vlc-devel] [PATCH] coreaudio: fix invalid delay after a unpause

Thomas Guillem thomas at gllm.fr
Fri May 22 20:36:54 CEST 2020


The render host time was not updated while paused.

This caused the first time_get(), after a unpause, to return a delay way too
early (corresponding to the pause time). This could happen only when the ca
render callback was not triggered between an unpause and a time_get.

This invalid delay caused the insertion of a long silence, that was not
interruptible, hence the impression of a deadlock.

Fixes #24668

RFC: I was not able to reproduce the issue, I made this assumption thanks to
Marvin logs and stacktrace.

Please, confirm me if it fixes the #24668 issue.
---
 modules/audio_output/coreaudio_common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 5f8a633bee4..70811aaea78 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -139,7 +139,13 @@ ca_Render(audio_output_t *p_aout, uint32_t i_frames, uint64_t i_host_time,
         vlc_sem_post(&p_sys->flush_sem);
     }
 
-    if (p_sys->b_paused || unlikely(p_sys->i_first_render_host_time == 0))
+    if (p_sys->b_paused)
+    {
+        p_sys->i_render_host_time = i_host_time;
+        goto drop;
+    }
+
+    if (unlikely(p_sys->i_first_render_host_time == 0))
         goto drop;
 
     /* Start deferred: write silence (zeros) until we reach the first render
-- 
2.20.1



More information about the vlc-devel mailing list