• Thomas Guillem's avatar
    coreaudio: replace TPCircularBuffer by os_unfair_lock and a block chain · 9bb14eda
    Thomas Guillem authored
    Remove the usage of TPCircularBuffer and multiple atomic variables that start
    to make this code way too complicated. Replace it by os_unfair_lock and a block
    os_unfair_lock is a safe spinlock that waits in the kernel in case of thread
    Fallback to pthread_mutex_t if os_unfair_lock is not availaible (before macOS
    10.12 / iOS 10.0).
    The unfairness of this new lock is not an issue here since both locking threads
    (the render callback and the VLC DecoderThread calling aout_DecPlay) will be
    automatically paced (and will let the other thread take the lock). Indeed, the
    render thread need a sample every 22 or 88ms, and the DecoderThread will wait
    for the decoder, wait in the decoder lock, or wait from the aout if the FIFO is
coreaudio_common.c 28.4 KB