From 8058e58d8fb35b4aba8330d19ffb0e0ef4b9d0cf Mon Sep 17 00:00:00 2001 From: terelius Date: Mon, 25 Jul 2016 01:32:41 -0700 Subject: [PATCH] Add loss-based BWE estimate to the outgoing bitrate plot. Review-Url: https://codereview.webrtc.org/2165523002 Cr-Commit-Position: refs/heads/master@{#13517} --- webrtc/tools/event_log_visualizer/analyzer.cc | 20 +++++++++++++++++++ webrtc/tools/event_log_visualizer/analyzer.h | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/webrtc/tools/event_log_visualizer/analyzer.cc b/webrtc/tools/event_log_visualizer/analyzer.cc index ec56999022..e6dd35b6c6 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.cc +++ b/webrtc/tools/event_log_visualizer/analyzer.cc @@ -204,6 +204,12 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log) 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 @@ void EventLogAnalyzer::CreateTotalBitrateGraph( } 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(bwe_update.timestamp - begin_time_) / 1000000; + float y = static_cast(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)"; diff --git a/webrtc/tools/event_log_visualizer/analyzer.h b/webrtc/tools/event_log_visualizer/analyzer.h index 9b69ff1263..0b92c10e10 100644 --- a/webrtc/tools/event_log_visualizer/analyzer.h +++ b/webrtc/tools/event_log_visualizer/analyzer.h @@ -67,6 +67,13 @@ class EventLogAnalyzer { RTPHeader header; }; + struct BwePacketLossEvent { + uint64_t timestamp; + int32_t new_bitrate; + uint8_t fraction_loss; + int32_t expected_packets; + }; + const ParsedRtcEventLog& parsed_log_; // A list of SSRCs we are interested in analysing. @@ -78,6 +85,9 @@ class EventLogAnalyzer { // if the stream has been configured. std::map> rtp_packets_; + // A list of all updates from the send-side loss-based bandwidth estimator. + std::vector bwe_loss_updates_; + // 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