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

Side by Side Diff: webrtc/voice_engine/transmit_mixer.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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 "module is shutdown"); 149 "module is shutdown");
150 } 150 }
151 } 151 }
152 152
153 int32_t 153 int32_t
154 TransmitMixer::Create(TransmitMixer*& mixer, uint32_t instanceId) 154 TransmitMixer::Create(TransmitMixer*& mixer, uint32_t instanceId)
155 { 155 {
156 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1), 156 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1),
157 "TransmitMixer::Create(instanceId=%d)", instanceId); 157 "TransmitMixer::Create(instanceId=%d)", instanceId);
158 mixer = new TransmitMixer(instanceId); 158 mixer = new TransmitMixer(instanceId);
159 if (mixer == NULL) 159 if (mixer == nullptr) {
160 { 160 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1),
161 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1), 161 "TransmitMixer::Create() unable to allocate memory"
162 "TransmitMixer::Create() unable to allocate memory" 162 "for mixer");
163 "for mixer"); 163 return -1;
164 return -1;
165 } 164 }
166 return 0; 165 return 0;
167 } 166 }
168 167
169 void 168 void
170 TransmitMixer::Destroy(TransmitMixer*& mixer) 169 TransmitMixer::Destroy(TransmitMixer*& mixer)
171 { 170 {
172 if (mixer) 171 if (mixer)
173 { 172 {
174 delete mixer; 173 delete mixer;
175 mixer = NULL; 174 mixer = nullptr;
176 } 175 }
177 } 176 }
178 177
179 TransmitMixer::TransmitMixer(uint32_t instanceId) : 178 TransmitMixer::TransmitMixer(uint32_t instanceId)
180 _engineStatisticsPtr(NULL), 179 : _engineStatisticsPtr(nullptr),
181 _channelManagerPtr(NULL), 180 _channelManagerPtr(nullptr),
182 audioproc_(NULL), 181 audioproc_(nullptr),
183 _voiceEngineObserverPtr(NULL), 182 _voiceEngineObserverPtr(nullptr),
184 _processThreadPtr(NULL), 183 _processThreadPtr(nullptr),
185 // Avoid conflict with other channels by adding 1024 - 1026, 184 // Avoid conflict with other channels by adding 1024 - 1026,
186 // won't use as much as 1024 channels. 185 // won't use as much as 1024 channels.
187 _filePlayerId(instanceId + 1024), 186 _filePlayerId(instanceId + 1024),
188 _fileRecorderId(instanceId + 1025), 187 _fileRecorderId(instanceId + 1025),
189 _fileCallRecorderId(instanceId + 1026), 188 _fileCallRecorderId(instanceId + 1026),
190 _filePlaying(false), 189 _filePlaying(false),
191 _fileRecording(false), 190 _fileRecording(false),
192 _fileCallRecording(false), 191 _fileCallRecording(false),
193 _audioLevel(), 192 _audioLevel(),
194 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 193 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
195 _typingNoiseWarningPending(false), 194 _typingNoiseWarningPending(false),
196 _typingNoiseDetected(false), 195 _typingNoiseDetected(false),
197 #endif 196 #endif
198 _saturationWarning(false), 197 _saturationWarning(false),
199 _instanceId(instanceId), 198 _instanceId(instanceId),
200 _mixFileWithMicrophone(false), 199 _mixFileWithMicrophone(false),
201 _captureLevel(0), 200 _captureLevel(0),
202 external_postproc_ptr_(NULL), 201 external_postproc_ptr_(nullptr),
203 external_preproc_ptr_(NULL), 202 external_preproc_ptr_(nullptr),
204 _mute(false), 203 _mute(false),
205 stereo_codec_(false), 204 stereo_codec_(false),
206 swap_stereo_channels_(false) 205 swap_stereo_channels_(false) {
207 {
208 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), 206 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1),
209 "TransmitMixer::TransmitMixer() - ctor"); 207 "TransmitMixer::TransmitMixer() - ctor");
210 } 208 }
211 209
212 TransmitMixer::~TransmitMixer() 210 TransmitMixer::~TransmitMixer()
213 { 211 {
214 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), 212 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1),
215 "TransmitMixer::~TransmitMixer() - dtor"); 213 "TransmitMixer::~TransmitMixer() - dtor");
216 _monitorModule.DeRegisterObserver(); 214 _monitorModule.DeRegisterObserver();
217 if (_processThreadPtr) 215 if (_processThreadPtr)
218 { 216 {
219 _processThreadPtr->DeRegisterModule(&_monitorModule); 217 _processThreadPtr->DeRegisterModule(&_monitorModule);
220 } 218 }
221 DeRegisterExternalMediaProcessing(kRecordingAllChannelsMixed); 219 DeRegisterExternalMediaProcessing(kRecordingAllChannelsMixed);
222 DeRegisterExternalMediaProcessing(kRecordingPreprocessing); 220 DeRegisterExternalMediaProcessing(kRecordingPreprocessing);
223 { 221 {
224 rtc::CritScope cs(&_critSect); 222 rtc::CritScope cs(&_critSect);
225 if (file_recorder_) { 223 if (file_recorder_) {
226 file_recorder_->RegisterModuleFileCallback(NULL); 224 file_recorder_->RegisterModuleFileCallback(nullptr);
227 file_recorder_->StopRecording(); 225 file_recorder_->StopRecording();
228 } 226 }
229 if (file_call_recorder_) { 227 if (file_call_recorder_) {
230 file_call_recorder_->RegisterModuleFileCallback(NULL); 228 file_call_recorder_->RegisterModuleFileCallback(nullptr);
231 file_call_recorder_->StopRecording(); 229 file_call_recorder_->StopRecording();
232 } 230 }
233 if (file_player_) { 231 if (file_player_) {
234 file_player_->RegisterModuleFileCallback(NULL); 232 file_player_->RegisterModuleFileCallback(nullptr);
235 file_player_->StopPlayingFile(); 233 file_player_->StopPlayingFile();
236 } 234 }
237 } 235 }
238 } 236 }
239 237
240 int32_t 238 int32_t
241 TransmitMixer::SetEngineInformation(ProcessThread& processThread, 239 TransmitMixer::SetEngineInformation(ProcessThread& processThread,
242 Statistics& engineStatistics, 240 Statistics& engineStatistics,
243 ChannelManager& channelManager) 241 ChannelManager& channelManager)
244 { 242 {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 _engineStatisticsPtr->SetLastError( 476 _engineStatisticsPtr->SetLastError(
479 VE_ALREADY_PLAYING, kTraceWarning, 477 VE_ALREADY_PLAYING, kTraceWarning,
480 "StartPlayingFileAsMicrophone() is already playing"); 478 "StartPlayingFileAsMicrophone() is already playing");
481 return 0; 479 return 0;
482 } 480 }
483 481
484 rtc::CritScope cs(&_critSect); 482 rtc::CritScope cs(&_critSect);
485 483
486 // Destroy the old instance 484 // Destroy the old instance
487 if (file_player_) { 485 if (file_player_) {
488 file_player_->RegisterModuleFileCallback(NULL); 486 file_player_->RegisterModuleFileCallback(nullptr);
489 file_player_.reset(); 487 file_player_.reset();
490 } 488 }
491 489
492 // Dynamically create the instance 490 // Dynamically create the instance
493 file_player_ = 491 file_player_ =
494 FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format); 492 FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
495 493
496 if (!file_player_) { 494 if (!file_player_) {
497 _engineStatisticsPtr->SetLastError( 495 _engineStatisticsPtr->SetLastError(
498 VE_INVALID_ARGUMENT, kTraceError, 496 VE_INVALID_ARGUMENT, kTraceError,
(...skipping 25 matching lines...) Expand all
524 int startPosition, 522 int startPosition,
525 float volumeScaling, 523 float volumeScaling,
526 int stopPosition, 524 int stopPosition,
527 const CodecInst* codecInst) 525 const CodecInst* codecInst)
528 { 526 {
529 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1), 527 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1),
530 "TransmitMixer::StartPlayingFileAsMicrophone(format=%d," 528 "TransmitMixer::StartPlayingFileAsMicrophone(format=%d,"
531 " volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)", 529 " volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)",
532 format, volumeScaling, startPosition, stopPosition); 530 format, volumeScaling, startPosition, stopPosition);
533 531
534 if (stream == NULL) 532 if (stream == nullptr) {
535 { 533 _engineStatisticsPtr->SetLastError(
536 _engineStatisticsPtr->SetLastError( 534 VE_BAD_FILE, kTraceError,
537 VE_BAD_FILE, kTraceError, 535 "StartPlayingFileAsMicrophone() null as input stream");
538 "StartPlayingFileAsMicrophone() NULL as input stream"); 536 return -1;
539 return -1;
540 } 537 }
541 538
542 if (_filePlaying) 539 if (_filePlaying)
543 { 540 {
544 _engineStatisticsPtr->SetLastError( 541 _engineStatisticsPtr->SetLastError(
545 VE_ALREADY_PLAYING, kTraceWarning, 542 VE_ALREADY_PLAYING, kTraceWarning,
546 "StartPlayingFileAsMicrophone() is already playing"); 543 "StartPlayingFileAsMicrophone() is already playing");
547 return 0; 544 return 0;
548 } 545 }
549 546
550 rtc::CritScope cs(&_critSect); 547 rtc::CritScope cs(&_critSect);
551 548
552 // Destroy the old instance 549 // Destroy the old instance
553 if (file_player_) { 550 if (file_player_) {
554 file_player_->RegisterModuleFileCallback(NULL); 551 file_player_->RegisterModuleFileCallback(nullptr);
555 file_player_.reset(); 552 file_player_.reset();
556 } 553 }
557 554
558 // Dynamically create the instance 555 // Dynamically create the instance
559 file_player_ = 556 file_player_ =
560 FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format); 557 FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
561 558
562 if (!file_player_) { 559 if (!file_player_) {
563 _engineStatisticsPtr->SetLastError( 560 _engineStatisticsPtr->SetLastError(
564 VE_INVALID_ARGUMENT, kTraceWarning, 561 VE_INVALID_ARGUMENT, kTraceWarning,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 593
597 rtc::CritScope cs(&_critSect); 594 rtc::CritScope cs(&_critSect);
598 595
599 if (file_player_->StopPlayingFile() != 0) { 596 if (file_player_->StopPlayingFile() != 0) {
600 _engineStatisticsPtr->SetLastError( 597 _engineStatisticsPtr->SetLastError(
601 VE_CANNOT_STOP_PLAYOUT, kTraceError, 598 VE_CANNOT_STOP_PLAYOUT, kTraceError,
602 "StopPlayingFile() couldnot stop playing file"); 599 "StopPlayingFile() couldnot stop playing file");
603 return -1; 600 return -1;
604 } 601 }
605 602
606 file_player_->RegisterModuleFileCallback(NULL); 603 file_player_->RegisterModuleFileCallback(nullptr);
607 file_player_.reset(); 604 file_player_.reset();
608 _filePlaying = false; 605 _filePlaying = false;
609 606
610 return 0; 607 return 0;
611 } 608 }
612 609
613 int TransmitMixer::IsPlayingFileAsMicrophone() const 610 int TransmitMixer::IsPlayingFileAsMicrophone() const
614 { 611 {
615 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), 612 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
616 "TransmitMixer::IsPlayingFileAsMicrophone()"); 613 "TransmitMixer::IsPlayingFileAsMicrophone()");
(...skipping 13 matching lines...) Expand all
630 { 627 {
631 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1), 628 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
632 "StartRecordingMicrophone() is already recording"); 629 "StartRecordingMicrophone() is already recording");
633 return 0; 630 return 0;
634 } 631 }
635 632
636 FileFormats format; 633 FileFormats format;
637 const uint32_t notificationTime(0); // Not supported in VoE 634 const uint32_t notificationTime(0); // Not supported in VoE
638 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 }; 635 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
639 636
640 if (codecInst != NULL && codecInst->channels > 2) 637 if (codecInst != nullptr && codecInst->channels > 2) {
641 { 638 _engineStatisticsPtr->SetLastError(
642 _engineStatisticsPtr->SetLastError( 639 VE_BAD_ARGUMENT, kTraceError,
643 VE_BAD_ARGUMENT, kTraceError, 640 "StartRecordingMicrophone() invalid compression");
644 "StartRecordingMicrophone() invalid compression"); 641 return (-1);
645 return (-1);
646 } 642 }
647 if (codecInst == NULL) 643 if (codecInst == nullptr) {
648 { 644 format = kFileFormatPcm16kHzFile;
649 format = kFileFormatPcm16kHzFile; 645 codecInst = &dummyCodec;
650 codecInst = &dummyCodec;
651 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) || 646 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
652 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) || 647 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
653 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0)) 648 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
654 { 649 {
655 format = kFileFormatWavFile; 650 format = kFileFormatWavFile;
656 } else 651 } else
657 { 652 {
658 format = kFileFormatCompressedFile; 653 format = kFileFormatCompressedFile;
659 } 654 }
660 655
661 // Destroy the old instance 656 // Destroy the old instance
662 if (file_recorder_) { 657 if (file_recorder_) {
663 file_recorder_->RegisterModuleFileCallback(NULL); 658 file_recorder_->RegisterModuleFileCallback(nullptr);
664 file_recorder_.reset(); 659 file_recorder_.reset();
665 } 660 }
666 661
667 file_recorder_ = FileRecorder::CreateFileRecorder( 662 file_recorder_ = FileRecorder::CreateFileRecorder(
668 _fileRecorderId, (const FileFormats)format); 663 _fileRecorderId, (const FileFormats)format);
669 if (!file_recorder_) { 664 if (!file_recorder_) {
670 _engineStatisticsPtr->SetLastError( 665 _engineStatisticsPtr->SetLastError(
671 VE_INVALID_ARGUMENT, kTraceError, 666 VE_INVALID_ARGUMENT, kTraceError,
672 "StartRecordingMicrophone() fileRecorder format isnot correct"); 667 "StartRecordingMicrophone() fileRecorder format isnot correct");
673 return -1; 668 return -1;
(...skipping 26 matching lines...) Expand all
700 { 695 {
701 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1), 696 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
702 "StartRecordingMicrophone() is already recording"); 697 "StartRecordingMicrophone() is already recording");
703 return 0; 698 return 0;
704 } 699 }
705 700
706 FileFormats format; 701 FileFormats format;
707 const uint32_t notificationTime(0); // Not supported in VoE 702 const uint32_t notificationTime(0); // Not supported in VoE
708 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 }; 703 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
709 704
710 if (codecInst != NULL && codecInst->channels != 1) 705 if (codecInst != nullptr && codecInst->channels != 1) {
711 { 706 _engineStatisticsPtr->SetLastError(
712 _engineStatisticsPtr->SetLastError( 707 VE_BAD_ARGUMENT, kTraceError,
713 VE_BAD_ARGUMENT, kTraceError, 708 "StartRecordingMicrophone() invalid compression");
714 "StartRecordingMicrophone() invalid compression"); 709 return (-1);
715 return (-1);
716 } 710 }
717 if (codecInst == NULL) 711 if (codecInst == nullptr) {
718 { 712 format = kFileFormatPcm16kHzFile;
719 format = kFileFormatPcm16kHzFile; 713 codecInst = &dummyCodec;
720 codecInst = &dummyCodec;
721 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) || 714 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
722 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) || 715 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
723 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0)) 716 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
724 { 717 {
725 format = kFileFormatWavFile; 718 format = kFileFormatWavFile;
726 } else 719 } else
727 { 720 {
728 format = kFileFormatCompressedFile; 721 format = kFileFormatCompressedFile;
729 } 722 }
730 723
731 // Destroy the old instance 724 // Destroy the old instance
732 if (file_recorder_) { 725 if (file_recorder_) {
733 file_recorder_->RegisterModuleFileCallback(NULL); 726 file_recorder_->RegisterModuleFileCallback(nullptr);
734 file_recorder_.reset(); 727 file_recorder_.reset();
735 } 728 }
736 729
737 file_recorder_ = FileRecorder::CreateFileRecorder( 730 file_recorder_ = FileRecorder::CreateFileRecorder(
738 _fileRecorderId, (const FileFormats)format); 731 _fileRecorderId, (const FileFormats)format);
739 if (!file_recorder_) { 732 if (!file_recorder_) {
740 _engineStatisticsPtr->SetLastError( 733 _engineStatisticsPtr->SetLastError(
741 VE_INVALID_ARGUMENT, kTraceError, 734 VE_INVALID_ARGUMENT, kTraceError,
742 "StartRecordingMicrophone() fileRecorder format isnot correct"); 735 "StartRecordingMicrophone() fileRecorder format isnot correct");
743 return -1; 736 return -1;
(...skipping 29 matching lines...) Expand all
773 "StopRecordingMicrophone() isnot recording"); 766 "StopRecordingMicrophone() isnot recording");
774 return 0; 767 return 0;
775 } 768 }
776 769
777 if (file_recorder_->StopRecording() != 0) { 770 if (file_recorder_->StopRecording() != 0) {
778 _engineStatisticsPtr->SetLastError( 771 _engineStatisticsPtr->SetLastError(
779 VE_STOP_RECORDING_FAILED, kTraceError, 772 VE_STOP_RECORDING_FAILED, kTraceError,
780 "StopRecording(), could not stop recording"); 773 "StopRecording(), could not stop recording");
781 return -1; 774 return -1;
782 } 775 }
783 file_recorder_->RegisterModuleFileCallback(NULL); 776 file_recorder_->RegisterModuleFileCallback(nullptr);
784 file_recorder_.reset(); 777 file_recorder_.reset();
785 _fileRecording = false; 778 _fileRecording = false;
786 779
787 return 0; 780 return 0;
788 } 781 }
789 782
790 int TransmitMixer::StartRecordingCall(const char* fileName, 783 int TransmitMixer::StartRecordingCall(const char* fileName,
791 const CodecInst* codecInst) 784 const CodecInst* codecInst)
792 { 785 {
793 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), 786 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
794 "TransmitMixer::StartRecordingCall(fileName=%s)", fileName); 787 "TransmitMixer::StartRecordingCall(fileName=%s)", fileName);
795 788
796 if (_fileCallRecording) 789 if (_fileCallRecording)
797 { 790 {
798 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1), 791 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
799 "StartRecordingCall() is already recording"); 792 "StartRecordingCall() is already recording");
800 return 0; 793 return 0;
801 } 794 }
802 795
803 FileFormats format; 796 FileFormats format;
804 const uint32_t notificationTime(0); // Not supported in VoE 797 const uint32_t notificationTime(0); // Not supported in VoE
805 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 }; 798 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
806 799
807 if (codecInst != NULL && codecInst->channels != 1) 800 if (codecInst != nullptr && codecInst->channels != 1) {
808 { 801 _engineStatisticsPtr->SetLastError(
809 _engineStatisticsPtr->SetLastError( 802 VE_BAD_ARGUMENT, kTraceError,
810 VE_BAD_ARGUMENT, kTraceError, 803 "StartRecordingCall() invalid compression");
811 "StartRecordingCall() invalid compression"); 804 return (-1);
812 return (-1);
813 } 805 }
814 if (codecInst == NULL) 806 if (codecInst == nullptr) {
815 { 807 format = kFileFormatPcm16kHzFile;
816 format = kFileFormatPcm16kHzFile; 808 codecInst = &dummyCodec;
817 codecInst = &dummyCodec;
818 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) || 809 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
819 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) || 810 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
820 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0)) 811 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
821 { 812 {
822 format = kFileFormatWavFile; 813 format = kFileFormatWavFile;
823 } else 814 } else
824 { 815 {
825 format = kFileFormatCompressedFile; 816 format = kFileFormatCompressedFile;
826 } 817 }
827 818
828 rtc::CritScope cs(&_critSect); 819 rtc::CritScope cs(&_critSect);
829 820
830 // Destroy the old instance 821 // Destroy the old instance
831 if (file_call_recorder_) { 822 if (file_call_recorder_) {
832 file_call_recorder_->RegisterModuleFileCallback(NULL); 823 file_call_recorder_->RegisterModuleFileCallback(nullptr);
833 file_call_recorder_.reset(); 824 file_call_recorder_.reset();
834 } 825 }
835 826
836 file_call_recorder_ = FileRecorder::CreateFileRecorder( 827 file_call_recorder_ = FileRecorder::CreateFileRecorder(
837 _fileCallRecorderId, (const FileFormats)format); 828 _fileCallRecorderId, (const FileFormats)format);
838 if (!file_call_recorder_) { 829 if (!file_call_recorder_) {
839 _engineStatisticsPtr->SetLastError( 830 _engineStatisticsPtr->SetLastError(
840 VE_INVALID_ARGUMENT, kTraceError, 831 VE_INVALID_ARGUMENT, kTraceError,
841 "StartRecordingCall() fileRecorder format isnot correct"); 832 "StartRecordingCall() fileRecorder format isnot correct");
842 return -1; 833 return -1;
(...skipping 24 matching lines...) Expand all
867 { 858 {
868 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1), 859 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
869 "StartRecordingCall() is already recording"); 860 "StartRecordingCall() is already recording");
870 return 0; 861 return 0;
871 } 862 }
872 863
873 FileFormats format; 864 FileFormats format;
874 const uint32_t notificationTime(0); // Not supported in VoE 865 const uint32_t notificationTime(0); // Not supported in VoE
875 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 }; 866 CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
876 867
877 if (codecInst != NULL && codecInst->channels != 1) 868 if (codecInst != nullptr && codecInst->channels != 1) {
878 { 869 _engineStatisticsPtr->SetLastError(
879 _engineStatisticsPtr->SetLastError( 870 VE_BAD_ARGUMENT, kTraceError,
880 VE_BAD_ARGUMENT, kTraceError, 871 "StartRecordingCall() invalid compression");
881 "StartRecordingCall() invalid compression"); 872 return (-1);
882 return (-1);
883 } 873 }
884 if (codecInst == NULL) 874 if (codecInst == nullptr) {
885 { 875 format = kFileFormatPcm16kHzFile;
886 format = kFileFormatPcm16kHzFile; 876 codecInst = &dummyCodec;
887 codecInst = &dummyCodec;
888 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) || 877 } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
889 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) || 878 (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
890 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0)) 879 (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
891 { 880 {
892 format = kFileFormatWavFile; 881 format = kFileFormatWavFile;
893 } else 882 } else
894 { 883 {
895 format = kFileFormatCompressedFile; 884 format = kFileFormatCompressedFile;
896 } 885 }
897 886
898 rtc::CritScope cs(&_critSect); 887 rtc::CritScope cs(&_critSect);
899 888
900 // Destroy the old instance 889 // Destroy the old instance
901 if (file_call_recorder_) { 890 if (file_call_recorder_) {
902 file_call_recorder_->RegisterModuleFileCallback(NULL); 891 file_call_recorder_->RegisterModuleFileCallback(nullptr);
903 file_call_recorder_.reset(); 892 file_call_recorder_.reset();
904 } 893 }
905 894
906 file_call_recorder_ = FileRecorder::CreateFileRecorder( 895 file_call_recorder_ = FileRecorder::CreateFileRecorder(
907 _fileCallRecorderId, (const FileFormats)format); 896 _fileCallRecorderId, (const FileFormats)format);
908 if (!file_call_recorder_) { 897 if (!file_call_recorder_) {
909 _engineStatisticsPtr->SetLastError( 898 _engineStatisticsPtr->SetLastError(
910 VE_INVALID_ARGUMENT, kTraceError, 899 VE_INVALID_ARGUMENT, kTraceError,
911 "StartRecordingCall() fileRecorder format isnot correct"); 900 "StartRecordingCall() fileRecorder format isnot correct");
912 return -1; 901 return -1;
(...skipping 29 matching lines...) Expand all
942 931
943 rtc::CritScope cs(&_critSect); 932 rtc::CritScope cs(&_critSect);
944 933
945 if (file_call_recorder_->StopRecording() != 0) { 934 if (file_call_recorder_->StopRecording() != 0) {
946 _engineStatisticsPtr->SetLastError( 935 _engineStatisticsPtr->SetLastError(
947 VE_STOP_RECORDING_FAILED, kTraceError, 936 VE_STOP_RECORDING_FAILED, kTraceError,
948 "StopRecording(), could not stop recording"); 937 "StopRecording(), could not stop recording");
949 return -1; 938 return -1;
950 } 939 }
951 940
952 file_call_recorder_->RegisterModuleFileCallback(NULL); 941 file_call_recorder_->RegisterModuleFileCallback(nullptr);
953 file_call_recorder_.reset(); 942 file_call_recorder_.reset();
954 _fileCallRecording = false; 943 _fileCallRecording = false;
955 944
956 return 0; 945 return 0;
957 } 946 }
958 947
959 void 948 void
960 TransmitMixer::SetMixWithMicStatus(bool mix) 949 TransmitMixer::SetMixWithMicStatus(bool mix)
961 { 950 {
962 _mixFileWithMicrophone = mix; 951 _mixFileWithMicrophone = mix;
(...skipping 20 matching lines...) Expand all
983 } 972 }
984 return 0; 973 return 0;
985 } 974 }
986 975
987 int TransmitMixer::DeRegisterExternalMediaProcessing(ProcessingTypes type) { 976 int TransmitMixer::DeRegisterExternalMediaProcessing(ProcessingTypes type) {
988 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), 977 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
989 "TransmitMixer::DeRegisterExternalMediaProcessing()"); 978 "TransmitMixer::DeRegisterExternalMediaProcessing()");
990 979
991 rtc::CritScope cs(&_callbackCritSect); 980 rtc::CritScope cs(&_callbackCritSect);
992 if (type == kRecordingAllChannelsMixed) { 981 if (type == kRecordingAllChannelsMixed) {
993 external_postproc_ptr_ = NULL; 982 external_postproc_ptr_ = nullptr;
994 } else if (type == kRecordingPreprocessing) { 983 } else if (type == kRecordingPreprocessing) {
995 external_preproc_ptr_ = NULL; 984 external_preproc_ptr_ = nullptr;
996 } else { 985 } else {
997 return -1; 986 return -1;
998 } 987 }
999 return 0; 988 return 0;
1000 } 989 }
1001 990
1002 int 991 int
1003 TransmitMixer::SetMute(bool enable) 992 TransmitMixer::SetMute(bool enable)
1004 { 993 {
1005 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), 994 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { 1217 void TransmitMixer::EnableStereoChannelSwapping(bool enable) {
1229 swap_stereo_channels_ = enable; 1218 swap_stereo_channels_ = enable;
1230 } 1219 }
1231 1220
1232 bool TransmitMixer::IsStereoChannelSwappingEnabled() { 1221 bool TransmitMixer::IsStereoChannelSwappingEnabled() {
1233 return swap_stereo_channels_; 1222 return swap_stereo_channels_;
1234 } 1223 }
1235 1224
1236 } // namespace voe 1225 } // namespace voe
1237 } // namespace webrtc 1226 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698