Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: webrtc/modules/audio_coding/neteq/timestamp_scaler_unittest.cc

Issue 2425223002: NetEq now works with packets as values, rather than pointers. (Closed)
Patch Set: Compare packets better in test. One more const. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/timestamp_scaler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Use G722, which has a factor 2 scaling. 202 // Use G722, which has a factor 2 scaling.
203 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, factory); 203 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, factory);
204 static const uint8_t kRtpPayloadType = 17; 204 static const uint8_t kRtpPayloadType = 17;
205 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) 205 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType))
206 .WillRepeatedly(Return(&info)); 206 .WillRepeatedly(Return(&info));
207 207
208 TimestampScaler scaler(db); 208 TimestampScaler scaler(db);
209 // Test both sides of the timestamp wrap-around. 209 // Test both sides of the timestamp wrap-around.
210 uint32_t external_timestamp = 0xFFFFFFFF - 5; 210 uint32_t external_timestamp = 0xFFFFFFFF - 5;
211 uint32_t internal_timestamp = external_timestamp; 211 uint32_t internal_timestamp = external_timestamp;
212 Packet packet1;
213 packet1.payload_type = kRtpPayloadType;
214 packet1.timestamp = external_timestamp;
215 Packet packet2;
216 packet2.payload_type = kRtpPayloadType;
217 packet2.timestamp = external_timestamp + 10;
218 PacketList packet_list; 212 PacketList packet_list;
219 packet_list.push_back(&packet1); 213 {
220 packet_list.push_back(&packet2); 214 Packet packet1;
215 packet1.payload_type = kRtpPayloadType;
216 packet1.timestamp = external_timestamp;
217 Packet packet2;
218 packet2.payload_type = kRtpPayloadType;
219 packet2.timestamp = external_timestamp + 10;
220 packet_list.push_back(std::move(packet1));
221 packet_list.push_back(std::move(packet2));
222 }
221 223
222 scaler.ToInternal(&packet_list); 224 scaler.ToInternal(&packet_list);
223 EXPECT_EQ(internal_timestamp, packet1.timestamp); 225 EXPECT_EQ(internal_timestamp, packet_list.front().timestamp);
224 EXPECT_EQ(internal_timestamp + 20, packet2.timestamp); 226 packet_list.pop_front();
227 EXPECT_EQ(internal_timestamp + 20, packet_list.front().timestamp);
225 228
226 EXPECT_CALL(db, Die()); // Called when database object is deleted. 229 EXPECT_CALL(db, Die()); // Called when database object is deleted.
227 } 230 }
228 231
229 TEST(TimestampScaler, TestG722Reset) { 232 TEST(TimestampScaler, TestG722Reset) {
230 MockDecoderDatabase db; 233 MockDecoderDatabase db;
231 auto factory = CreateBuiltinAudioDecoderFactory(); 234 auto factory = CreateBuiltinAudioDecoderFactory();
232 // Use G722, which has a factor 2 scaling. 235 // Use G722, which has a factor 2 scaling.
233 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, factory); 236 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, factory);
234 static const uint8_t kRtpPayloadType = 17; 237 static const uint8_t kRtpPayloadType = 17;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 uint32_t timestamp = 4711; // Some number. 307 uint32_t timestamp = 4711; // Some number.
305 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); 308 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType));
306 309
307 Packet* packet = NULL; 310 Packet* packet = NULL;
308 scaler.ToInternal(packet); // Should not crash. That's all we can test. 311 scaler.ToInternal(packet); // Should not crash. That's all we can test.
309 312
310 EXPECT_CALL(db, Die()); // Called when database object is deleted. 313 EXPECT_CALL(db, Die()); // Called when database object is deleted.
311 } 314 }
312 315
313 } // namespace webrtc 316 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/timestamp_scaler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698