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

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

Issue 2295063006: Plot accumelated packets over time. (Closed)
Patch Set: Created 4 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 491 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
492 plot->SetSuggestedYAxis(0, 1, "Packet size (bytes)", kBottomMargin, 492 plot->SetSuggestedYAxis(0, 1, "Packet size (bytes)", kBottomMargin,
493 kTopMargin); 493 kTopMargin);
494 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { 494 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
495 plot->SetTitle("Incoming RTP packets"); 495 plot->SetTitle("Incoming RTP packets");
496 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { 496 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) {
497 plot->SetTitle("Outgoing RTP packets"); 497 plot->SetTitle("Outgoing RTP packets");
498 } 498 }
499 } 499 }
500 500
501 void EventLogAnalyzer::CreateAccumelatedPacketsGraph(
502 PacketDirection desired_direction,
503 Plot* plot) {
504 // RTP packet
stefan-webrtc 2016/09/02 12:12:17 RTP packets.
philipel 2016/09/02 13:15:25 Done.
505 for (auto& kv : rtp_packets_) {
506 StreamId stream_id = kv.first;
507 const std::vector<LoggedRtpPacket>& packet_stream = kv.second;
508 // Filter on direction and SSRC.
509 if (stream_id.GetDirection() != desired_direction ||
510 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) {
511 continue;
512 }
513
514 TimeSeries time_series;
515 time_series.label = "RTP: " + SsrcToString(stream_id.GetSsrc());
516 time_series.style = LINE_GRAPH;
517
518 for (size_t i = 0; i < packet_stream.size(); i++) {
519 float x = static_cast<float>(packet_stream[i].timestamp - begin_time_) /
520 1000000;
521 time_series.points.emplace_back(x, i);
522 time_series.points.emplace_back(x, i + 1);
523 }
524
525 plot->series_list_.push_back(std::move(time_series));
526 }
stefan-webrtc 2016/09/02 12:12:17 Can you break this out into a separate function an
philipel 2016/09/02 13:15:25 Done.
527
528 // RTCP packet
stefan-webrtc 2016/09/02 12:12:16 RTCP packets.
philipel 2016/09/02 13:15:25 Done.
529 for (auto& kv : rtcp_packets_) {
530 StreamId stream_id = kv.first;
531 const std::vector<LoggedRtcpPacket>& packet_stream = kv.second;
532 // Filter on direction and SSRC.
533 if (stream_id.GetDirection() != desired_direction ||
534 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) {
535 continue;
536 }
537
538 TimeSeries time_series;
539 time_series.label = "RTCP: " + SsrcToString(stream_id.GetSsrc());
540 time_series.style = LINE_GRAPH;
541
542 for (size_t i = 0; i < packet_stream.size(); i++) {
543 float x = static_cast<float>(packet_stream[i].timestamp - begin_time_) /
544 1000000;
545 time_series.points.emplace_back(x, i);
546 time_series.points.emplace_back(x, i + 1);
547 }
548
549 plot->series_list_.push_back(std::move(time_series));
550 }
551
552 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
553 plot->SetSuggestedYAxis(0, 1, "Received Packets", kBottomMargin, kTopMargin);
554 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
555 plot->SetTitle("Accumelated Incoming RTP/RTCP packets");
stefan-webrtc 2016/09/02 12:12:16 "Accumulated" here and below.
philipel 2016/09/02 13:15:25 Done.
556 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) {
557 plot->SetTitle("Accumelated Outgoing RTP/RTCP packets");
558 }
559 }
560
501 // For each SSRC, plot the time between the consecutive playouts. 561 // For each SSRC, plot the time between the consecutive playouts.
502 void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) { 562 void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) {
503 std::map<uint32_t, TimeSeries> time_series; 563 std::map<uint32_t, TimeSeries> time_series;
504 std::map<uint32_t, uint64_t> last_playout; 564 std::map<uint32_t, uint64_t> last_playout;
505 565
506 uint32_t ssrc; 566 uint32_t ssrc;
507 567
508 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { 568 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) {
509 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); 569 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i);
510 if (event_type == ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT) { 570 if (event_type == ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT) {
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 point.y -= estimated_base_delay_ms; 1002 point.y -= estimated_base_delay_ms;
943 // Add the data set to the plot. 1003 // Add the data set to the plot.
944 plot->series_list_.push_back(std::move(time_series)); 1004 plot->series_list_.push_back(std::move(time_series));
945 1005
946 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1006 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
947 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); 1007 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin);
948 plot->SetTitle("Network Delay Change."); 1008 plot->SetTitle("Network Delay Change.");
949 } 1009 }
950 } // namespace plotting 1010 } // namespace plotting
951 } // namespace webrtc 1011 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698