Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: webrtc/rtc_tools/event_log_visualizer/analyzer.cc

Issue 2997883002: Video/Screenshare loopback tool.
Patch Set: Rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 case ParsedRtcEventLog::BWE_PROBE_CLUSTER_CREATED_EVENT: { 503 case ParsedRtcEventLog::BWE_PROBE_CLUSTER_CREATED_EVENT: {
504 bwe_probe_cluster_created_events_.push_back( 504 bwe_probe_cluster_created_events_.push_back(
505 parsed_log_.GetBweProbeClusterCreated(i)); 505 parsed_log_.GetBweProbeClusterCreated(i));
506 break; 506 break;
507 } 507 }
508 case ParsedRtcEventLog::BWE_PROBE_RESULT_EVENT: { 508 case ParsedRtcEventLog::BWE_PROBE_RESULT_EVENT: {
509 bwe_probe_result_events_.push_back(parsed_log_.GetBweProbeResult(i)); 509 bwe_probe_result_events_.push_back(parsed_log_.GetBweProbeResult(i));
510 break; 510 break;
511 } 511 }
512 case ParsedRtcEventLog::BWE_ACKED_BITRATE_EVENT: {
513 acked_bitrate_events_.push_back(parsed_log_.GetAckedBitrate(i));
514 break;
515 }
516 case ParsedRtcEventLog::ALR_STATE_EVENT: {
517 alr_state_events_.push_back(parsed_log_.GetAlrState(i));
518 break;
519 }
520 case ParsedRtcEventLog::PACKET_QUEUE_TIME: {
521 packet_queue_time_events_.push_back(parsed_log_.GetQueueTime(i));
522 break;
523 }
512 case ParsedRtcEventLog::UNKNOWN_EVENT: { 524 case ParsedRtcEventLog::UNKNOWN_EVENT: {
513 break; 525 break;
514 } 526 }
515 } 527 }
516 } 528 }
517 529
518 if (last_timestamp < first_timestamp) { 530 if (last_timestamp < first_timestamp) {
519 // No useful events in the log. 531 // No useful events in the log.
520 first_timestamp = last_timestamp = 0; 532 first_timestamp = last_timestamp = 0;
521 } 533 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1028
1017 TimeSeries result_series("Probing results.", DOT_GRAPH); 1029 TimeSeries result_series("Probing results.", DOT_GRAPH);
1018 for (auto& result : bwe_probe_result_events_) { 1030 for (auto& result : bwe_probe_result_events_) {
1019 if (result.bitrate_bps) { 1031 if (result.bitrate_bps) {
1020 float x = static_cast<float>(result.timestamp - begin_time_) / 1000000; 1032 float x = static_cast<float>(result.timestamp - begin_time_) / 1000000;
1021 float y = static_cast<float>(*result.bitrate_bps) / 1000; 1033 float y = static_cast<float>(*result.bitrate_bps) / 1000;
1022 result_series.points.emplace_back(x, y); 1034 result_series.points.emplace_back(x, y);
1023 } 1035 }
1024 } 1036 }
1025 1037
1038 TimeSeries acked_bitrate("Acked bitrate", LINE_GRAPH);
1039 for (auto& ab : acked_bitrate_events_) {
1040 float x = static_cast<float>(ab.timestamp - begin_time_) / 1000000;
1041 float y = static_cast<float>(ab.bitrate_bps / 1000);
1042 acked_bitrate.points.emplace_back(x, y);
1043 }
1044
1045 TimeSeries alr_usage("Bitrate usage", LINE_GRAPH);
1046 IntervalSeries alr_state("ALR", "#555555", IntervalSeries::kHorizontal);
1047 bool in_alr = false;
1048 int64_t alr_start = 0;
1049 for (auto& alr : alr_state_events_) {
1050 float y = static_cast<float>(alr.timestamp - begin_time_) / 1000000;
1051 alr_usage.points.emplace_back(y, alr.usage_bps / 1000);
1052 if (!in_alr && alr.in_alr) {
1053 alr_start = alr.timestamp;
1054 in_alr = true;
1055 } else if (in_alr && !alr.in_alr) {
1056 float x = static_cast<float>(alr_start - begin_time_) / 1000000;
1057 alr_state.intervals.emplace_back(x, y);
1058 in_alr = false;
1059 }
1060 }
1061
1062 if (in_alr) {
1063 float x = static_cast<float>(alr_start - begin_time_) / 1000000;
1064 float y = static_cast<float>(end_time_ - begin_time_) / 1000000;
1065 alr_state.intervals.emplace_back(x, y);
1066 }
1067
1026 if (show_detector_state) { 1068 if (show_detector_state) {
1027 plot->AppendIntervalSeries(std::move(overusing_series)); 1069 plot->AppendIntervalSeries(std::move(overusing_series));
1028 plot->AppendIntervalSeries(std::move(underusing_series)); 1070 plot->AppendIntervalSeries(std::move(underusing_series));
1029 plot->AppendIntervalSeries(std::move(normal_series)); 1071 plot->AppendIntervalSeries(std::move(normal_series));
1072 plot->AppendIntervalSeries(std::move(alr_state));
1030 } 1073 }
1031 1074
1032 plot->AppendTimeSeries(std::move(bitrate_series)); 1075 plot->AppendTimeSeries(std::move(bitrate_series));
1033 plot->AppendTimeSeries(std::move(loss_series)); 1076 plot->AppendTimeSeries(std::move(loss_series));
1034 plot->AppendTimeSeries(std::move(delay_series)); 1077 plot->AppendTimeSeries(std::move(delay_series));
1035 plot->AppendTimeSeries(std::move(created_series)); 1078 plot->AppendTimeSeries(std::move(created_series));
1036 plot->AppendTimeSeries(std::move(result_series)); 1079 plot->AppendTimeSeries(std::move(result_series));
1080 plot->AppendTimeSeries(std::move(acked_bitrate));
1081 plot->AppendTimeSeries(std::move(alr_usage));
1037 } 1082 }
1038 1083
1039 // Overlay the incoming REMB over the outgoing bitrate 1084 // Overlay the incoming REMB over the outgoing bitrate
1040 // and outgoing REMB over incoming bitrate. 1085 // and outgoing REMB over incoming bitrate.
1041 PacketDirection remb_direction = 1086 PacketDirection remb_direction =
1042 desired_direction == kOutgoingPacket ? kIncomingPacket : kOutgoingPacket; 1087 desired_direction == kOutgoingPacket ? kIncomingPacket : kOutgoingPacket;
1043 TimeSeries remb_series("Remb", LINE_STEP_GRAPH); 1088 TimeSeries remb_series("Remb", LINE_STEP_GRAPH);
1044 std::multimap<uint64_t, const LoggedRtcpPacket*> remb_packets; 1089 std::multimap<uint64_t, const LoggedRtcpPacket*> remb_packets;
1045 for (const auto& kv : rtcp_packets_) { 1090 for (const auto& kv : rtcp_packets_) {
1046 if (kv.first.GetDirection() == remb_direction) { 1091 if (kv.first.GetDirection() == remb_direction) {
(...skipping 17 matching lines...) Expand all
1064 1109
1065 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1110 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1066 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin); 1111 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin);
1067 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { 1112 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
1068 plot->SetTitle("Incoming RTP bitrate"); 1113 plot->SetTitle("Incoming RTP bitrate");
1069 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { 1114 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) {
1070 plot->SetTitle("Outgoing RTP bitrate"); 1115 plot->SetTitle("Outgoing RTP bitrate");
1071 } 1116 }
1072 } 1117 }
1073 1118
1119 void EventLogAnalyzer::CreateQueueDelayGraph(Plot* plot) {
1120 std::map<uint32_t, TimeSeries> series;
1121 float max = 0;
1122 for (auto& qt : packet_queue_time_events_) {
1123 auto it = series.find(qt.ssrc);
1124 if (it == series.end()) {
1125 std::stringstream ss;
1126 ss << "SSRC " << qt.ssrc;
1127 it = series
1128 .insert(std::make_pair(qt.ssrc,
1129 TimeSeries(ss.str(), LINE_DOT_GRAPH)))
1130 .first;
1131 }
1132
1133 float x = static_cast<float>(qt.timestamp - begin_time_) / 1000000;
1134 float y = static_cast<float>(qt.queue_time_ms);
1135 max = y > max ? y : max;
1136 it->second.points.emplace_back(x, y);
1137 }
1138
1139 for (auto& ts : series)
1140 plot->AppendTimeSeries(std::move(ts.second));
1141 plot->SetTitle("Pacer queue time");
1142 plot->SetXAxis(0, call_duration_s_, "Time (s)");
1143 plot->SetYAxis(0, max * 1.1, "Time (ms)");
1144 }
1145
1074 // For each SSRC, plot the bandwidth used by that stream. 1146 // For each SSRC, plot the bandwidth used by that stream.
1075 void EventLogAnalyzer::CreateStreamBitrateGraph( 1147 void EventLogAnalyzer::CreateStreamBitrateGraph(
1076 PacketDirection desired_direction, 1148 PacketDirection desired_direction,
1077 Plot* plot) { 1149 Plot* plot) {
1078 for (auto& kv : rtp_packets_) { 1150 for (auto& kv : rtp_packets_) {
1079 StreamId stream_id = kv.first; 1151 StreamId stream_id = kv.first;
1080 const std::vector<LoggedRtpPacket>& packet_stream = kv.second; 1152 const std::vector<LoggedRtpPacket>& packet_stream = kv.second;
1081 // Filter on direction and SSRC. 1153 // Filter on direction and SSRC.
1082 if (stream_id.GetDirection() != desired_direction || 1154 if (stream_id.GetDirection() != desired_direction ||
1083 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) { 1155 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) {
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 plot->AppendTimeSeries(std::move(series.second)); 1790 plot->AppendTimeSeries(std::move(series.second));
1719 } 1791 }
1720 1792
1721 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1793 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1722 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, 1794 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin,
1723 kTopMargin); 1795 kTopMargin);
1724 plot->SetTitle("NetEq timing"); 1796 plot->SetTitle("NetEq timing");
1725 } 1797 }
1726 } // namespace plotting 1798 } // namespace plotting
1727 } // namespace webrtc 1799 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/rtc_tools/event_log_visualizer/analyzer.h ('k') | webrtc/rtc_tools/event_log_visualizer/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698