if (mStreamCallback.onStream)
THROW_ERROR_MSG(CAudioError::EError::ERROR_INVALID_OPERATION, "async type don't support drain");
- CAudioIO::drain();
+ try {
+ if (mpPulseAudioClient->isInThread()) {
+ mpPulseAudioClient->drain();
+ } else {
+ internalLock();
+ mpPulseAudioClient->drain();
+ internalUnlock();
+ }
+ } catch (const CAudioError& e) {
+ if (!mpPulseAudioClient->isInThread())
+ internalUnlock();
+ throw;
+ }
}
void CAudioOutput::flush() {