| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 rtcp.push_front(RtcpMeasurement(ntp_sec, ntp_frac, timestamp)); | 129 rtcp.push_front(RtcpMeasurement(ntp_sec, ntp_frac, timestamp)); |
| 130 ntp_frac += kOneMsInNtpFrac; | 130 ntp_frac += kOneMsInNtpFrac; |
| 131 timestamp -= kTimestampTicksPerMs; | 131 timestamp -= kTimestampTicksPerMs; |
| 132 rtcp.push_front(RtcpMeasurement(ntp_sec, ntp_frac, timestamp)); | 132 rtcp.push_front(RtcpMeasurement(ntp_sec, ntp_frac, timestamp)); |
| 133 ntp_frac += kOneMsInNtpFrac; | 133 ntp_frac += kOneMsInNtpFrac; |
| 134 timestamp += 2*kTimestampTicksPerMs; | 134 timestamp += 2*kTimestampTicksPerMs; |
| 135 int64_t timestamp_in_ms = -1; | 135 int64_t timestamp_in_ms = -1; |
| 136 EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_in_ms)); | 136 EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_in_ms)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST(RtpToNtpTests, FailsForDecreasingRtpTimestamp) { |
| 140 const uint32_t kNtpSec1 = 3683354930; |
| 141 const uint32_t kNtpFrac1 = 699925050; |
| 142 const uint32_t kTimestamp1 = 2192705742; |
| 143 const uint32_t kNtpSec2 = kNtpSec1; |
| 144 const uint32_t kNtpFrac2 = kNtpFrac1 + kOneMsInNtpFrac; |
| 145 const uint32_t kTimestamp2 = kTimestamp1 - kTimestampTicksPerMs; |
| 146 RtcpList rtcp; |
| 147 rtcp.push_front(RtcpMeasurement(kNtpSec1, kNtpFrac1, kTimestamp1)); |
| 148 rtcp.push_front(RtcpMeasurement(kNtpSec2, kNtpFrac2, kTimestamp2)); |
| 149 int64_t timestamp_in_ms = -1; |
| 150 EXPECT_FALSE(RtpToNtpMs(kTimestamp1, rtcp, ×tamp_in_ms)); |
| 151 } |
| 152 |
| 139 TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { | 153 TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { |
| 140 RtcpList rtcp; | 154 RtcpList rtcp; |
| 141 uint32_t ntp_sec = 0; | 155 uint32_t ntp_sec = 0; |
| 142 uint32_t ntp_frac = 2; | 156 uint32_t ntp_frac = 2; |
| 143 uint32_t timestamp = 0x12345678; | 157 uint32_t timestamp = 0x12345678; |
| 144 | 158 |
| 145 bool new_sr; | 159 bool new_sr; |
| 146 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); | 160 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
| 147 EXPECT_TRUE(new_sr); | 161 EXPECT_TRUE(new_sr); |
| 148 | 162 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 169 TEST(UpdateRtcpListTests, InjectRtcpSrWithZeroNtpFails) { | 183 TEST(UpdateRtcpListTests, InjectRtcpSrWithZeroNtpFails) { |
| 170 RtcpList rtcp; | 184 RtcpList rtcp; |
| 171 uint32_t ntp_sec = 0; | 185 uint32_t ntp_sec = 0; |
| 172 uint32_t ntp_frac = 0; | 186 uint32_t ntp_frac = 0; |
| 173 uint32_t timestamp = 0x12345678; | 187 uint32_t timestamp = 0x12345678; |
| 174 | 188 |
| 175 bool new_sr; | 189 bool new_sr; |
| 176 EXPECT_FALSE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); | 190 EXPECT_FALSE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
| 177 } | 191 } |
| 178 }; // namespace webrtc | 192 }; // namespace webrtc |
| OLD | NEW |