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 | 129 |
130 TEST(UpdateRtcpListTests, InjectRtcpSr) { | 130 TEST(UpdateRtcpListTests, InjectRtcpSr) { |
131 const uint32_t kNtpSec = 10; | 131 const uint32_t kNtpSec = 10; |
132 const uint32_t kNtpFrac = 12345; | 132 const uint32_t kNtpFrac = 12345; |
133 const uint32_t kTs = 0x12345678; | 133 const uint32_t kTs = 0x12345678; |
134 bool new_sr; | 134 bool new_sr; |
135 RtcpMeasurements rtcp; | 135 RtcpMeasurements rtcp; |
136 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac, kTs, &rtcp, &new_sr)); | 136 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac, kTs, &rtcp, &new_sr)); |
137 EXPECT_TRUE(new_sr); | 137 EXPECT_TRUE(new_sr); |
138 EXPECT_EQ(1u, rtcp.list.size()); | 138 EXPECT_EQ(1u, rtcp.list.size()); |
139 EXPECT_EQ(kNtpSec, rtcp.list.front().ntp_secs); | 139 EXPECT_EQ(kNtpSec, rtcp.list.front().ntp_time.seconds()); |
140 EXPECT_EQ(kNtpFrac, rtcp.list.front().ntp_frac); | 140 EXPECT_EQ(kNtpFrac, rtcp.list.front().ntp_time.fractions()); |
141 EXPECT_EQ(kTs, rtcp.list.front().rtp_timestamp); | 141 EXPECT_EQ(kTs, rtcp.list.front().rtp_timestamp); |
142 // Add second report. | 142 // Add second report. |
143 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac + kOneMsInNtpFrac, kTs + 1, | 143 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac + kOneMsInNtpFrac, kTs + 1, |
144 &rtcp, &new_sr)); | 144 &rtcp, &new_sr)); |
145 EXPECT_EQ(2u, rtcp.list.size()); | 145 EXPECT_EQ(2u, rtcp.list.size()); |
146 EXPECT_EQ(kTs + 1, rtcp.list.front().rtp_timestamp); | 146 EXPECT_EQ(kTs + 1, rtcp.list.front().rtp_timestamp); |
147 EXPECT_EQ(kTs + 0, rtcp.list.back().rtp_timestamp); | 147 EXPECT_EQ(kTs + 0, rtcp.list.back().rtp_timestamp); |
148 // List should contain last two reports. | 148 // List should contain last two reports. |
149 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac + 2 * kOneMsInNtpFrac, kTs + 2, | 149 EXPECT_TRUE(UpdateRtcpList(kNtpSec, kNtpFrac + 2 * kOneMsInNtpFrac, kTs + 2, |
150 &rtcp, &new_sr)); | 150 &rtcp, &new_sr)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool new_sr; | 264 bool new_sr; |
265 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); | 265 EXPECT_TRUE(UpdateRtcpList(ntp_sec, ntp_frac, timestamp, &rtcp, &new_sr)); |
266 EXPECT_EQ(1u, rtcp.list.size()); | 266 EXPECT_EQ(1u, rtcp.list.size()); |
267 // Parameters are not calculated, conversion of RTP to NTP time should fail. | 267 // Parameters are not calculated, conversion of RTP to NTP time should fail. |
268 EXPECT_FALSE(rtcp.params.calculated); | 268 EXPECT_FALSE(rtcp.params.calculated); |
269 int64_t timestamp_ms = -1; | 269 int64_t timestamp_ms = -1; |
270 EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_ms)); | 270 EXPECT_FALSE(RtpToNtpMs(timestamp, rtcp, ×tamp_ms)); |
271 } | 271 } |
272 | 272 |
273 }; // namespace webrtc | 273 }; // namespace webrtc |
OLD | NEW |