Use ADM internal state for init state check.

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 <peah@webrtc.org>
Reviewed-by: Tim Na <natim@google.com>
Commit-Queue: Tim Na <natim@google.com>
Cr-Commit-Position: refs/heads/main@{#36893}
This commit is contained in:
Tim Na 2022-05-13 18:18:34 -07:00 committed by WebRTC LUCI CQ
parent c92ee5f3c3
commit 0e2221eb2f
2 changed files with 1 additions and 6 deletions

View File

@ -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;
}

View File

@ -164,9 +164,6 @@ class VoipCore : public VoipEngine,
// ChannelId.
std::unordered_map<ChannelId, rtc::scoped_refptr<AudioChannel>> channels_
RTC_GUARDED_BY(lock_);
// Boolean flag to ensure initialization only occurs once.
bool initialized_ RTC_GUARDED_BY(lock_) = false;
};
} // namespace webrtc