Add packet rate plots to event_log_visualizer.

Bug: b/152399961
Change-Id: I8dbc0166ed537c197f26a80275100fb3faa338f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172094
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Kristoffer Erlandsson <kerl@google.com>
Cr-Commit-Position: refs/heads/master@{#30942}
This commit is contained in:
Kristoffer Erlandsson
2020-03-30 13:01:37 +02:00
committed by Commit Bot
parent c24b6b7815
commit 283c106c28
3 changed files with 45 additions and 0 deletions

View File

@ -617,6 +617,43 @@ void EventLogAnalyzer::CreateAccumulatedPacketsGraph(PacketDirection direction,
" RTP/RTCP packets");
}
void EventLogAnalyzer::CreatePacketRateGraph(PacketDirection direction,
Plot* plot) {
auto CountPackets = [](auto packet) { return 1.0; };
for (const auto& stream : parsed_log_.rtp_packets_by_ssrc(direction)) {
// Filter on SSRC.
if (!MatchingSsrc(stream.ssrc, desired_ssrc_)) {
continue;
}
TimeSeries time_series(
std::string("RTP ") + GetStreamName(direction, stream.ssrc),
LineStyle::kLine);
MovingAverage<LoggedRtpPacket, double>(CountPackets, stream.packet_view,
config_, &time_series);
plot->AppendTimeSeries(std::move(time_series));
}
TimeSeries time_series(
std::string("RTCP ") + "(" + GetDirectionAsShortString(direction) + ")",
LineStyle::kLine);
if (direction == kIncomingPacket) {
MovingAverage<LoggedRtcpPacketIncoming, double>(
CountPackets, parsed_log_.incoming_rtcp_packets(), config_,
&time_series);
} else {
MovingAverage<LoggedRtcpPacketOutgoing, double>(
CountPackets, parsed_log_.outgoing_rtcp_packets(), config_,
&time_series);
}
plot->AppendTimeSeries(std::move(time_series));
plot->SetXAxis(config_.CallBeginTimeSec(), config_.CallEndTimeSec(),
"Time (s)", kLeftMargin, kRightMargin);
plot->SetSuggestedYAxis(0, 1, "Packet Rate (packets/s)", kBottomMargin,
kTopMargin);
plot->SetTitle("Rate of " + GetDirectionAsString(direction) +
" RTP/RTCP packets");
}
// For each SSRC, plot the time between the consecutive playouts.
void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) {
for (const auto& playout_stream : parsed_log_.audio_playout_events()) {

View File

@ -63,6 +63,8 @@ class EventLogAnalyzer {
void CreateAccumulatedPacketsGraph(PacketDirection direction, Plot* plot);
void CreatePacketRateGraph(PacketDirection direction, Plot* plot);
void CreatePlayoutGraph(Plot* plot);
void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);

View File

@ -291,6 +291,12 @@ int main(int argc, char* argv[]) {
plots.RegisterPlot("outgoing_packet_count", [&](Plot* plot) {
analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("incoming_packet_rate", [&](Plot* plot) {
analyzer.CreatePacketRateGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_packet_rate", [&](Plot* plot) {
analyzer.CreatePacketRateGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("audio_playout",
[&](Plot* plot) { analyzer.CreatePlayoutGraph(plot); });
plots.RegisterPlot("incoming_audio_level", [&](Plot* plot) {