[Stats] If remote-inbound-rtp has no RTT, leave it undefined.
Bug: webrtc:14692
Change-Id: I49878449cd91b590f1aedef7676c3715d563ac61
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284660
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38706}
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index e4a5418..f0070df 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -815,9 +815,11 @@
remote_inbound->packets_lost = report_block.packets_lost;
remote_inbound->fraction_lost =
static_cast<double>(report_block.fraction_lost) / (1 << 8);
- remote_inbound->round_trip_time =
- static_cast<double>(report_block_data.last_rtt_ms()) /
- rtc::kNumMillisecsPerSec;
+ if (report_block_data.num_rtts() > 0) {
+ remote_inbound->round_trip_time =
+ static_cast<double>(report_block_data.last_rtt_ms()) /
+ rtc::kNumMillisecsPerSec;
+ }
remote_inbound->total_round_trip_time =
static_cast<double>(report_block_data.sum_rtt_ms()) /
rtc::kNumMillisecsPerSec;