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

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

Issue 1513223002: Reduce the runtime of some ACM tests in modules_tests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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 <sstream> 13 #include <sstream>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 16
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webrtc/base/checks.h"
18 #include "webrtc/base/scoped_ptr.h" 19 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/common_types.h" 20 #include "webrtc/common_types.h"
20 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" 21 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
21 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" 22 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
22 #include "webrtc/modules/audio_coding/test/utility.h" 23 #include "webrtc/modules/audio_coding/test/utility.h"
23 #include "webrtc/system_wrappers/include/trace.h" 24 #include "webrtc/system_wrappers/include/trace.h"
24 #include "webrtc/test/testsupport/fileutils.h" 25 #include "webrtc/test/testsupport/fileutils.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 28
(...skipping 28 matching lines...) Expand all
56 struct CodecInst sendCodec; 57 struct CodecInst sendCodec;
57 int noOfCodecs = acm->NumberOfCodecs(); 58 int noOfCodecs = acm->NumberOfCodecs();
58 int codecNo; 59 int codecNo;
59 60
60 // Open input file 61 // Open input file
61 const std::string file_name = webrtc::test::ResourcePath(in_file_name, "pcm"); 62 const std::string file_name = webrtc::test::ResourcePath(in_file_name, "pcm");
62 _pcmFile.Open(file_name, sample_rate, "rb"); 63 _pcmFile.Open(file_name, sample_rate, "rb");
63 if (channels == 2) { 64 if (channels == 2) {
64 _pcmFile.ReadStereo(true); 65 _pcmFile.ReadStereo(true);
65 } 66 }
67 static const int kTestLengthMs = 500;
ivoc 2015/12/10 12:23:57 Not sure what the point of static is here.
hlundin-webrtc 2015/12/10 12:49:59 Gone.
68 const int test_length_blocks = rtc::CheckedDivExact(kTestLengthMs, 10);
69 _pcmFile.SetNum10MsBlocksToRead(test_length_blocks);
70 // Fast-forward 1 second (100 blocks) since the file starts with silence.
71 _pcmFile.FastForward(100);
66 72
67 // Set the codec for the current test. 73 // Set the codec for the current test.
68 if ((testMode == 0) || (testMode == 1)) { 74 if ((testMode == 0) || (testMode == 1)) {
69 // Set the codec id. 75 // Set the codec id.
70 codecNo = codeId; 76 codecNo = codeId;
71 } else { 77 } else {
72 // Choose codec on command line. 78 // Choose codec on command line.
73 printf("List of supported codec.\n"); 79 printf("List of supported codec.\n");
74 for (int n = 0; n < noOfCodecs; n++) { 80 for (int n = 0; n < noOfCodecs; n++) {
75 EXPECT_EQ(0, acm->Codec(n, &sendCodec)); 81 EXPECT_EQ(0, acm->Codec(n, &sendCodec));
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (acm->SendCodec()) { 348 if (acm->SendCodec()) {
343 _sender.Run(); 349 _sender.Run();
344 } 350 }
345 _sender.Teardown(); 351 _sender.Teardown();
346 rtpFile.Close(); 352 rtpFile.Close();
347 353
348 return fileName; 354 return fileName;
349 } 355 }
350 356
351 } // namespace webrtc 357 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/test/PCMFile.h » ('j') | webrtc/modules/audio_coding/test/PCMFile.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698