diff --git a/system_wrappers/include/rtp_to_ntp_estimator.h b/system_wrappers/include/rtp_to_ntp_estimator.h index 3b62b78608..a5c7a157b6 100644 --- a/system_wrappers/include/rtp_to_ntp_estimator.h +++ b/system_wrappers/include/rtp_to_ntp_estimator.h @@ -16,8 +16,8 @@ #include #include "absl/types/optional.h" -#include "modules/include/module_common_types_public.h" #include "rtc_base/checks.h" +#include "rtc_base/numerics/sequence_number_unwrapper.h" #include "system_wrappers/include/ntp_time.h" namespace webrtc { @@ -65,7 +65,7 @@ class RtpToNtpEstimator { int consecutive_invalid_samples_ = 0; std::list measurements_; absl::optional params_; - mutable TimestampUnwrapper unwrapper_; + mutable RtpTimestampUnwrapper unwrapper_; }; } // namespace webrtc diff --git a/system_wrappers/source/rtp_to_ntp_estimator_unittest.cc b/system_wrappers/source/rtp_to_ntp_estimator_unittest.cc index 29de76178b..81effd9452 100644 --- a/system_wrappers/source/rtp_to_ntp_estimator_unittest.cc +++ b/system_wrappers/source/rtp_to_ntp_estimator_unittest.cc @@ -48,6 +48,17 @@ TEST(WrapAroundTests, OldRtcpWrapped_OldRtpTimestamp_Wraparound_Detected) { RtpToNtpEstimator::kInvalidMeasurement); } +TEST(WrapAroundTests, OldRtcpWrapped_OldRtpTimestamp_NegativeWraparound) { + RtpToNtpEstimator estimator; + EXPECT_EQ(estimator.UpdateMeasurements(NtpTime(1), 0), + RtpToNtpEstimator::kNewMeasurement); + // Expected to fail since the older RTCP has a smaller RTP timestamp than the + // newer (old:0, new:-180). + EXPECT_EQ(estimator.UpdateMeasurements(NtpTime(1 + 2 * kOneMsInNtp), + 0xFFFFFFFF - 2 * kTimestampTicksPerMs), + RtpToNtpEstimator::kInvalidMeasurement); +} + TEST(WrapAroundTests, NewRtcpWrapped) { RtpToNtpEstimator estimator; EXPECT_EQ(estimator.UpdateMeasurements(NtpTime(1), 0xFFFFFFFF),