From 0e2221eb2f02ed950f4fd9c7fea40b382ea0a0c8 Mon Sep 17 00:00:00 2001 From: Tim Na Date: Fri, 13 May 2022 18:18:34 -0700 Subject: [PATCH] Use ADM internal state for init state check. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ADM is terminated and its state requires reinitialized, VoipCore::initialized_ field will falsely skip required reinitializing. Bug: webrtc:14054 Change-Id: Ibeb4987a7e9763b8e40926acc4d7eaabde7a3478 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261924 Reviewed-by: Per Ã…hgren Reviewed-by: Tim Na Commit-Queue: Tim Na Cr-Commit-Position: refs/heads/main@{#36893} --- audio/voip/voip_core.cc | 4 +--- audio/voip/voip_core.h | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/audio/voip/voip_core.cc b/audio/voip/voip_core.cc index 8df1c594aa..30868946fd 100644 --- a/audio/voip/voip_core.cc +++ b/audio/voip/voip_core.cc @@ -61,7 +61,7 @@ bool VoipCore::InitializeIfNeeded() { // introduced in the future. MutexLock lock(&lock_); - if (initialized_) { + if (audio_device_module_->Initialized()) { return true; } @@ -116,8 +116,6 @@ bool VoipCore::InitializeIfNeeded() { RTC_LOG(LS_WARNING) << "Unable to register audio callback."; } - initialized_ = true; - return true; } diff --git a/audio/voip/voip_core.h b/audio/voip/voip_core.h index 6c3aec6fa2..6df7d4edb0 100644 --- a/audio/voip/voip_core.h +++ b/audio/voip/voip_core.h @@ -164,9 +164,6 @@ class VoipCore : public VoipEngine, // ChannelId. std::unordered_map> channels_ RTC_GUARDED_BY(lock_); - - // Boolean flag to ensure initialization only occurs once. - bool initialized_ RTC_GUARDED_BY(lock_) = false; }; } // namespace webrtc