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 78e4a52716dbd0c37fe6c76dbd228e5427982636..0cfd6896f72f9f29402c79eace322aa895789270 100644 |
--- a/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
+++ b/webrtc/system_wrappers/source/rtp_to_ntp_unittest.cc |
@@ -136,6 +136,20 @@ TEST(WrapAroundTests, OldRtp_OldRtcpWrapped) { |
EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_in_ms)); |
} |
+TEST(RtpToNtpTests, FailsForDecreasingRtpTimestamp) { |
+ const uint32_t kNtpSec1 = 3683354930; |
+ const uint32_t kNtpFrac1 = 699925050; |
+ const uint32_t kTimestamp1 = 2192705742; |
+ const uint32_t kNtpSec2 = kNtpSec1; |
+ const uint32_t kNtpFrac2 = kNtpFrac1 + kOneMsInNtpFrac; |
+ const uint32_t kTimestamp2 = kTimestamp1 - kTimestampTicksPerMs; |
+ RtcpList rtcp; |
+ rtcp.push_front(RtcpMeasurement(kNtpSec1, kNtpFrac1, kTimestamp1)); |
+ rtcp.push_front(RtcpMeasurement(kNtpSec2, kNtpFrac2, kTimestamp2)); |
+ int64_t timestamp_in_ms = -1; |
+ EXPECT_FALSE(RtpToNtpMs(kTimestamp1, rtcp, ×tamp_in_ms)); |
+} |
+ |
TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { |
RtcpList rtcp; |
uint32_t ntp_sec = 0; |