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}
diff --git a/audio/voip/voip_core.cc b/audio/voip/voip_core.cc
index 8df1c59..3086894 100644
--- a/audio/voip/voip_core.cc
+++ b/audio/voip/voip_core.cc
@@ -61,7 +61,7 @@
   // introduced in the future.
   MutexLock lock(&lock_);
 
-  if (initialized_) {
+  if (audio_device_module_->Initialized()) {
     return true;
   }
 
@@ -116,8 +116,6 @@
     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 6c3aec6..6df7d4e 100644
--- a/audio/voip/voip_core.h
+++ b/audio/voip/voip_core.h
@@ -164,9 +164,6 @@
   // 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