Locating input audio level before TaskQueue.

- TaskQueue needs to be destroyed at last to avoid thread race condition.

Bug: webrtc:12111
Change-Id: Ibfc96e2ebd71a2aa8d1ac8c83038d256bac0e600
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193780
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32624}
diff --git a/audio/voip/audio_egress.h b/audio/voip/audio_egress.h
index d9ae4f3..fcd9ed0 100644
--- a/audio/voip/audio_egress.h
+++ b/audio/voip/audio_egress.h
@@ -130,6 +130,9 @@
   // Synchronization is handled internally by AudioCodingModule.
   const std::unique_ptr<AudioCodingModule> audio_coding_;
 
+  // Synchronization is handled internally by voe::AudioLevel.
+  voe::AudioLevel input_audio_level_;
+
   // Struct that holds all variables used by encoder task queue.
   struct EncoderContext {
     // Offset used to mark rtp timestamp in sample rate unit in
@@ -148,9 +151,6 @@
   // Defined last to ensure that there are no running tasks when the other
   // members are destroyed.
   rtc::TaskQueue encoder_queue_;
-
-  // Synchronizaton is handled internally by voe::AudioLevel.
-  voe::AudioLevel input_audio_level_;
 };
 
 }  // namespace webrtc