Don't hold the pulse lock while not necessary
This commit is contained in:
parent
2c348cecb6
commit
d75de6ee4d
@ -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
|
/* Capture is done in fragment-sized chunks, so we loop until we get all
|
||||||
* that's available */
|
* that's available */
|
||||||
mLastReadable -= static_cast<ALCuint>(dstbuf.size());
|
mLastReadable -= static_cast<ALCuint>(dstbuf.size());
|
||||||
std::lock_guard<std::mutex> _{pulse_lock};
|
|
||||||
while(!dstbuf.empty())
|
while(!dstbuf.empty())
|
||||||
{
|
{
|
||||||
if(mCapBuffer.empty())
|
if(mCapBuffer.empty())
|
||||||
{
|
{
|
||||||
if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire))
|
if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire))
|
||||||
break;
|
break;
|
||||||
|
std::lock_guard<std::mutex> _{pulse_lock};
|
||||||
const pa_stream_state_t state{pa_stream_get_state(mStream)};
|
const pa_stream_state_t state{pa_stream_get_state(mStream)};
|
||||||
if UNLIKELY(!PA_STREAM_IS_GOOD(state))
|
if UNLIKELY(!PA_STREAM_IS_GOOD(state))
|
||||||
{
|
{
|
||||||
@ -1364,6 +1364,7 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples)
|
|||||||
|
|
||||||
if(mCapBuffer.empty())
|
if(mCapBuffer.empty())
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> _{pulse_lock};
|
||||||
pa_stream_drop(mStream);
|
pa_stream_drop(mStream);
|
||||||
mCapLen = 0;
|
mCapLen = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user