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

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

Issue 1406123011: Let AudioCodingModule::SendCodec return Maybe<CodecInst> (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review fix Created 5 years, 1 month 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
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 SetUp(); 243 SetUp();
244 } 244 }
245 unsigned int msecPassed = 0; 245 unsigned int msecPassed = 0;
246 unsigned int secPassed = 0; 246 unsigned int secPassed = 0;
247 247
248 int32_t outFreqHzA = _outFileA.SamplingFrequency(); 248 int32_t outFreqHzA = _outFileA.SamplingFrequency();
249 int32_t outFreqHzB = _outFileB.SamplingFrequency(); 249 int32_t outFreqHzB = _outFileB.SamplingFrequency();
250 250
251 AudioFrame audioFrame; 251 AudioFrame audioFrame;
252 252
253 CodecInst codecInst_B; 253 auto codecInst_B = _acmB->SendCodec();
254 CodecInst dummy; 254 ASSERT_TRUE(codecInst_B);
255
256 EXPECT_EQ(0, _acmB->SendCodec(&codecInst_B));
257 255
258 // In the following loop we tests that the code can handle misuse of the APIs. 256 // In the following loop we tests that the code can handle misuse of the APIs.
259 // In the middle of a session with data flowing between two sides, called A 257 // In the middle of a session with data flowing between two sides, called A
260 // and B, APIs will be called, and the code should continue to run, and be 258 // and B, APIs will be called, and the code should continue to run, and be
261 // able to recover. 259 // able to recover.
262 while (!_inFileA.EndOfFile() && !_inFileB.EndOfFile()) { 260 while (!_inFileA.EndOfFile() && !_inFileB.EndOfFile()) {
263 msecPassed += 10; 261 msecPassed += 10;
264 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0); 262 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0);
265 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0); 263 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0);
266 EXPECT_GE(_acmRefA->Add10MsData(audioFrame), 0); 264 EXPECT_GE(_acmRefA->Add10MsData(audioFrame), 0);
(...skipping 11 matching lines...) Expand all
278 EXPECT_EQ(0, _acmRefB->PlayoutData10Ms(outFreqHzB, &audioFrame)); 276 EXPECT_EQ(0, _acmRefB->PlayoutData10Ms(outFreqHzB, &audioFrame));
279 _outFileRefB.Write10MsData(audioFrame); 277 _outFileRefB.Write10MsData(audioFrame);
280 278
281 // Update time counters each time a second of data has passed. 279 // Update time counters each time a second of data has passed.
282 if (msecPassed >= 1000) { 280 if (msecPassed >= 1000) {
283 msecPassed = 0; 281 msecPassed = 0;
284 secPassed++; 282 secPassed++;
285 } 283 }
286 // Re-register send codec on side B. 284 // Re-register send codec on side B.
287 if (((secPassed % 5) == 4) && (msecPassed >= 990)) { 285 if (((secPassed % 5) == 4) && (msecPassed >= 990)) {
288 EXPECT_EQ(0, _acmB->RegisterSendCodec(codecInst_B)); 286 EXPECT_EQ(0, _acmB->RegisterSendCodec(*codecInst_B));
289 EXPECT_EQ(0, _acmB->SendCodec(&dummy)); 287 EXPECT_TRUE(_acmB->SendCodec());
290 } 288 }
291 // Initialize receiver on side A. 289 // Initialize receiver on side A.
292 if (((secPassed % 7) == 6) && (msecPassed == 0)) 290 if (((secPassed % 7) == 6) && (msecPassed == 0))
293 EXPECT_EQ(0, _acmA->InitializeReceiver()); 291 EXPECT_EQ(0, _acmA->InitializeReceiver());
294 // Re-register codec on side A. 292 // Re-register codec on side A.
295 if (((secPassed % 7) == 6) && (msecPassed >= 990)) { 293 if (((secPassed % 7) == 6) && (msecPassed >= 990)) {
296 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(codecInst_B)); 294 EXPECT_EQ(0, _acmA->RegisterReceiveCodec(*codecInst_B));
297 } 295 }
298 } 296 }
299 } 297 }
300 298
301 } // namespace webrtc 299 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/test/TestVADDTX.cc ('k') | webrtc/modules/audio_coding/main/test/iSACTest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698