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

Unified Diff: webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc

Issue 1891703002: Potential division by zero in RtpToNtpMs() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/system_wrappers/source/rtp_to_ntp.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, &timestamp_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
« no previous file with comments | « webrtc/system_wrappers/source/rtp_to_ntp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698