Add new event type to RtcEventLog
Alr state is now logged by the pacer. To avoid confusion,
loopback tools will now create two separate rtc event
logs for sender and receiver calls.
Bug: webrtc:8287, webrtc:8588
Change-Id: Ib3e47d109c3a65a7ed069b9a613e6a08fe6a2f30
Reviewed-on: https://webrtc-review.googlesource.com/26880
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21084}
diff --git a/rtc_tools/event_log_visualizer/analyzer.cc b/rtc_tools/event_log_visualizer/analyzer.cc
index 792e6bb..3c6a074 100644
--- a/rtc_tools/event_log_visualizer/analyzer.cc
+++ b/rtc_tools/event_log_visualizer/analyzer.cc
@@ -522,6 +522,10 @@
bwe_probe_result_events_.push_back(parsed_log_.GetBweProbeResult(i));
break;
}
+ case ParsedRtcEventLog::ALR_STATE_EVENT: {
+ alr_state_events_.push_back(parsed_log_.GetAlrState(i));
+ break;
+ }
case ParsedRtcEventLog::UNKNOWN_EVENT: {
break;
}
@@ -968,7 +972,8 @@
void EventLogAnalyzer::CreateTotalBitrateGraph(
PacketDirection desired_direction,
Plot* plot,
- bool show_detector_state) {
+ bool show_detector_state,
+ bool show_alr_state) {
struct TimestampSize {
TimestampSize(uint64_t t, size_t s) : timestamp(t), size(s) {}
uint64_t timestamp;
@@ -1089,12 +1094,36 @@
}
}
+ IntervalSeries alr_state("ALR", "#555555", IntervalSeries::kHorizontal);
+ bool previously_in_alr = false;
+ int64_t alr_start = 0;
+ for (auto& alr : alr_state_events_) {
+ float y = ToCallTime(alr.timestamp);
+ if (!previously_in_alr && alr.in_alr) {
+ alr_start = alr.timestamp;
+ previously_in_alr = true;
+ } else if (previously_in_alr && !alr.in_alr) {
+ float x = ToCallTime(alr_start);
+ alr_state.intervals.emplace_back(x, y);
+ previously_in_alr = false;
+ }
+ }
+
+ if (previously_in_alr) {
+ float x = ToCallTime(alr_start);
+ float y = ToCallTime(end_time_);
+ alr_state.intervals.emplace_back(x, y);
+ }
+
if (show_detector_state) {
plot->AppendIntervalSeries(std::move(overusing_series));
plot->AppendIntervalSeries(std::move(underusing_series));
plot->AppendIntervalSeries(std::move(normal_series));
}
+ if (show_alr_state) {
+ plot->AppendIntervalSeries(std::move(alr_state));
+ }
plot->AppendTimeSeries(std::move(loss_series));
plot->AppendTimeSeries(std::move(delay_series));
plot->AppendTimeSeries(std::move(created_series));
diff --git a/rtc_tools/event_log_visualizer/analyzer.h b/rtc_tools/event_log_visualizer/analyzer.h
index 30f9e48..5d0faab 100644
--- a/rtc_tools/event_log_visualizer/analyzer.h
+++ b/rtc_tools/event_log_visualizer/analyzer.h
@@ -87,7 +87,8 @@
void CreateTotalBitrateGraph(PacketDirection desired_direction,
Plot* plot,
- bool show_detector_state = false);
+ bool show_detector_state = false,
+ bool show_alr_state = false);
void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot);
@@ -201,6 +202,8 @@
std::vector<std::unique_ptr<TriageNotification>> notifications_;
+ std::vector<ParsedRtcEventLog::AlrStateEvent> alr_state_events_;
+
// Window and step size used for calculating moving averages, e.g. bitrate.
// The generated data points will be |step_| microseconds apart.
// Only events occuring at most |window_duration_| microseconds before the
diff --git a/rtc_tools/event_log_visualizer/main.cc b/rtc_tools/event_log_visualizer/main.cc
index 3bc79be..b38f1a4 100644
--- a/rtc_tools/event_log_visualizer/main.cc
+++ b/rtc_tools/event_log_visualizer/main.cc
@@ -132,6 +132,10 @@
"Show the state of the delay based BWE detector on the total "
"bitrate graph");
+DEFINE_bool(show_alr_state,
+ false,
+ "Show the state ALR state on the total bitrate graph");
+
DEFINE_bool(
print_triage_notifications,
false,
@@ -245,12 +249,14 @@
if (FLAG_plot_incoming_bitrate) {
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot(),
- FLAG_show_detector_state);
+ FLAG_show_detector_state,
+ FLAG_show_alr_state);
}
if (FLAG_plot_outgoing_bitrate) {
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot(),
- FLAG_show_detector_state);
+ FLAG_show_detector_state,
+ FLAG_show_alr_state);
}
if (FLAG_plot_incoming_stream_bitrate) {
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
diff --git a/rtc_tools/event_log_visualizer/plot_python.cc b/rtc_tools/event_log_visualizer/plot_python.cc
index 58fad10..8f406e2 100644
--- a/rtc_tools/event_log_visualizer/plot_python.cc
+++ b/rtc_tools/event_log_visualizer/plot_python.cc
@@ -103,8 +103,8 @@
}
// IntervalSeries
- printf("interval_colors = ['#ff8e82','#5092fc','#c4ffc4']\n");
- RTC_CHECK_LE(interval_list_.size(), 3);
+ printf("interval_colors = ['#ff8e82','#5092fc','#c4ffc4','#aaaaaa']\n");
+ RTC_CHECK_LE(interval_list_.size(), 4);
// To get the intervals to show up in the legend we have to create patches
// for them.
printf("legend_patches = []\n");