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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 last_packet_send_timestamp_(timestamp_), 60 last_packet_send_timestamp_(timestamp_),
61 last_frame_type_(kEmptyFrame) { 61 last_frame_type_(kEmptyFrame) {
62 config_.decoder_factory = CreateBuiltinAudioDecoderFactory(); 62 config_.decoder_factory = CreateBuiltinAudioDecoderFactory();
63 } 63 }
64 64
65 ~AcmReceiverTestOldApi() {} 65 ~AcmReceiverTestOldApi() {}
66 66
67 void SetUp() override { 67 void SetUp() override {
68 acm_.reset(AudioCodingModule::Create(config_)); 68 acm_.reset(AudioCodingModule::Create(config_));
69 receiver_.reset(new AcmReceiver(config_)); 69 receiver_.reset(new AcmReceiver(config_));
70 ASSERT_TRUE(receiver_.get() != NULL); 70 ASSERT_TRUE(receiver_.get() != nullptr);
71 ASSERT_TRUE(acm_.get() != NULL); 71 ASSERT_TRUE(acm_.get() != nullptr);
72 codecs_ = RentACodec::Database(); 72 codecs_ = RentACodec::Database();
73 73
74 acm_->InitializeReceiver(); 74 acm_->InitializeReceiver();
75 acm_->RegisterTransportCallback(this); 75 acm_->RegisterTransportCallback(this);
76 76
77 rtp_header_.header.sequenceNumber = 0; 77 rtp_header_.header.sequenceNumber = 0;
78 rtp_header_.header.timestamp = 0; 78 rtp_header_.header.timestamp = 0;
79 rtp_header_.header.markerBit = false; 79 rtp_header_.header.markerBit = false;
80 rtp_header_.header.ssrc = 0x12345678; // Arbitrary. 80 rtp_header_.header.ssrc = 0x12345678; // Arbitrary.
81 rtp_header_.header.numCSRCs = 0; 81 rtp_header_.header.numCSRCs = 0;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 #if defined(WEBRTC_ANDROID) 168 #if defined(WEBRTC_ANDROID)
169 #define MAYBE_AddCodecGetCodec DISABLED_AddCodecGetCodec 169 #define MAYBE_AddCodecGetCodec DISABLED_AddCodecGetCodec
170 #else 170 #else
171 #define MAYBE_AddCodecGetCodec AddCodecGetCodec 171 #define MAYBE_AddCodecGetCodec AddCodecGetCodec
172 #endif 172 #endif
173 TEST_F(AcmReceiverTestOldApi, MAYBE_AddCodecGetCodec) { 173 TEST_F(AcmReceiverTestOldApi, MAYBE_AddCodecGetCodec) {
174 // Add codec. 174 // Add codec.
175 for (size_t n = 0; n < codecs_.size(); ++n) { 175 for (size_t n = 0; n < codecs_.size(); ++n) {
176 if (n & 0x1) { // Just add codecs with odd index. 176 if (n & 0x1) { // Just add codecs with odd index.
177 EXPECT_EQ( 177 EXPECT_EQ(0, receiver_->AddCodec(n, codecs_[n].pltype,
178 0, receiver_->AddCodec(n, codecs_[n].pltype, codecs_[n].channels, 178 codecs_[n].channels, codecs_[n].plfreq,
179 codecs_[n].plfreq, NULL, codecs_[n].plname)); 179 nullptr, codecs_[n].plname));
180 } 180 }
181 } 181 }
182 // Get codec and compare. 182 // Get codec and compare.
183 for (size_t n = 0; n < codecs_.size(); ++n) { 183 for (size_t n = 0; n < codecs_.size(); ++n) {
184 CodecInst my_codec; 184 CodecInst my_codec;
185 if (n & 0x1) { 185 if (n & 0x1) {
186 // Codecs with odd index should match the reference. 186 // Codecs with odd index should match the reference.
187 EXPECT_EQ(0, receiver_->DecoderByPayloadType(codecs_[n].pltype, 187 EXPECT_EQ(0, receiver_->DecoderByPayloadType(codecs_[n].pltype,
188 &my_codec)); 188 &my_codec));
189 EXPECT_TRUE(CodecsEqual(codecs_[n], my_codec)); 189 EXPECT_TRUE(CodecsEqual(codecs_[n], my_codec));
(...skipping 14 matching lines...) Expand all
204 const CodecIdInst codec1(RentACodec::CodecId::kPCMA); 204 const CodecIdInst codec1(RentACodec::CodecId::kPCMA);
205 CodecInst codec2 = codec1.inst; 205 CodecInst codec2 = codec1.inst;
206 ++codec2.pltype; 206 ++codec2.pltype;
207 CodecInst test_codec; 207 CodecInst test_codec;
208 208
209 // Register the same codec with different payloads. 209 // Register the same codec with different payloads.
210 EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec1.inst.pltype, 210 EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec1.inst.pltype,
211 codec1.inst.channels, codec1.inst.plfreq, 211 codec1.inst.channels, codec1.inst.plfreq,
212 nullptr, codec1.inst.plname)); 212 nullptr, codec1.inst.plname));
213 EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec2.pltype, codec2.channels, 213 EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec2.pltype, codec2.channels,
214 codec2.plfreq, NULL, codec2.plname)); 214 codec2.plfreq, nullptr, codec2.plname));
215 215
216 // Both payload types should exist. 216 // Both payload types should exist.
217 EXPECT_EQ(0, 217 EXPECT_EQ(0,
218 receiver_->DecoderByPayloadType(codec1.inst.pltype, &test_codec)); 218 receiver_->DecoderByPayloadType(codec1.inst.pltype, &test_codec));
219 EXPECT_EQ(true, CodecsEqual(codec1.inst, test_codec)); 219 EXPECT_EQ(true, CodecsEqual(codec1.inst, test_codec));
220 EXPECT_EQ(0, receiver_->DecoderByPayloadType(codec2.pltype, &test_codec)); 220 EXPECT_EQ(0, receiver_->DecoderByPayloadType(codec2.pltype, &test_codec));
221 EXPECT_EQ(true, CodecsEqual(codec2, test_codec)); 221 EXPECT_EQ(true, CodecsEqual(codec2, test_codec));
222 } 222 }
223 223
224 #if defined(WEBRTC_ANDROID) 224 #if defined(WEBRTC_ANDROID)
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 receiver_->last_packet_sample_rate_hz()); 499 receiver_->last_packet_sample_rate_hz());
500 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); 500 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec));
501 EXPECT_TRUE(CodecsEqual(c.inst, codec)); 501 EXPECT_TRUE(CodecsEqual(c.inst, codec));
502 } 502 }
503 } 503 }
504 #endif 504 #endif
505 505
506 } // namespace acm2 506 } // namespace acm2
507 507
508 } // namespace webrtc 508 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698