Move NetEq and ANA plotting to a separate file.

Bug: webrtc:11566
Change-Id: I6d6176ff72a158a1629e14b539de2e928e7d02a9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176510
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@google.com>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31472}
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc
index 42ee7e1..2aa1653 100644
--- a/rtc_tools/rtc_event_log_visualizer/main.cc
+++ b/rtc_tools/rtc_event_log_visualizer/main.cc
@@ -31,6 +31,7 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_tools/rtc_event_log_visualizer/alerts.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyze_audio.h"
 #include "rtc_tools/rtc_event_log_visualizer/analyzer.h"
 #include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
 #include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h"
@@ -436,22 +437,22 @@
   plots.RegisterPlot("pacer_delay",
                      [&](Plot* plot) { analyzer.CreatePacerDelayGraph(plot); });
   plots.RegisterPlot("audio_encoder_bitrate", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderTargetBitrateGraph(plot);
+    CreateAudioEncoderTargetBitrateGraph(parsed_log, config, plot);
   });
   plots.RegisterPlot("audio_encoder_frame_length", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderFrameLengthGraph(plot);
+    CreateAudioEncoderFrameLengthGraph(parsed_log, config, plot);
   });
   plots.RegisterPlot("audio_encoder_packet_loss", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderPacketLossGraph(plot);
+    CreateAudioEncoderPacketLossGraph(parsed_log, config, plot);
   });
   plots.RegisterPlot("audio_encoder_fec", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderEnableFecGraph(plot);
+    CreateAudioEncoderEnableFecGraph(parsed_log, config, plot);
   });
   plots.RegisterPlot("audio_encoder_dtx", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderEnableDtxGraph(plot);
+    CreateAudioEncoderEnableDtxGraph(parsed_log, config, plot);
   });
   plots.RegisterPlot("audio_encoder_num_channels", [&](Plot* plot) {
-    analyzer.CreateAudioEncoderNumChannelsGraph(plot);
+    CreateAudioEncoderNumChannelsGraph(parsed_log, config, plot);
   });
 
   plots.RegisterPlot("ice_candidate_pair_config", [&](Plot* plot) {
@@ -474,14 +475,14 @@
     wav_path = webrtc::test::ResourcePath(
         "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
   }
-  absl::optional<webrtc::EventLogAnalyzer::NetEqStatsGetterMap> neteq_stats;
+  absl::optional<webrtc::NetEqStatsGetterMap> neteq_stats;
 
   plots.RegisterPlot("simulated_neteq_expand_rate", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.expand_rate / 16384.f;
         },
@@ -490,10 +491,10 @@
 
   plots.RegisterPlot("simulated_neteq_speech_expand_rate", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.speech_expand_rate / 16384.f;
         },
@@ -502,10 +503,10 @@
 
   plots.RegisterPlot("simulated_neteq_accelerate_rate", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.accelerate_rate / 16384.f;
         },
@@ -514,10 +515,10 @@
 
   plots.RegisterPlot("simulated_neteq_preemptive_rate", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.preemptive_rate / 16384.f;
         },
@@ -526,10 +527,10 @@
 
   plots.RegisterPlot("simulated_neteq_packet_loss_rate", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.packet_loss_rate / 16384.f;
         },
@@ -538,10 +539,10 @@
 
   plots.RegisterPlot("simulated_neteq_concealment_events", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqLifetimeStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqLifetimeStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqLifetimeStatistics& stats) {
           return static_cast<float>(stats.concealment_events);
         },
@@ -550,10 +551,10 @@
 
   plots.RegisterPlot("simulated_neteq_preferred_buffer_size", [&](Plot* plot) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    analyzer.CreateNetEqNetworkStatsGraph(
-        *neteq_stats,
+    webrtc::CreateNetEqNetworkStatsGraph(
+        parsed_log, config, *neteq_stats,
         [](const webrtc::NetEqNetworkStatistics& stats) {
           return stats.preferred_buffer_size_ms;
         },
@@ -614,13 +615,13 @@
   if (absl::c_find(plot_flags, "simulated_neteq_jitter_buffer_delay") !=
       plot_flags.end()) {
     if (!neteq_stats) {
-      neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
+      neteq_stats = webrtc::SimulateNetEq(parsed_log, config, wav_path, 48000);
     }
-    for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it =
-             neteq_stats->cbegin();
+    for (webrtc::NetEqStatsGetterMap::const_iterator it = neteq_stats->cbegin();
          it != neteq_stats->cend(); ++it) {
-      analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(),
-                                            collection->AppendNewPlot());
+      webrtc::CreateAudioJitterBufferGraph(parsed_log, config, it->first,
+                                           it->second.get(),
+                                           collection->AppendNewPlot());
     }
   }