diff --git a/audio/audio_state.cc b/audio/audio_state.cc index 0e60f0372b..dcdc97b085 100644 --- a/audio/audio_state.cc +++ b/audio/audio_state.cc @@ -104,6 +104,14 @@ void AudioState::AddSendingStream(webrtc::AudioSendStream* stream, if (!adm->Recording()) { if (adm->InitRecording() == 0) { if (recording_enabled_) { +#if defined(WEBRTC_WIN) + if (adm->BuiltInAECIsAvailable() && !adm->Playing()) { + if (!adm->PlayoutIsInitialized()) { + adm->InitPlayout(); + } + adm->StartPlayout(); + } +#endif adm->StartRecording(); } } else { diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc index a3723edb56..47bc566039 100644 --- a/modules/audio_device/win/audio_device_core_win.cc +++ b/modules/audio_device/win/audio_device_core_win.cc @@ -2356,7 +2356,7 @@ int32_t AudioDeviceWindowsCore::StartRecording() { } } - RTC_DCHECK(_hRecThread); + RTC_DCHECK(_hRecThread == NULL); _hRecThread = CreateThread(NULL, 0, lpStartAddress, this, 0, NULL); if (_hRecThread == NULL) { RTC_LOG(LS_ERROR) << "failed to create the recording thread"; @@ -2493,7 +2493,7 @@ int32_t AudioDeviceWindowsCore::StartPlayout() { MutexLock lockScoped(&mutex_); // Create thread which will drive the rendering. - RTC_DCHECK(_hPlayThread); + RTC_DCHECK(_hPlayThread == NULL); _hPlayThread = CreateThread(NULL, 0, WSAPIRenderThread, this, 0, NULL); if (_hPlayThread == NULL) { RTC_LOG(LS_ERROR) << "failed to create the playout thread";