Revert "Use ADM internal state for init state check."

This reverts commit 0e2221eb2f02ed950f4fd9c7fea40b382ea0a0c8.

Reason for revert: Speculative revert, breaks downstream.

Original change's description:
> 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}

Bug: webrtc:14054
Change-Id: I1fa0a1ff440b9619aba60ec25970ce88a67739db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262660
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36896}
This commit is contained in:
Mirko Bonadei
2022-05-16 13:40:26 +00:00
committed by WebRTC LUCI CQ
parent 6928f4ccc6
commit dab50c6fe8
2 changed files with 6 additions and 1 deletions

View File

@ -61,7 +61,7 @@ bool VoipCore::InitializeIfNeeded() {
// introduced in the future.
MutexLock lock(&lock_);
if (audio_device_module_->Initialized()) {
if (initialized_) {
return true;
}
@ -116,6 +116,8 @@ bool VoipCore::InitializeIfNeeded() {
RTC_LOG(LS_WARNING) << "Unable to register audio callback.";
}
initialized_ = true;
return true;
}

View File

@ -164,6 +164,9 @@ 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