Browse Source

Verify stopping during asynchronous microphone cleanup

master
evgeny 3 days ago
parent
commit
014a110fd5
  1. 10
      tools/chatgui/tests/test_audio_recovery.cpp

10
tools/chatgui/tests/test_audio_recovery.cpp

@ -85,7 +85,9 @@ extern "C" ma_result __wrap_ma_device_init(ma_context* context, const ma_device_
config->deviceType, requested.periodSizeInFrames, requested.sampleRate);
}
ma_result result = __real_ma_device_init(context, &requested, device);
if (result == MA_SUCCESS) { std::lock_guard guard(deviceMutex); ++live[context]; devices.push_back(device); }
{ std::lock_guard guard(deviceMutex);
if (result == MA_SUCCESS) { ++live[context]; devices.push_back(device); }
else captureCallbacks.erase(device); }
return result;
}
extern "C" ma_result __wrap_ma_device_start(ma_device* device) {
@ -293,6 +295,12 @@ static void microphone_watchdog(SoundManager* manager) {
REQUIRE(call->isActive() && radio->isActive() && !radio->captureAvailable() && !radio->isTalking());
REQUIRE(beats - previousBeats >= 80); // uninit 700мс выполняется вне GUI.
radio->talkBegin(); radio->setHotkeyTalking(true); REQUIRE(!radio->isTalking());
if (fault == 3) {
QElapsedTimer elapsed; elapsed.start(); call->stop(); radio->stop();
REQUIRE(elapsed.elapsed() < 300); // Stop не ждёт уже закрывающийся неисправный backend.
AudioCaptureLease exclusive(AudioCaptureLease::Mode::Exclusive);
REQUIRE(!exclusive.acquire()); REQUIRE(call->start(44) == -1);
}
pump(800); REQUIRE(captureCloses == closed + 2);
slowCaptureClose = false; microphoneFault = 0; pump(1200);
REQUIRE(captureStarts == before); // Самопроизвольный возврат PCM не перезапускает отключённый вход.

Loading…
Cancel
Save