Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc

Issue 1294393002: Fixed base time in TransportFeedback message writing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Constant overflow Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
}
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698