Set chart id in WebRTC event log bindings.
Bug: None
Change-Id: Ibf3a8fdfa85c4c7d7b9e73393057827b544ab3e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325063
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41011}
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc
index 3725e33..82959132 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc
@@ -76,43 +76,53 @@
// Outgoing
if (absl::StrContains(selection_view, "outgoing_packet_sizes")) {
- analyzer.CreatePacketGraph(PacketDirection::kOutgoingPacket,
- collection.AppendNewPlot());
+ analyzer.CreatePacketGraph(
+ PacketDirection::kOutgoingPacket,
+ collection.AppendNewPlot("outgoing_packet_sizes"));
}
if (absl::StrContains(selection_view, "outgoing_stream_bitrate")) {
- analyzer.CreateStreamBitrateGraph(PacketDirection::kOutgoingPacket,
- collection.AppendNewPlot());
+ analyzer.CreateStreamBitrateGraph(
+ PacketDirection::kOutgoingPacket,
+ collection.AppendNewPlot("outgoing_stream_bitrate"));
}
if (absl::StrContains(selection_view, "outgoing_bitrate")) {
- analyzer.CreateTotalOutgoingBitrateGraph(collection.AppendNewPlot(),
- /*show_detector_state*/ true,
- /*show_alr_state*/ false,
- /*show_link_capacity*/ true);
+ analyzer.CreateTotalOutgoingBitrateGraph(
+ collection.AppendNewPlot("outgoing_bitrate"),
+ /*show_detector_state*/ true,
+ /*show_alr_state*/ false,
+ /*show_link_capacity*/ true);
}
if (absl::StrContains(selection_view, "network_delay_feedback")) {
- analyzer.CreateNetworkDelayFeedbackGraph(collection.AppendNewPlot());
+ analyzer.CreateNetworkDelayFeedbackGraph(
+ collection.AppendNewPlot("network_delay_feedback"));
}
if (absl::StrContains(selection_view, "fraction_loss_feedback")) {
- analyzer.CreateFractionLossGraph(collection.AppendNewPlot());
+ analyzer.CreateFractionLossGraph(
+ collection.AppendNewPlot("fraction_loss_feedback"));
}
// Incoming
if (absl::StrContains(selection_view, "incoming_packet_sizes")) {
- analyzer.CreatePacketGraph(PacketDirection::kIncomingPacket,
- collection.AppendNewPlot());
+ analyzer.CreatePacketGraph(
+ PacketDirection::kIncomingPacket,
+ collection.AppendNewPlot("incoming_packet_sizes"));
}
if (absl::StrContains(selection_view, "incoming_stream_bitrate")) {
- analyzer.CreateStreamBitrateGraph(PacketDirection::kIncomingPacket,
- collection.AppendNewPlot());
+ analyzer.CreateStreamBitrateGraph(
+ PacketDirection::kIncomingPacket,
+ collection.AppendNewPlot("incoming_stream_bitrate"));
}
if (absl::StrContains(selection_view, "incoming_bitrate")) {
- analyzer.CreateTotalIncomingBitrateGraph(collection.AppendNewPlot());
+ analyzer.CreateTotalIncomingBitrateGraph(
+ collection.AppendNewPlot("incoming_bitrate"));
}
if (absl::StrContains(selection_view, "incoming_delay")) {
- analyzer.CreateIncomingDelayGraph(collection.AppendNewPlot());
+ analyzer.CreateIncomingDelayGraph(
+ collection.AppendNewPlot("incoming_delay"));
}
if (absl::StrContains(selection_view, "incoming_loss_rate")) {
- analyzer.CreateIncomingPacketLossGraph(collection.AppendNewPlot());
+ analyzer.CreateIncomingPacketLossGraph(
+ collection.AppendNewPlot("incoming_loss_rate"));
}
webrtc::analytics::ChartCollection proto_charts;
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc
index 2b0c6de..feb8104 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc
@@ -65,4 +65,10 @@
::testing::UnorderedElementsAre(
"Outgoing RTP bitrate",
"Outgoing network delay (based on per-packet feedback)"));
+ std::vector<std::string> chart_ids;
+ for (const auto& chart : collection.charts()) {
+ chart_ids.push_back(chart.id());
+ }
+ EXPECT_THAT(chart_ids, ::testing::UnorderedElementsAre(
+ "outgoing_bitrate", "network_delay_feedback"));
}
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc
index 3e4f3e4..e9a747c 100644
--- a/rtc_tools/rtc_event_log_visualizer/main.cc
+++ b/rtc_tools/rtc_event_log_visualizer/main.cc
@@ -613,9 +613,8 @@
for (const auto& plot : plots) {
if (plot.enabled) {
- Plot* output = collection.AppendNewPlot();
+ Plot* output = collection.AppendNewPlot(plot.label);
plot.plot_func(output);
- output->SetId(plot.label);
}
}
diff --git a/rtc_tools/rtc_event_log_visualizer/plot_base.cc b/rtc_tools/rtc_event_log_visualizer/plot_base.cc
index 294500c..779fe5d 100644
--- a/rtc_tools/rtc_event_log_visualizer/plot_base.cc
+++ b/rtc_tools/rtc_event_log_visualizer/plot_base.cc
@@ -80,6 +80,10 @@
id_ = id;
}
+void Plot::SetId(absl::string_view id) {
+ id_ = id;
+}
+
void Plot::AppendTimeSeries(TimeSeries&& time_series) {
series_list_.emplace_back(std::move(time_series));
}
@@ -338,4 +342,10 @@
return plots_.back().get();
}
+Plot* PlotCollection::AppendNewPlot(absl::string_view chart_id) {
+ plots_.push_back(std::make_unique<Plot>());
+ plots_.back()->SetId(chart_id);
+ return plots_.back().get();
+}
+
} // namespace webrtc
diff --git a/rtc_tools/rtc_event_log_visualizer/plot_base.h b/rtc_tools/rtc_event_log_visualizer/plot_base.h
index bc753e3..7882ba8 100644
--- a/rtc_tools/rtc_event_log_visualizer/plot_base.h
+++ b/rtc_tools/rtc_event_log_visualizer/plot_base.h
@@ -156,6 +156,7 @@
// the title might change in future releases whereas the ID should be stable
// over time.
void SetId(const std::string& id);
+ void SetId(absl::string_view id);
// Add a new TimeSeries to the plot.
void AppendTimeSeries(TimeSeries&& time_series);
@@ -197,6 +198,8 @@
virtual Plot* AppendNewPlot();
+ virtual Plot* AppendNewPlot(absl::string_view);
+
void SetCallTimeToUtcOffsetMs(int64_t calltime_to_utc_ms) {
calltime_to_utc_ms_ = calltime_to_utc_ms;
}