Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc |
index 6a26d1cfad526ce18f9b195c997d2fb44c3038f1..76b51df0ef3b63cf76ece586e0ee1acc4969f20f 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc |
@@ -389,6 +389,30 @@ TEST(RtcpPacketTest, TransportFeedback_Limits) { |
1, kMaxNegativeTimeDelta - TransportFeedback::kDeltaScaleFactor)); |
EXPECT_TRUE(packet->WithReceivedPacket(1, kMaxNegativeTimeDelta)); |
+ // Base time at maximum value. |
+ int64_t kMaxBaseTime = |
+ static_cast<int64_t>(TransportFeedback::kDeltaScaleFactor) * (1L << 8) * |
+ ((1L << 23) - 1); |
+ packet.reset(new TransportFeedback()); |
+ packet->WithBase(0, kMaxBaseTime); |
+ packet->WithReceivedPacket(0, kMaxBaseTime); |
+ // Serialize and de-serialize (verify 24bit parsing). |
+ rtc::scoped_ptr<rtcp::RawPacket> raw_packet = packet->Build(); |
+ packet = |
+ TransportFeedback::ParseFrom(raw_packet->Buffer(), raw_packet->Length()); |
+ EXPECT_EQ(kMaxBaseTime, packet->GetBaseTimeUs()); |
+ |
+ // Base time above maximum value. |
+ int64_t kTooLargeBaseTime = |
+ kMaxBaseTime + (TransportFeedback::kDeltaScaleFactor * (1L << 8)); |
+ packet.reset(new TransportFeedback()); |
+ packet->WithBase(0, kTooLargeBaseTime); |
+ packet->WithReceivedPacket(0, kTooLargeBaseTime); |
+ raw_packet = packet->Build(); |
+ packet = |
+ TransportFeedback::ParseFrom(raw_packet->Buffer(), raw_packet->Length()); |
+ EXPECT_NE(kTooLargeBaseTime, packet->GetBaseTimeUs()); |
+ |
// TODO(sprang): Once we support max length lower than RTCP length limit, |
// add back test for max size in bytes. |
} |