Add loss-based BWE estimate to the outgoing bitrate plot.

Review-Url: https://codereview.webrtc.org/2165523002
Cr-Commit-Position: refs/heads/master@{#13517}
diff --git a/webrtc/tools/event_log_visualizer/analyzer.cc b/webrtc/tools/event_log_visualizer/analyzer.cc
index ec56999..e6dd35b 100644
--- a/webrtc/tools/event_log_visualizer/analyzer.cc
+++ b/webrtc/tools/event_log_visualizer/analyzer.cc
@@ -204,6 +204,12 @@
         break;
       }
       case ParsedRtcEventLog::BWE_PACKET_LOSS_EVENT: {
+        BwePacketLossEvent bwe_update;
+        bwe_update.timestamp = parsed_log_.GetTimestamp(i);
+        parsed_log_.GetBwePacketLossEvent(i, &bwe_update.new_bitrate,
+                                             &bwe_update.fraction_loss,
+                                             &bwe_update.expected_packets);
+        bwe_loss_updates_.push_back(bwe_update);
         break;
       }
       case ParsedRtcEventLog::BWE_PACKET_DELAY_EVENT: {
@@ -557,6 +563,20 @@
   }
   plot->series.back().style = LINE_GRAPH;
 
+  // Overlay the send-side bandwidth estimate over the outgoing bitrate.
+  if (desired_direction == kOutgoingPacket) {
+    plot->series.push_back(TimeSeries());
+    for (auto& bwe_update : bwe_loss_updates_) {
+      float x =
+          static_cast<float>(bwe_update.timestamp - begin_time_) / 1000000;
+      float y = static_cast<float>(bwe_update.new_bitrate) / 1000;
+      max_y = std::max(max_y, y);
+      plot->series.back().points.emplace_back(x, y);
+    }
+    plot->series.back().label = "Loss-based estimate";
+    plot->series.back().style = LINE_GRAPH;
+  }
+
   plot->xaxis_min = kDefaultXMin;
   plot->xaxis_max = (end_time_ - begin_time_) / 1000000 * kXMargin;
   plot->xaxis_label = "Time (s)";