The libretro core is single-threaded by design: the SPU is driven by
TimingEvents from the same thread that runs retro_run_frame(), and
both AudioStream subclasses (LibretroAudioStream, NullAudioStream)
are libretro-only - no separate audio output thread exists. There
is no producer/consumer scenario that requires synchronization on
this FIFO; the mutex was always uncontended.
Even an uncontended std::mutex is not free: each lock/unlock pair
issues an atomic CAS plus the indirect call through libpthread.
With the SPU calling BeginWrite/EndWrite roughly 300 times per
frame (one per scheduled audio slice), that's ~600 atomic ops and
~15 us of pure overhead on every retro_run.
Drop the mutex, the std::unique_lock wrappers in Reconfigure() and
Shutdown(), the surrounding #include <mutex>, and the redundant
lock in NullAudioStream::FramesAvailable(). The header now matches
its actual constraints: a single-threaded FIFO.
If anyone ever reintroduces a threaded audio path, they will need
to add synchronization back. The comment in audio_stream.h
documents that requirement explicitly so the choice is not silently
forgotten.