USB: remove lingering `if` and lock pulseaudio's recording ringbuffer earlier just in case

This commit is contained in:
jackun 2021-02-10 13:09:39 +02:00
parent 9cfe1b88fc
commit 3f9ea1d01b
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3
1 changed files with 2 additions and 2 deletions

View File

@ -743,10 +743,11 @@ namespace usb_mic
if (padev->mPaused /*|| dur > 5000*/ || (!padata && nbytes /* hole */))
{
ret = pa_stream_drop(p);
if (ret != PA_OK)
return;
}
std::lock_guard<std::mutex> lock(padev->mMutex);
padev->mInBuffer.write((uint8_t*)padata, nbytes);
//if copy succeeded, drop samples at pulse's side
@ -781,7 +782,6 @@ namespace usb_mic
break; //TODO happens?
padev->mInBuffer.read<float>(samples);
}
std::lock_guard<std::mutex> lock(padev->mMutex);
size_t output_samples = output_frames_gen * padev->GetChannels();
float* pSrc = rebuf.data();