[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}
This commit is contained in:
parent
dd35e244ce
commit
a3a3b6d798
@ -815,9 +815,11 @@ ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
|
|||||||
remote_inbound->packets_lost = report_block.packets_lost;
|
remote_inbound->packets_lost = report_block.packets_lost;
|
||||||
remote_inbound->fraction_lost =
|
remote_inbound->fraction_lost =
|
||||||
static_cast<double>(report_block.fraction_lost) / (1 << 8);
|
static_cast<double>(report_block.fraction_lost) / (1 << 8);
|
||||||
|
if (report_block_data.num_rtts() > 0) {
|
||||||
remote_inbound->round_trip_time =
|
remote_inbound->round_trip_time =
|
||||||
static_cast<double>(report_block_data.last_rtt_ms()) /
|
static_cast<double>(report_block_data.last_rtt_ms()) /
|
||||||
rtc::kNumMillisecsPerSec;
|
rtc::kNumMillisecsPerSec;
|
||||||
|
}
|
||||||
remote_inbound->total_round_trip_time =
|
remote_inbound->total_round_trip_time =
|
||||||
static_cast<double>(report_block_data.sum_rtt_ms()) /
|
static_cast<double>(report_block_data.sum_rtt_ms()) /
|
||||||
rtc::kNumMillisecsPerSec;
|
rtc::kNumMillisecsPerSec;
|
||||||
|
|||||||
@ -3557,6 +3557,32 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(RTCStatsCollectorTestWithParamKind,
|
||||||
|
RTCRemoteInboundRtpStreamStatsRttMissingBeforeMeasurement) {
|
||||||
|
constexpr int64_t kReportBlockTimestampUtcUs = 123456789;
|
||||||
|
|
||||||
|
RTCPReportBlock report_block;
|
||||||
|
// The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the
|
||||||
|
// `source_ssrc`, "SSRC of the RTP packet sender".
|
||||||
|
report_block.source_ssrc = 12;
|
||||||
|
ReportBlockData report_block_data; // AddRoundTripTimeSample() not called.
|
||||||
|
report_block_data.SetReportBlock(report_block, kReportBlockTimestampUtcUs);
|
||||||
|
|
||||||
|
AddSenderInfoAndMediaChannel("TransportName", {report_block_data},
|
||||||
|
absl::nullopt);
|
||||||
|
|
||||||
|
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
|
||||||
|
|
||||||
|
std::string remote_inbound_rtp_id = "RI" + MediaTypeCharStr() + "12";
|
||||||
|
ASSERT_TRUE(report->Get(remote_inbound_rtp_id));
|
||||||
|
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
|
||||||
|
->cast_to<RTCRemoteInboundRtpStreamStats>();
|
||||||
|
|
||||||
|
EXPECT_TRUE(remote_inbound_rtp.round_trip_time_measurements.is_defined());
|
||||||
|
EXPECT_EQ(0, *remote_inbound_rtp.round_trip_time_measurements);
|
||||||
|
EXPECT_FALSE(remote_inbound_rtp.round_trip_time.is_defined());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_P(RTCStatsCollectorTestWithParamKind,
|
TEST_P(RTCStatsCollectorTestWithParamKind,
|
||||||
RTCRemoteInboundRtpStreamStatsWithTimestampFromReportBlock) {
|
RTCRemoteInboundRtpStreamStatsWithTimestampFromReportBlock) {
|
||||||
const int64_t kReportBlockTimestampUtcUs = 123456789;
|
const int64_t kReportBlockTimestampUtcUs = 123456789;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user