OLD | NEW |
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 Loading... |
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 template <typename T> |
| 502 void EventLogAnalyzer::CreateAccumulatedPacketsTimeSeries( |
| 503 PacketDirection desired_direction, |
| 504 Plot* plot, |
| 505 const std::map<StreamId, std::vector<T>>& packets, |
| 506 const std::string& label_prefix) { |
| 507 for (auto& kv : packets) { |
| 508 StreamId stream_id = kv.first; |
| 509 const std::vector<T>& packet_stream = kv.second; |
| 510 // Filter on direction and SSRC. |
| 511 if (stream_id.GetDirection() != desired_direction || |
| 512 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) { |
| 513 continue; |
| 514 } |
| 515 |
| 516 TimeSeries time_series; |
| 517 time_series.label = label_prefix + " " + SsrcToString(stream_id.GetSsrc()); |
| 518 time_series.style = LINE_GRAPH; |
| 519 |
| 520 for (size_t i = 0; i < packet_stream.size(); i++) { |
| 521 float x = static_cast<float>(packet_stream[i].timestamp - begin_time_) / |
| 522 1000000; |
| 523 time_series.points.emplace_back(x, i); |
| 524 time_series.points.emplace_back(x, i + 1); |
| 525 } |
| 526 |
| 527 plot->series_list_.push_back(std::move(time_series)); |
| 528 } |
| 529 } |
| 530 |
| 531 void EventLogAnalyzer::CreateAccumulatedPacketsGraph( |
| 532 PacketDirection desired_direction, |
| 533 Plot* plot) { |
| 534 CreateAccumulatedPacketsTimeSeries(desired_direction, plot, rtp_packets_, |
| 535 "RTP"); |
| 536 CreateAccumulatedPacketsTimeSeries(desired_direction, plot, rtcp_packets_, |
| 537 "RTCP"); |
| 538 |
| 539 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 540 plot->SetSuggestedYAxis(0, 1, "Received Packets", kBottomMargin, kTopMargin); |
| 541 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { |
| 542 plot->SetTitle("Accumulated Incoming RTP/RTCP packets"); |
| 543 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { |
| 544 plot->SetTitle("Accumulated Outgoing RTP/RTCP packets"); |
| 545 } |
| 546 } |
| 547 |
501 // For each SSRC, plot the time between the consecutive playouts. | 548 // For each SSRC, plot the time between the consecutive playouts. |
502 void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) { | 549 void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) { |
503 std::map<uint32_t, TimeSeries> time_series; | 550 std::map<uint32_t, TimeSeries> time_series; |
504 std::map<uint32_t, uint64_t> last_playout; | 551 std::map<uint32_t, uint64_t> last_playout; |
505 | 552 |
506 uint32_t ssrc; | 553 uint32_t ssrc; |
507 | 554 |
508 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { | 555 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { |
509 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); | 556 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); |
510 if (event_type == ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT) { | 557 if (event_type == ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT) { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 point.y -= estimated_base_delay_ms; | 989 point.y -= estimated_base_delay_ms; |
943 // Add the data set to the plot. | 990 // Add the data set to the plot. |
944 plot->series_list_.push_back(std::move(time_series)); | 991 plot->series_list_.push_back(std::move(time_series)); |
945 | 992 |
946 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 993 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
947 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); | 994 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); |
948 plot->SetTitle("Network Delay Change."); | 995 plot->SetTitle("Network Delay Change."); |
949 } | 996 } |
950 } // namespace plotting | 997 } // namespace plotting |
951 } // namespace webrtc | 998 } // namespace webrtc |
OLD | NEW |