Add method to extract triage alerts from RTC event log analyzer.

Bug: webrtc:11566
Change-Id: I8315895be4fe93513247c49452c50ec23e9d1e11
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186560
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32292}
diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.cc b/rtc_tools/rtc_event_log_visualizer/alerts.cc
index 86372de..2d1868f 100644
--- a/rtc_tools/rtc_event_log_visualizer/alerts.cc
+++ b/rtc_tools/rtc_event_log_visualizer/alerts.cc
@@ -26,15 +26,6 @@
 
 namespace webrtc {
 
-void TriageHelper::Print(FILE* file) {
-  fprintf(file, "========== TRIAGE NOTIFICATIONS ==========\n");
-  for (const auto& alert : triage_alerts_) {
-    fprintf(file, "%d %s. First occurrence at %3.3lf\n", alert.second.count,
-            alert.second.explanation.c_str(), alert.second.first_occurrence);
-  }
-  fprintf(file, "========== END TRIAGE NOTIFICATIONS ==========\n");
-}
-
 void TriageHelper::AnalyzeStreamGaps(const ParsedRtcEventLog& parsed_log,
                                      PacketDirection direction) {
   // With 100 packets/s (~800kbps), false positives would require 10 s without
@@ -224,4 +215,21 @@
   }
 }
 
+void TriageHelper::Print(FILE* file) {
+  fprintf(file, "========== TRIAGE NOTIFICATIONS ==========\n");
+  for (const auto& alert : triage_alerts_) {
+    fprintf(file, "%d %s. First occurrence at %3.3lf\n", alert.second.count,
+            alert.second.explanation.c_str(), alert.second.first_occurrence);
+  }
+  fprintf(file, "========== END TRIAGE NOTIFICATIONS ==========\n");
+}
+
+void TriageHelper::ProcessAlerts(
+    std::function<void(int, float, std::string)> f) {
+  for (const auto& alert : triage_alerts_) {
+    f(alert.second.count, alert.second.first_occurrence,
+      alert.second.explanation);
+  }
+}
+
 }  // namespace webrtc
diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.h b/rtc_tools/rtc_event_log_visualizer/alerts.h
index 7bd9f05..d3e4166 100644
--- a/rtc_tools/rtc_event_log_visualizer/alerts.h
+++ b/rtc_tools/rtc_event_log_visualizer/alerts.h
@@ -57,6 +57,8 @@
                                PacketDirection direction);
   void Print(FILE* file);
 
+  void ProcessAlerts(std::function<void(int, float, std::string)> f);
+
  private:
   AnalyzerConfig config_;
   std::map<TriageAlertType, TriageAlert> triage_alerts_;