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

Side by Side Diff: webrtc/modules/audio_coding/test/EncodeDecodeTest.cc

Issue 1695763004: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/test/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up-neteq
Patch Set: Created 4 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) 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
11 #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h" 11 #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h"
12 12
13 #include <memory>
13 #include <sstream> 14 #include <sstream>
14 #include <stdio.h> 15 #include <stdio.h>
15 #include <stdlib.h> 16 #include <stdlib.h>
16 17
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
20 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" 20 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
21 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" 21 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
22 #include "webrtc/modules/audio_coding/test/utility.h" 22 #include "webrtc/modules/audio_coding/test/utility.h"
23 #include "webrtc/system_wrappers/include/trace.h" 23 #include "webrtc/system_wrappers/include/trace.h"
24 #include "webrtc/test/testsupport/fileutils.h" 24 #include "webrtc/test/testsupport/fileutils.h"
25 25
26 namespace webrtc { 26 namespace webrtc {
27 27
28 TestPacketization::TestPacketization(RTPStream *rtpStream, uint16_t frequency) 28 TestPacketization::TestPacketization(RTPStream *rtpStream, uint16_t frequency)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void EncodeDecodeTest::Perform() { 268 void EncodeDecodeTest::Perform() {
269 int numCodecs = 1; 269 int numCodecs = 1;
270 int codePars[3]; // Frequency, packet size, rate. 270 int codePars[3]; // Frequency, packet size, rate.
271 int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate) 271 int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate)
272 // to test, for a given codec. 272 // to test, for a given codec.
273 273
274 codePars[0] = 0; 274 codePars[0] = 0;
275 codePars[1] = 0; 275 codePars[1] = 0;
276 codePars[2] = 0; 276 codePars[2] = 0;
277 277
278 rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); 278 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
279 struct CodecInst sendCodecTmp; 279 struct CodecInst sendCodecTmp;
280 numCodecs = acm->NumberOfCodecs(); 280 numCodecs = acm->NumberOfCodecs();
281 281
282 if (_testMode != 2) { 282 if (_testMode != 2) {
283 for (int n = 0; n < numCodecs; n++) { 283 for (int n = 0; n < numCodecs; n++) {
284 EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp)); 284 EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp));
285 if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { 285 if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) {
286 numPars[n] = 0; 286 numPars[n] = 0;
287 } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) { 287 } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) {
288 numPars[n] = 0; 288 numPars[n] = 0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // End tracing. 324 // End tracing.
325 if (_testMode == 1) { 325 if (_testMode == 1) {
326 Trace::ReturnTrace(); 326 Trace::ReturnTrace();
327 } 327 }
328 } 328 }
329 329
330 std::string EncodeDecodeTest::EncodeToFile(int fileType, 330 std::string EncodeDecodeTest::EncodeToFile(int fileType,
331 int codeId, 331 int codeId,
332 int* codePars, 332 int* codePars,
333 int testMode) { 333 int testMode) {
334 rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1)); 334 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1));
335 RTPFile rtpFile; 335 RTPFile rtpFile;
336 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), 336 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
337 "encode_decode_rtp"); 337 "encode_decode_rtp");
338 rtpFile.Open(fileName.c_str(), "wb+"); 338 rtpFile.Open(fileName.c_str(), "wb+");
339 rtpFile.WriteHeader(); 339 rtpFile.WriteHeader();
340 340
341 // Store for auto_test and logging. 341 // Store for auto_test and logging.
342 _sender.testMode = testMode; 342 _sender.testMode = testMode;
343 _sender.codeId = codeId; 343 _sender.codeId = codeId;
344 344
345 _sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1); 345 _sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1);
346 if (acm->SendCodec()) { 346 if (acm->SendCodec()) {
347 _sender.Run(); 347 _sender.Run();
348 } 348 }
349 _sender.Teardown(); 349 _sender.Teardown();
350 rtpFile.Close(); 350 rtpFile.Close();
351 351
352 return fileName; 352 return fileName;
353 } 353 }
354 354
355 } // namespace webrtc 355 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/test/APITest.h ('k') | webrtc/modules/audio_coding/test/PacketLossTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698