From d75de6ee4dc81a6a1cb5d6e77246ac2a3751a0fd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 14 Sep 2019 17:01:22 -0700 Subject: Don't hold the pulse lock while not necessary --- alc/backends/pulseaudio.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'alc/backends/pulseaudio.cpp') diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 30c13a69..9c54c07b 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -1325,13 +1325,13 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) /* Capture is done in fragment-sized chunks, so we loop until we get all * that's available */ mLastReadable -= static_cast(dstbuf.size()); - std::lock_guard _{pulse_lock}; while(!dstbuf.empty()) { if(mCapBuffer.empty()) { if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire)) break; + std::lock_guard _{pulse_lock}; const pa_stream_state_t state{pa_stream_get_state(mStream)}; if UNLIKELY(!PA_STREAM_IS_GOOD(state)) { @@ -1364,6 +1364,7 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) if(mCapBuffer.empty()) { + std::lock_guard _{pulse_lock}; pa_stream_drop(mStream); mCapLen = 0; } -- cgit v1.2.3