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

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

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 EventWrapper* myEvent = EventWrapper::Create(); 44 EventWrapper* myEvent = EventWrapper::Create();
45 myEvent->Wait(waitLengthMs); 45 myEvent->Wait(waitLengthMs);
46 delete myEvent; 46 delete myEvent;
47 return; 47 return;
48 } 48 }
49 } 49 }
50 50
51 APITest::APITest() 51 APITest::APITest()
52 : _acmA(AudioCodingModule::Create(1)), 52 : _acmA(AudioCodingModule::Create(1)),
53 _acmB(AudioCodingModule::Create(2)), 53 _acmB(AudioCodingModule::Create(2)),
54 _channel_A2B(NULL), 54 _channel_A2B(nullptr),
55 _channel_B2A(NULL), 55 _channel_B2A(nullptr),
56 _writeToFile(true), 56 _writeToFile(true),
57 _pullEventA(NULL), 57 _pullEventA(nullptr),
58 _pushEventA(NULL), 58 _pushEventA(nullptr),
59 _processEventA(NULL), 59 _processEventA(nullptr),
60 _apiEventA(NULL), 60 _apiEventA(nullptr),
61 _pullEventB(NULL), 61 _pullEventB(nullptr),
62 _pushEventB(NULL), 62 _pushEventB(nullptr),
63 _processEventB(NULL), 63 _processEventB(nullptr),
64 _apiEventB(NULL), 64 _apiEventB(nullptr),
65 _codecCntrA(0), 65 _codecCntrA(0),
66 _codecCntrB(0), 66 _codecCntrB(0),
67 _thereIsEncoderA(false), 67 _thereIsEncoderA(false),
68 _thereIsEncoderB(false), 68 _thereIsEncoderB(false),
69 _thereIsDecoderA(false), 69 _thereIsDecoderA(false),
70 _thereIsDecoderB(false), 70 _thereIsDecoderB(false),
71 _sendVADA(false), 71 _sendVADA(false),
72 _sendDTXA(false), 72 _sendDTXA(false),
73 _sendVADModeA(VADNormal), 73 _sendVADModeA(VADNormal),
74 _sendVADB(false), 74 _sendVADB(false),
75 _sendDTXB(false), 75 _sendDTXB(false),
76 _sendVADModeB(VADNormal), 76 _sendVADModeB(VADNormal),
77 _minDelayA(0), 77 _minDelayA(0),
78 _minDelayB(0), 78 _minDelayB(0),
79 _dotPositionA(0), 79 _dotPositionA(0),
80 _dotMoveDirectionA(1), 80 _dotMoveDirectionA(1),
81 _dotPositionB(39), 81 _dotPositionB(39),
82 _dotMoveDirectionB(-1), 82 _dotMoveDirectionB(-1),
83 _vadCallbackA(NULL), 83 _vadCallbackA(nullptr),
84 _vadCallbackB(NULL), 84 _vadCallbackB(nullptr),
85 _apiTestRWLock(*RWLockWrapper::CreateRWLock()), 85 _apiTestRWLock(*RWLockWrapper::CreateRWLock()),
86 _randomTest(false), 86 _randomTest(false),
87 _testNumA(0), 87 _testNumA(0),
88 _testNumB(1) { 88 _testNumB(1) {
89 int n; 89 int n;
90 for (n = 0; n < 32; n++) { 90 for (n = 0; n < 32; n++) {
91 _payloadUsed[n] = false; 91 _payloadUsed[n] = false;
92 } 92 }
93 93
94 _movingDot[40] = '\0'; 94 _movingDot[40] = '\0';
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 //Trace::SetEncryptedTraceFile("ACMAPITestEncrypted.txt"); 263 //Trace::SetEncryptedTraceFile("ACMAPITestEncrypted.txt");
264 264
265 char print[11]; 265 char print[11];
266 266
267 // Create a trace file. 267 // Create a trace file.
268 Trace::CreateTrace(); 268 Trace::CreateTrace();
269 Trace::SetTraceFile( 269 Trace::SetTraceFile(
270 (webrtc::test::OutputPath() + "acm_api_trace.txt").c_str()); 270 (webrtc::test::OutputPath() + "acm_api_trace.txt").c_str());
271 271
272 printf("\nRandom Test (y/n)?"); 272 printf("\nRandom Test (y/n)?");
273 EXPECT_TRUE(fgets(print, 10, stdin) != NULL); 273 EXPECT_TRUE(fgets(print, 10, stdin) != nullptr);
274 print[10] = '\0'; 274 print[10] = '\0';
275 if (strstr(print, "y") != NULL) { 275 if (strstr(print, "y") != nullptr) {
276 _randomTest = true; 276 _randomTest = true;
277 _verbose = false; 277 _verbose = false;
278 _writeToFile = false; 278 _writeToFile = false;
279 } else { 279 } else {
280 _randomTest = false; 280 _randomTest = false;
281 printf("\nPrint Tests (y/n)? "); 281 printf("\nPrint Tests (y/n)? ");
282 EXPECT_TRUE(fgets(print, 10, stdin) != NULL); 282 EXPECT_TRUE(fgets(print, 10, stdin) != nullptr);
283 print[10] = '\0'; 283 print[10] = '\0';
284 if (strstr(print, "y") == NULL) { 284 if (strstr(print, "y") == nullptr) {
285 EXPECT_TRUE(freopen("APITest_log.txt", "w", stdout) != 0); 285 EXPECT_TRUE(freopen("APITest_log.txt", "w", stdout) != 0);
286 _verbose = false; 286 _verbose = false;
287 } 287 }
288 } 288 }
289 289
290 _vadCallbackA = new VADCallback; 290 _vadCallbackA = new VADCallback;
291 _vadCallbackB = new VADCallback; 291 _vadCallbackB = new VADCallback;
292 292
293 return 0; 293 return 0;
294 } 294 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 596 }
597 597
598 void APITest::CheckVADStatus(char side) { 598 void APITest::CheckVADStatus(char side) {
599 599
600 bool dtxEnabled; 600 bool dtxEnabled;
601 bool vadEnabled; 601 bool vadEnabled;
602 ACMVADMode vadMode; 602 ACMVADMode vadMode;
603 603
604 if (side == 'A') { 604 if (side == 'A') {
605 _acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode); 605 _acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode);
606 _acmA->RegisterVADCallback(NULL); 606 _acmA->RegisterVADCallback(nullptr);
607 _vadCallbackA->Reset(); 607 _vadCallbackA->Reset();
608 _acmA->RegisterVADCallback(_vadCallbackA); 608 _acmA->RegisterVADCallback(_vadCallbackA);
609 609
610 if (!_randomTest) { 610 if (!_randomTest) {
611 if (_verbose) { 611 if (_verbose) {
612 fprintf(stdout, "DTX %3s, VAD %3s, Mode %d", dtxEnabled ? "ON" : "OFF", 612 fprintf(stdout, "DTX %3s, VAD %3s, Mode %d", dtxEnabled ? "ON" : "OFF",
613 vadEnabled ? "ON" : "OFF", (int) vadMode); 613 vadEnabled ? "ON" : "OFF", (int) vadMode);
614 Wait(5000); 614 Wait(5000);
615 fprintf(stdout, " => bit-rate %3.0f kbps\n", _channel_A2B->BitRate()); 615 fprintf(stdout, " => bit-rate %3.0f kbps\n", _channel_A2B->BitRate());
616 } else { 616 } else {
(...skipping 10 matching lines...) Expand all
627 } 627 }
628 if ((vadEnabled != _sendVADA) && (!dtxEnabled)) { 628 if ((vadEnabled != _sendVADA) && (!dtxEnabled)) {
629 fprintf(stderr, ">>> Error Enabling VAD <<<\n"); 629 fprintf(stderr, ">>> Error Enabling VAD <<<\n");
630 } 630 }
631 if ((vadMode != _sendVADModeA) && vadEnabled) { 631 if ((vadMode != _sendVADModeA) && vadEnabled) {
632 fprintf(stderr, ">>> Error setting VAD-mode <<<\n"); 632 fprintf(stderr, ">>> Error setting VAD-mode <<<\n");
633 } 633 }
634 } else { 634 } else {
635 _acmB->VAD(&dtxEnabled, &vadEnabled, &vadMode); 635 _acmB->VAD(&dtxEnabled, &vadEnabled, &vadMode);
636 636
637 _acmB->RegisterVADCallback(NULL); 637 _acmB->RegisterVADCallback(nullptr);
638 _vadCallbackB->Reset(); 638 _vadCallbackB->Reset();
639 _acmB->RegisterVADCallback(_vadCallbackB); 639 _acmB->RegisterVADCallback(_vadCallbackB);
640 640
641 if (!_randomTest) { 641 if (!_randomTest) {
642 if (_verbose) { 642 if (_verbose) {
643 fprintf(stdout, "DTX %3s, VAD %3s, Mode %d", dtxEnabled ? "ON" : "OFF", 643 fprintf(stdout, "DTX %3s, VAD %3s, Mode %d", dtxEnabled ? "ON" : "OFF",
644 vadEnabled ? "ON" : "OFF", (int) vadMode); 644 vadEnabled ? "ON" : "OFF", (int) vadMode);
645 Wait(5000); 645 Wait(5000);
646 fprintf(stdout, " => bit-rate %3.0f kbps\n", _channel_B2A->BitRate()); 646 fprintf(stdout, " => bit-rate %3.0f kbps\n", _channel_B2A->BitRate());
647 } else { 647 } else {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); 1106 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec));
1107 myChannel->ResetStats(); 1107 myChannel->ResetStats();
1108 { 1108 {
1109 WriteLockScoped wl(_apiTestRWLock); 1109 WriteLockScoped wl(_apiTestRWLock);
1110 *thereIsEncoder = true; 1110 *thereIsEncoder = true;
1111 } 1111 }
1112 Wait(500); 1112 Wait(500);
1113 } 1113 }
1114 1114
1115 } // namespace webrtc 1115 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698