diff options
author | Chris Robinson <[email protected]> | 2019-09-14 17:01:22 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-14 18:35:23 -0700 |
commit | d75de6ee4dc81a6a1cb5d6e77246ac2a3751a0fd (patch) | |
tree | 5b0d8c8e0489c384d3ec486b5bb21a830ae52f2b /alc/backends | |
parent | 2c348cecb68bd3a71d388547d6b3330f9cebbfad (diff) |
Don't hold the pulse lock while not necessary
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/pulseaudio.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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<ALCuint>(dstbuf.size()); - std::lock_guard<std::mutex> _{pulse_lock}; while(!dstbuf.empty()) { if(mCapBuffer.empty()) { if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire)) break; + std::lock_guard<std::mutex> _{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<std::mutex> _{pulse_lock}; pa_stream_drop(mStream); mCapLen = 0; } |