From 6704df9640dde33bf806a91aaa00574e0877d7be Mon Sep 17 00:00:00 2001 From: henrika Date: Thu, 18 Jul 2019 17:50:40 +0200 Subject: [PATCH] Minor threading-model fix for ADM2 on Windows Landing with TBR given vacation times and the fact that none of this code is active "in production". The ADM2 implementation can be seen as experimental (non-default) code and it takes some work to enable it and replace the existing ADM. Hence, extremely low risk to break anything. TBR: henrik.lundin Bug: webrtc:9265 Change-Id: Ibc9a57f4851bf4b890b77b9eaef1dfbe3ca86f83 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146084 Reviewed-by: Henrik Andreassson Commit-Queue: Henrik Andreassson Cr-Commit-Position: refs/heads/master@{#28601} --- modules/audio_device/win/core_audio_input_win.cc | 10 +++++++--- modules/audio_device/win/core_audio_output_win.cc | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/audio_device/win/core_audio_input_win.cc b/modules/audio_device/win/core_audio_input_win.cc index 8405e6d61e..91a1d1646e 100644 --- a/modules/audio_device/win/core_audio_input_win.cc +++ b/modules/audio_device/win/core_audio_input_win.cc @@ -160,7 +160,9 @@ int CoreAudioInput::StartRecording() { } fine_audio_buffer_->ResetRecord(); - audio_device_buffer_->StartRecording(); + if (!IsRestarting()) { + audio_device_buffer_->StartRecording(); + } if (!Start()) { return -1; @@ -190,8 +192,10 @@ int CoreAudioInput::StopRecording() { return -1; } - RTC_DCHECK(audio_device_buffer_); - audio_device_buffer_->StopRecording(); + if (!IsRestarting()) { + RTC_DCHECK(audio_device_buffer_); + audio_device_buffer_->StopRecording(); + } // Release all allocated resources to allow for a restart without // intermediate destruction. diff --git a/modules/audio_device/win/core_audio_output_win.cc b/modules/audio_device/win/core_audio_output_win.cc index 6921805395..f3b01511ee 100644 --- a/modules/audio_device/win/core_audio_output_win.cc +++ b/modules/audio_device/win/core_audio_output_win.cc @@ -156,7 +156,9 @@ int CoreAudioOutput::StartPlayout() { } fine_audio_buffer_->ResetPlayout(); - audio_device_buffer_->StartPlayout(); + if (!IsRestarting()) { + audio_device_buffer_->StartPlayout(); + } if (!core_audio_utility::FillRenderEndpointBufferWithSilence( audio_client_.Get(), audio_render_client_.Get())) { @@ -193,8 +195,10 @@ int CoreAudioOutput::StopPlayout() { return -1; } - RTC_DCHECK(audio_device_buffer_); - audio_device_buffer_->StopPlayout(); + if (!IsRestarting()) { + RTC_DCHECK(audio_device_buffer_); + audio_device_buffer_->StopPlayout(); + } // Release all allocated resources to allow for a restart without // intermediate destruction.