When processing report blocks do not store rtt when it is not calculated

Otherwise bandwidth observer might miss rtt calculated from previous report block

Bug: webrtc:8805
Change-Id: If3c4f4ee2e923d440ff352e8b770442f1a11fa34
Reviewed-on: https://webrtc-review.googlesource.com/44480
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21800}
This commit is contained in:
Danil Chapovalov 2018-01-26 20:01:48 +01:00 committed by Commit Bot
parent 82f96e6a56
commit 04164cc5ac
2 changed files with 29 additions and 2 deletions

View File

@ -502,12 +502,12 @@ void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
report_block_info->last_rtt_ms = rtt_ms;
report_block_info->sum_rtt_ms += rtt_ms;
++report_block_info->num_rtts;
packet_information->rtt_ms = rtt_ms;
}
TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR_RTT",
report_block.source_ssrc(), rtt_ms);
packet_information->rtt_ms = rtt_ms;
packet_information->report_blocks.push_back(report_block_info->report_block);
}

View File

@ -264,6 +264,33 @@ TEST_F(RtcpReceiverTest, InjectSrPacketCalculatesNegativeRTTAsOne) {
EXPECT_EQ(1, rtt_ms);
}
TEST_F(
RtcpReceiverTest,
TwoReportBlocksWithLastOneWithoutLastSrCalculatesRttForBandwidthObserver) {
const int64_t kRttMs = 120;
const uint32_t kDelayNtp = 123000;
const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp);
uint32_t sent_ntp = CompactNtp(system_clock_.CurrentNtpTime());
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
rtcp::SenderReport sr;
sr.SetSenderSsrc(kSenderSsrc);
rtcp::ReportBlock block;
block.SetMediaSsrc(kReceiverMainSsrc);
block.SetLastSr(sent_ntp);
block.SetDelayLastSr(kDelayNtp);
sr.AddReportBlock(block);
block.SetMediaSsrc(kReceiverExtraSsrc);
block.SetLastSr(0);
sr.AddReportBlock(block);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(SizeIs(2)));
EXPECT_CALL(bandwidth_observer_,
OnReceivedRtcpReceiverReport(SizeIs(2), kRttMs, _));
InjectRtcpPacket(sr);
}
TEST_F(RtcpReceiverTest, InjectRrPacket) {
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::ReceiverReport rr;