Index: webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
diff --git a/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc b/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
index d2929f5cbc00763470821ee7282b5965d3a82c8c..78e4a52716dbd0c37fe6c76dbd228e5427982636 100644 |
--- a/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
+++ b/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
@@ -135,4 +135,44 @@ TEST(WrapAroundTests, OldRtp_OldRtcpWrapped) { |
int64_t timestamp_in_ms = -1; |
EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_in_ms)); |
} |
+ |
+TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { |
+ RtcpList rtcp; |
+ uint32_t ntp_sec = 0; |
+ uint32_t ntp_frac = 2; |
+ uint32_t timestamp = 0x12345678; |
+ |
+ bool new_sr; |
+ EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
+ EXPECT_TRUE(new_sr); |
+ |
+ ++timestamp; |
+ EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
+ EXPECT_FALSE(new_sr); |
+} |
+ |
+TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualTimestamp) { |
+ RtcpList rtcp; |
+ uint32_t ntp_sec = 0; |
+ uint32_t ntp_frac = 2; |
+ uint32_t timestamp = 0x12345678; |
+ |
+ bool new_sr; |
+ EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
+ EXPECT_TRUE(new_sr); |
+ |
+ ++ntp_frac; |
+ EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
+ EXPECT_FALSE(new_sr); |
+} |
+ |
+TEST(UpdateRtcpListTests, InjectRtcpSrWithZeroNtpFails) { |
+ RtcpList rtcp; |
+ uint32_t ntp_sec = 0; |
+ uint32_t ntp_frac = 0; |
+ uint32_t timestamp = 0x12345678; |
+ |
+ bool new_sr; |
+ EXPECT_FALSE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
+} |
}; // namespace webrtc |