[vlc-devel] [PATCH] coreaudio: fix deadlock on interruption

Thomas Guillem thomas at gllm.fr
Tue Dec 12 16:18:15 CET 2017


I already merged it because the code was good for me. I could have wait
a little longer, but this issue was blocking a vlc-ios release.

On Tue, Dec 12, 2017, at 15:38, RĂ©mi Denis-Courmont wrote:
> Hi,
> Pause means to retain buffers but hold playback. Flush means to discard
> buffers buy keep playing. So checking pause within Flush is almost
> certainly wrong; these things should be orthogonal.

I tried to fix what you said with this patch

 - b_paused is now only set from the vlc aout thread and read by the
 audio render callback
 - b_alive is only set by the interruption callback and read by vlc aout

The behavior will be almost identical. For me this is just a question of
personal taste but I agree this can make the code more understandable
(even if it adds more code).

> Also mixing atomic ops and muteces smells very bad, TBH.

I said to Caro to do it like that. I agree it smells bad and seems
I invite you to take a closer at ca_Flush (in the drain == false case)
and ca_SetAliveState(). For me, it's thread safe.

This part of code is uber complicated, maybe by my fault, but Apple
specify that the audio render callback should be wait-less. That's why
we don't use the classical and easy to use mutex/cond duo.

> -- 
> Remi Denis-Courmont
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

More information about the vlc-devel mailing list