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

Side by Side Diff: webrtc/modules/audio_coding/main/test/iSACTest.cc

Issue 1311533010: Remove AudioEncoder methods SetMaxBitrate and SetMaxPayloadSize (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@ifc-merge-2
Patch Set: Created 5 years, 3 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
« no previous file with comments | « webrtc/modules/audio_coding/main/test/iSACTest.h ('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 17 matching lines...) Expand all
28 #include "webrtc/system_wrappers/interface/event_wrapper.h" 28 #include "webrtc/system_wrappers/interface/event_wrapper.h"
29 #include "webrtc/system_wrappers/interface/tick_util.h" 29 #include "webrtc/system_wrappers/interface/tick_util.h"
30 #include "webrtc/system_wrappers/interface/trace.h" 30 #include "webrtc/system_wrappers/interface/trace.h"
31 #include "webrtc/test/testsupport/fileutils.h" 31 #include "webrtc/test/testsupport/fileutils.h"
32 32
33 namespace webrtc { 33 namespace webrtc {
34 34
35 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) { 35 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) {
36 isacConfig.currentRateBitPerSec = 0; 36 isacConfig.currentRateBitPerSec = 0;
37 isacConfig.currentFrameSizeMsec = 0; 37 isacConfig.currentFrameSizeMsec = 0;
38 isacConfig.maxRateBitPerSec = 0;
39 isacConfig.maxPayloadSizeByte = 0;
40 isacConfig.encodingMode = -1; 38 isacConfig.encodingMode = -1;
41 isacConfig.initRateBitPerSec = 0; 39 isacConfig.initRateBitPerSec = 0;
42 isacConfig.initFrameSizeInMsec = 0; 40 isacConfig.initFrameSizeInMsec = 0;
43 isacConfig.enforceFrameSize = false; 41 isacConfig.enforceFrameSize = false;
44 return; 42 return;
45 } 43 }
46 44
47 int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm, 45 int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm,
48 int testMode) { 46 int testMode) {
49 47
(...skipping 10 matching lines...) Expand all
60 sendCodec.rate = isacConfig.currentRateBitPerSec; 58 sendCodec.rate = isacConfig.currentRateBitPerSec;
61 } 59 }
62 if (isacConfig.currentFrameSizeMsec != 0) { 60 if (isacConfig.currentFrameSizeMsec != 0) {
63 sendCodec.pacsize = isacConfig.currentFrameSizeMsec 61 sendCodec.pacsize = isacConfig.currentFrameSizeMsec
64 * (sendCodec.plfreq / 1000); 62 * (sendCodec.plfreq / 1000);
65 } 63 }
66 EXPECT_EQ(0, acm->RegisterSendCodec(sendCodec)); 64 EXPECT_EQ(0, acm->RegisterSendCodec(sendCodec));
67 } 65 }
68 } 66 }
69 67
70 if (isacConfig.maxRateBitPerSec > 0) {
71 // Set max rate.
72 EXPECT_EQ(0, acm->SetISACMaxRate(isacConfig.maxRateBitPerSec));
73 }
74 if (isacConfig.maxPayloadSizeByte > 0) {
75 // Set max payload size.
76 EXPECT_EQ(0, acm->SetISACMaxPayloadSize(isacConfig.maxPayloadSizeByte));
77 }
78
79 return 0; 68 return 0;
80 } 69 }
81 70
82 ISACTest::ISACTest(int testMode) 71 ISACTest::ISACTest(int testMode)
83 : _acmA(AudioCodingModule::Create(1)), 72 : _acmA(AudioCodingModule::Create(1)),
84 _acmB(AudioCodingModule::Create(2)), 73 _acmB(AudioCodingModule::Create(2)),
85 _testMode(testMode) {} 74 _testMode(testMode) {}
86 75
87 ISACTest::~ISACTest() {} 76 ISACTest::~ISACTest() {}
88 77
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 wbISACConfig.currentFrameSizeMsec = 60; 175 wbISACConfig.currentFrameSizeMsec = 60;
187 testNr++; 176 testNr++;
188 EncodeDecode(testNr, wbISACConfig, swbISACConfig); 177 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
189 } 178 }
190 179
191 SetISACConfigDefault(wbISACConfig); 180 SetISACConfigDefault(wbISACConfig);
192 SetISACConfigDefault(swbISACConfig); 181 SetISACConfigDefault(swbISACConfig);
193 testNr++; 182 testNr++;
194 EncodeDecode(testNr, wbISACConfig, swbISACConfig); 183 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
195 184
196 int user_input;
197 if ((_testMode == 0) || (_testMode == 1)) {
198 swbISACConfig.maxPayloadSizeByte = static_cast<uint16_t>(200);
199 wbISACConfig.maxPayloadSizeByte = static_cast<uint16_t>(200);
200 } else {
201 printf("Enter the max payload-size for side A: ");
202 CHECK_ERROR(scanf("%d", &user_input));
203 swbISACConfig.maxPayloadSizeByte = (uint16_t) user_input;
204 printf("Enter the max payload-size for side B: ");
205 CHECK_ERROR(scanf("%d", &user_input));
206 wbISACConfig.maxPayloadSizeByte = (uint16_t) user_input;
207 }
208 testNr++;
209 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
210
211 SetISACConfigDefault(wbISACConfig);
212 SetISACConfigDefault(swbISACConfig);
213
214 if ((_testMode == 0) || (_testMode == 1)) {
215 swbISACConfig.maxRateBitPerSec = static_cast<uint32_t>(48000);
216 wbISACConfig.maxRateBitPerSec = static_cast<uint32_t>(48000);
217 } else {
218 printf("Enter the max rate for side A: ");
219 CHECK_ERROR(scanf("%d", &user_input));
220 swbISACConfig.maxRateBitPerSec = (uint32_t) user_input;
221 printf("Enter the max rate for side B: ");
222 CHECK_ERROR(scanf("%d", &user_input));
223 wbISACConfig.maxRateBitPerSec = (uint32_t) user_input;
224 }
225
226 testNr++;
227 EncodeDecode(testNr, wbISACConfig, swbISACConfig);
228
229 testNr++; 185 testNr++;
230 if (_testMode == 0) { 186 if (_testMode == 0) {
231 SwitchingSamplingRate(testNr, 4); 187 SwitchingSamplingRate(testNr, 4);
232 } else { 188 } else {
233 SwitchingSamplingRate(testNr, 80); 189 SwitchingSamplingRate(testNr, 80);
234 } 190 }
235 } 191 }
236 192
237 void ISACTest::Run10ms() { 193 void ISACTest::Run10ms() {
238 AudioFrame audioFrame; 194 AudioFrame audioFrame;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 numSendCodecChanged++; 331 numSendCodecChanged++;
376 } 332 }
377 } 333 }
378 _outFileA.Close(); 334 _outFileA.Close();
379 _outFileB.Close(); 335 _outFileB.Close();
380 _inFileA.Close(); 336 _inFileA.Close();
381 _inFileB.Close(); 337 _inFileB.Close();
382 } 338 }
383 339
384 } // namespace webrtc 340 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/test/iSACTest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698