diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc index 59f64efb78..ddd65cb6c5 100644 --- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc +++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc @@ -882,9 +882,11 @@ void EventLogAnalyzer::CreateTotalIncomingBitrateGraph(Plot* plot) { } // Plot the total bandwidth used by all RTP streams. -void EventLogAnalyzer::CreateTotalOutgoingBitrateGraph(Plot* plot, - bool show_detector_state, - bool show_alr_state) { +void EventLogAnalyzer::CreateTotalOutgoingBitrateGraph( + Plot* plot, + bool show_detector_state, + bool show_alr_state, + bool show_link_capacity) { // TODO(terelius): This could be provided by the parser. std::multimap packets_in_order; for (const auto& stream : parsed_log_.outgoing_rtp_packets_by_ssrc()) { @@ -930,6 +932,24 @@ void EventLogAnalyzer::CreateTotalOutgoingBitrateGraph(Plot* plot, loss_series.points.emplace_back(x, y); } + TimeSeries link_capacity_lower_series("Link-capacity-lower", + LineStyle::kStep); + TimeSeries link_capacity_upper_series("Link-capacity-upper", + LineStyle::kStep); + for (auto& remote_estimate_event : parsed_log_.remote_estimate_events()) { + float x = config_.GetCallTimeSec(remote_estimate_event.log_time()); + if (remote_estimate_event.link_capacity_lower.has_value()) { + float link_capacity_lower = static_cast( + remote_estimate_event.link_capacity_lower.value().kbps()); + link_capacity_lower_series.points.emplace_back(x, link_capacity_lower); + } + if (remote_estimate_event.link_capacity_upper.has_value()) { + float link_capacity_upper = static_cast( + remote_estimate_event.link_capacity_upper.value().kbps()); + link_capacity_upper_series.points.emplace_back(x, link_capacity_upper); + } + } + TimeSeries delay_series("Delay-based estimate", LineStyle::kStep); IntervalSeries overusing_series("Overusing", "#ff8e82", IntervalSeries::kHorizontal); @@ -1026,6 +1046,12 @@ void EventLogAnalyzer::CreateTotalOutgoingBitrateGraph(Plot* plot, if (show_alr_state) { plot->AppendIntervalSeries(std::move(alr_state)); } + + if (show_link_capacity) { + plot->AppendTimeSeriesIfNotEmpty(std::move(link_capacity_lower_series)); + plot->AppendTimeSeriesIfNotEmpty(std::move(link_capacity_upper_series)); + } + plot->AppendTimeSeries(std::move(loss_series)); plot->AppendTimeSeriesIfNotEmpty(std::move(probe_failures_series)); plot->AppendTimeSeries(std::move(delay_series)); diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.h b/rtc_tools/rtc_event_log_visualizer/analyzer.h index 4918cf48e1..1f31d8be1d 100644 --- a/rtc_tools/rtc_event_log_visualizer/analyzer.h +++ b/rtc_tools/rtc_event_log_visualizer/analyzer.h @@ -59,7 +59,8 @@ class EventLogAnalyzer { void CreateTotalIncomingBitrateGraph(Plot* plot); void CreateTotalOutgoingBitrateGraph(Plot* plot, bool show_detector_state = false, - bool show_alr_state = false); + bool show_alr_state = false, + bool show_link_capacity = false); void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot); void CreateBitrateAllocationGraph(PacketDirection direction, Plot* plot); diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc index 0870f8f145..9f0c632efc 100644 --- a/rtc_tools/rtc_event_log_visualizer/main.cc +++ b/rtc_tools/rtc_event_log_visualizer/main.cc @@ -69,6 +69,12 @@ ABSL_FLAG(bool, false, "Show the state ALR state on the total bitrate graph"); +ABSL_FLAG(bool, + show_link_capacity, + true, + "Show the lower and upper link capacity on the outgoing bitrate " + "graph"); + ABSL_FLAG(bool, parse_unconfigured_header_extensions, true, @@ -337,7 +343,8 @@ int main(int argc, char* argv[]) { plots.RegisterPlot("outgoing_bitrate", [&](Plot* plot) { analyzer.CreateTotalOutgoingBitrateGraph( plot, absl::GetFlag(FLAGS_show_detector_state), - absl::GetFlag(FLAGS_show_alr_state)); + absl::GetFlag(FLAGS_show_alr_state), + absl::GetFlag(FLAGS_show_link_capacity)); }); plots.RegisterPlot("incoming_stream_bitrate", [&](Plot* plot) { analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket, plot);