| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 void EncodeDecodeTest::Perform() { | 274 void EncodeDecodeTest::Perform() { |
| 275 int numCodecs = 1; | 275 int numCodecs = 1; |
| 276 int codePars[3]; // Frequency, packet size, rate. | 276 int codePars[3]; // Frequency, packet size, rate. |
| 277 int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate) | 277 int numPars[52]; // Number of codec parameters sets (freq, pacsize, rate) |
| 278 // to test, for a given codec. | 278 // to test, for a given codec. |
| 279 | 279 |
| 280 codePars[0] = 0; | 280 codePars[0] = 0; |
| 281 codePars[1] = 0; | 281 codePars[1] = 0; |
| 282 codePars[2] = 0; | 282 codePars[2] = 0; |
| 283 | 283 |
| 284 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create()); | 284 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); |
| 285 struct CodecInst sendCodecTmp; | 285 struct CodecInst sendCodecTmp; |
| 286 numCodecs = acm->NumberOfCodecs(); | 286 numCodecs = acm->NumberOfCodecs(); |
| 287 | 287 |
| 288 if (_testMode != 2) { | 288 if (_testMode != 2) { |
| 289 for (int n = 0; n < numCodecs; n++) { | 289 for (int n = 0; n < numCodecs; n++) { |
| 290 EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp)); | 290 EXPECT_EQ(0, acm->Codec(n, &sendCodecTmp)); |
| 291 if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { | 291 if (STR_CASE_CMP(sendCodecTmp.plname, "telephone-event") == 0) { |
| 292 numPars[n] = 0; | 292 numPars[n] = 0; |
| 293 } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) { | 293 } else if (STR_CASE_CMP(sendCodecTmp.plname, "cn") == 0) { |
| 294 numPars[n] = 0; | 294 numPars[n] = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // End tracing. | 330 // End tracing. |
| 331 if (_testMode == 1) { | 331 if (_testMode == 1) { |
| 332 Trace::ReturnTrace(); | 332 Trace::ReturnTrace(); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 std::string EncodeDecodeTest::EncodeToFile(int fileType, | 336 std::string EncodeDecodeTest::EncodeToFile(int fileType, |
| 337 int codeId, | 337 int codeId, |
| 338 int* codePars, | 338 int* codePars, |
| 339 int testMode) { | 339 int testMode) { |
| 340 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create()); | 340 std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1)); |
| 341 RTPFile rtpFile; | 341 RTPFile rtpFile; |
| 342 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), | 342 std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), |
| 343 "encode_decode_rtp"); | 343 "encode_decode_rtp"); |
| 344 rtpFile.Open(fileName.c_str(), "wb+"); | 344 rtpFile.Open(fileName.c_str(), "wb+"); |
| 345 rtpFile.WriteHeader(); | 345 rtpFile.WriteHeader(); |
| 346 | 346 |
| 347 // Store for auto_test and logging. | 347 // Store for auto_test and logging. |
| 348 _sender.testMode = testMode; | 348 _sender.testMode = testMode; |
| 349 _sender.codeId = codeId; | 349 _sender.codeId = codeId; |
| 350 | 350 |
| 351 _sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1); | 351 _sender.Setup(acm.get(), &rtpFile, "audio_coding/testfile32kHz", 32000, 1); |
| 352 if (acm->SendCodec()) { | 352 if (acm->SendCodec()) { |
| 353 _sender.Run(); | 353 _sender.Run(); |
| 354 } | 354 } |
| 355 _sender.Teardown(); | 355 _sender.Teardown(); |
| 356 rtpFile.Close(); | 356 rtpFile.Close(); |
| 357 | 357 |
| 358 return fileName; | 358 return fileName; |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace webrtc | 361 } // namespace webrtc |
| OLD | NEW |