| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const uint32_t kNtpSec2 = kNtpSec1; | 143 const uint32_t kNtpSec2 = kNtpSec1; |
| 144 const uint32_t kNtpFrac2 = kNtpFrac1 + kOneMsInNtpFrac; | 144 const uint32_t kNtpFrac2 = kNtpFrac1 + kOneMsInNtpFrac; |
| 145 const uint32_t kTimestamp2 = kTimestamp1 - kTimestampTicksPerMs; | 145 const uint32_t kTimestamp2 = kTimestamp1 - kTimestampTicksPerMs; |
| 146 RtcpList rtcp; | 146 RtcpList rtcp; |
| 147 rtcp.push_front(RtcpMeasurement(kNtpSec1, kNtpFrac1, kTimestamp1)); | 147 rtcp.push_front(RtcpMeasurement(kNtpSec1, kNtpFrac1, kTimestamp1)); |
| 148 rtcp.push_front(RtcpMeasurement(kNtpSec2, kNtpFrac2, kTimestamp2)); | 148 rtcp.push_front(RtcpMeasurement(kNtpSec2, kNtpFrac2, kTimestamp2)); |
| 149 int64_t timestamp_in_ms = -1; | 149 int64_t timestamp_in_ms = -1; |
| 150 EXPECT_FALSE(RtpToNtpMs(kTimestamp1, rtcp, ×tamp_in_ms)); | 150 EXPECT_FALSE(RtpToNtpMs(kTimestamp1, rtcp, ×tamp_in_ms)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TEST(RtpToNtpTests, RtpToNtpMsWithReturnedFrequency) { |
| 154 const uint32_t kNtpSec1 = 3683354930; |
| 155 const uint32_t kNtpFrac1 = 699925050; |
| 156 const uint32_t kTimestamp1 = 2192705742; |
| 157 const uint32_t kNtpSec2 = kNtpSec1; |
| 158 const uint32_t kNtpFrac2 = kNtpFrac1 + kOneMsInNtpFrac; |
| 159 const uint32_t kTimestamp2 = kTimestamp1 + kTimestampTicksPerMs; |
| 160 RtcpList rtcp; |
| 161 rtcp.push_front(RtcpMeasurement(kNtpSec1, kNtpFrac1, kTimestamp1)); |
| 162 rtcp.push_front(RtcpMeasurement(kNtpSec2, kNtpFrac2, kTimestamp2)); |
| 163 int64_t timestamp_in_ms; |
| 164 double freq_khz; |
| 165 EXPECT_TRUE( |
| 166 RtpToNtpMsAndReturnFreq(kTimestamp1, rtcp, ×tamp_in_ms, &freq_khz)); |
| 167 EXPECT_DOUBLE_EQ(90.0, freq_khz); |
| 168 } |
| 169 |
| 153 TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { | 170 TEST(UpdateRtcpListTests, InjectRtcpSrWithEqualNtp) { |
| 154 RtcpList rtcp; | 171 RtcpList rtcp; |
| 155 uint32_t ntp_sec = 0; | 172 uint32_t ntp_sec = 0; |
| 156 uint32_t ntp_frac = 2; | 173 uint32_t ntp_frac = 2; |
| 157 uint32_t timestamp = 0x12345678; | 174 uint32_t timestamp = 0x12345678; |
| 158 | 175 |
| 159 bool new_sr; | 176 bool new_sr; |
| 160 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); | 177 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
| 161 EXPECT_TRUE(new_sr); | 178 EXPECT_TRUE(new_sr); |
| 162 | 179 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 183 TEST(UpdateRtcpListTests, InjectRtcpSrWithZeroNtpFails) { | 200 TEST(UpdateRtcpListTests, InjectRtcpSrWithZeroNtpFails) { |
| 184 RtcpList rtcp; | 201 RtcpList rtcp; |
| 185 uint32_t ntp_sec = 0; | 202 uint32_t ntp_sec = 0; |
| 186 uint32_t ntp_frac = 0; | 203 uint32_t ntp_frac = 0; |
| 187 uint32_t timestamp = 0x12345678; | 204 uint32_t timestamp = 0x12345678; |
| 188 | 205 |
| 189 bool new_sr; | 206 bool new_sr; |
| 190 EXPECT_FALSE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); | 207 EXPECT_FALSE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
| 191 } | 208 } |
| 192 }; // namespace webrtc | 209 }; // namespace webrtc |
| OLD | NEW |