From c69c1bbda8e570c9d3a52b277f91097534d37a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Terelius?= Date: Fri, 11 Oct 2019 15:06:58 +0200 Subject: [PATCH] Plot delay feedback in RTCP arrival order. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a minor bug in the event_log_visualizer where packets are processed in RTP send time order rather than RTCP arrival time order. The bug makes time appear to move backwards if RTCP feedback for a later RTP packet arrives before the feedback of an earlier RTP packet. Bug: None Change-Id: I06e8a25d5c65602bedcfd9e4ea1d23874bee9318 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156169 Commit-Queue: Björn Terelius Reviewed-by: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#29448} --- rtc_tools/BUILD.gn | 1 + rtc_tools/rtc_event_log_visualizer/analyzer.cc | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn index c99ed9b780..8d09587c65 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -305,6 +305,7 @@ if (!build_with_chromium) { "../rtc_base:rtc_base_approved", "../rtc_base:rtc_numerics", "../rtc_base:stringutils", + "//third_party/abseil-cpp/absl/algorithm:container", "//third_party/abseil-cpp/absl/strings", ] } diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc index 126d9caaf1..0b5f795944 100644 --- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc +++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/algorithm/container.h" #include "absl/strings/string_view.h" #include "api/function_view.h" #include "api/transport/field_trial_based_config.h" @@ -1455,7 +1456,13 @@ void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { int64_t min_rtt_ms = std::numeric_limits::max(); int64_t prev_y = 0; - for (auto packet : GetNetworkTrace(parsed_log_)) { + std::vector matched_rtp_rtcp = + GetNetworkTrace(parsed_log_); + absl::c_stable_sort(matched_rtp_rtcp, [](const MatchedSendArrivalTimes& a, + const MatchedSendArrivalTimes& b) { + return a.feedback_arrival_time_ms < b.feedback_arrival_time_ms; + }); + for (const auto& packet : matched_rtp_rtcp) { if (packet.arrival_time_ms == PacketFeedback::kNotReceived) continue; float x = config_.GetCallTimeSec(1000 * packet.feedback_arrival_time_ms);