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

@ -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;