| Index: webrtc/voice_engine/transmit_mixer.cc
|
| diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc
|
| index c7a09df5bc64ea0d1c8b60c705188872e1ffaeaf..464e24fcb1fe90d1cd4793fe720f2d241002a527 100644
|
| --- a/webrtc/voice_engine/transmit_mixer.cc
|
| +++ b/webrtc/voice_engine/transmit_mixer.cc
|
| @@ -156,12 +156,11 @@ TransmitMixer::Create(TransmitMixer*& mixer, uint32_t instanceId)
|
| WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1),
|
| "TransmitMixer::Create(instanceId=%d)", instanceId);
|
| mixer = new TransmitMixer(instanceId);
|
| - if (mixer == NULL)
|
| - {
|
| - WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1),
|
| - "TransmitMixer::Create() unable to allocate memory"
|
| - "for mixer");
|
| - return -1;
|
| + if (mixer == nullptr) {
|
| + WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, -1),
|
| + "TransmitMixer::Create() unable to allocate memory"
|
| + "for mixer");
|
| + return -1;
|
| }
|
| return 0;
|
| }
|
| @@ -172,39 +171,38 @@ TransmitMixer::Destroy(TransmitMixer*& mixer)
|
| if (mixer)
|
| {
|
| delete mixer;
|
| - mixer = NULL;
|
| + mixer = nullptr;
|
| }
|
| }
|
|
|
| -TransmitMixer::TransmitMixer(uint32_t instanceId) :
|
| - _engineStatisticsPtr(NULL),
|
| - _channelManagerPtr(NULL),
|
| - audioproc_(NULL),
|
| - _voiceEngineObserverPtr(NULL),
|
| - _processThreadPtr(NULL),
|
| - // Avoid conflict with other channels by adding 1024 - 1026,
|
| - // won't use as much as 1024 channels.
|
| - _filePlayerId(instanceId + 1024),
|
| - _fileRecorderId(instanceId + 1025),
|
| - _fileCallRecorderId(instanceId + 1026),
|
| - _filePlaying(false),
|
| - _fileRecording(false),
|
| - _fileCallRecording(false),
|
| - _audioLevel(),
|
| +TransmitMixer::TransmitMixer(uint32_t instanceId)
|
| + : _engineStatisticsPtr(nullptr),
|
| + _channelManagerPtr(nullptr),
|
| + audioproc_(nullptr),
|
| + _voiceEngineObserverPtr(nullptr),
|
| + _processThreadPtr(nullptr),
|
| + // Avoid conflict with other channels by adding 1024 - 1026,
|
| + // won't use as much as 1024 channels.
|
| + _filePlayerId(instanceId + 1024),
|
| + _fileRecorderId(instanceId + 1025),
|
| + _fileCallRecorderId(instanceId + 1026),
|
| + _filePlaying(false),
|
| + _fileRecording(false),
|
| + _fileCallRecording(false),
|
| + _audioLevel(),
|
| #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
| - _typingNoiseWarningPending(false),
|
| - _typingNoiseDetected(false),
|
| + _typingNoiseWarningPending(false),
|
| + _typingNoiseDetected(false),
|
| #endif
|
| - _saturationWarning(false),
|
| - _instanceId(instanceId),
|
| - _mixFileWithMicrophone(false),
|
| - _captureLevel(0),
|
| - external_postproc_ptr_(NULL),
|
| - external_preproc_ptr_(NULL),
|
| - _mute(false),
|
| - stereo_codec_(false),
|
| - swap_stereo_channels_(false)
|
| -{
|
| + _saturationWarning(false),
|
| + _instanceId(instanceId),
|
| + _mixFileWithMicrophone(false),
|
| + _captureLevel(0),
|
| + external_postproc_ptr_(nullptr),
|
| + external_preproc_ptr_(nullptr),
|
| + _mute(false),
|
| + stereo_codec_(false),
|
| + swap_stereo_channels_(false) {
|
| WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1),
|
| "TransmitMixer::TransmitMixer() - ctor");
|
| }
|
| @@ -223,15 +221,15 @@ TransmitMixer::~TransmitMixer()
|
| {
|
| rtc::CritScope cs(&_critSect);
|
| if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_recorder_->StopRecording();
|
| }
|
| if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_call_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_call_recorder_->StopRecording();
|
| }
|
| if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| + file_player_->RegisterModuleFileCallback(nullptr);
|
| file_player_->StopPlayingFile();
|
| }
|
| }
|
| @@ -485,7 +483,7 @@ int TransmitMixer::StartPlayingFileAsMicrophone(const char* fileName,
|
|
|
| // Destroy the old instance
|
| if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| + file_player_->RegisterModuleFileCallback(nullptr);
|
| file_player_.reset();
|
| }
|
|
|
| @@ -531,12 +529,11 @@ int TransmitMixer::StartPlayingFileAsMicrophone(InStream* stream,
|
| " volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)",
|
| format, volumeScaling, startPosition, stopPosition);
|
|
|
| - if (stream == NULL)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartPlayingFileAsMicrophone() NULL as input stream");
|
| - return -1;
|
| + if (stream == nullptr) {
|
| + _engineStatisticsPtr->SetLastError(
|
| + VE_BAD_FILE, kTraceError,
|
| + "StartPlayingFileAsMicrophone() null as input stream");
|
| + return -1;
|
| }
|
|
|
| if (_filePlaying)
|
| @@ -551,7 +548,7 @@ int TransmitMixer::StartPlayingFileAsMicrophone(InStream* stream,
|
|
|
| // Destroy the old instance
|
| if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| + file_player_->RegisterModuleFileCallback(nullptr);
|
| file_player_.reset();
|
| }
|
|
|
| @@ -603,7 +600,7 @@ int TransmitMixer::StopPlayingFileAsMicrophone()
|
| return -1;
|
| }
|
|
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| + file_player_->RegisterModuleFileCallback(nullptr);
|
| file_player_.reset();
|
| _filePlaying = false;
|
|
|
| @@ -637,17 +634,15 @@ int TransmitMixer::StartRecordingMicrophone(const char* fileName,
|
| const uint32_t notificationTime(0); // Not supported in VoE
|
| CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
|
|
| - if (codecInst != NULL && codecInst->channels > 2)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() invalid compression");
|
| - return (-1);
|
| + if (codecInst != nullptr && codecInst->channels > 2) {
|
| + _engineStatisticsPtr->SetLastError(
|
| + VE_BAD_ARGUMENT, kTraceError,
|
| + "StartRecordingMicrophone() invalid compression");
|
| + return (-1);
|
| }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| + if (codecInst == nullptr) {
|
| + format = kFileFormatPcm16kHzFile;
|
| + codecInst = &dummyCodec;
|
| } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| @@ -660,7 +655,7 @@ int TransmitMixer::StartRecordingMicrophone(const char* fileName,
|
|
|
| // Destroy the old instance
|
| if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_recorder_.reset();
|
| }
|
|
|
| @@ -707,17 +702,15 @@ int TransmitMixer::StartRecordingMicrophone(OutStream* stream,
|
| const uint32_t notificationTime(0); // Not supported in VoE
|
| CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
|
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() invalid compression");
|
| - return (-1);
|
| + if (codecInst != nullptr && codecInst->channels != 1) {
|
| + _engineStatisticsPtr->SetLastError(
|
| + VE_BAD_ARGUMENT, kTraceError,
|
| + "StartRecordingMicrophone() invalid compression");
|
| + return (-1);
|
| }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| + if (codecInst == nullptr) {
|
| + format = kFileFormatPcm16kHzFile;
|
| + codecInst = &dummyCodec;
|
| } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| @@ -730,7 +723,7 @@ int TransmitMixer::StartRecordingMicrophone(OutStream* stream,
|
|
|
| // Destroy the old instance
|
| if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_recorder_.reset();
|
| }
|
|
|
| @@ -780,7 +773,7 @@ int TransmitMixer::StopRecordingMicrophone()
|
| "StopRecording(), could not stop recording");
|
| return -1;
|
| }
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_recorder_.reset();
|
| _fileRecording = false;
|
|
|
| @@ -804,17 +797,15 @@ int TransmitMixer::StartRecordingCall(const char* fileName,
|
| const uint32_t notificationTime(0); // Not supported in VoE
|
| CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
|
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() invalid compression");
|
| - return (-1);
|
| + if (codecInst != nullptr && codecInst->channels != 1) {
|
| + _engineStatisticsPtr->SetLastError(
|
| + VE_BAD_ARGUMENT, kTraceError,
|
| + "StartRecordingCall() invalid compression");
|
| + return (-1);
|
| }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| + if (codecInst == nullptr) {
|
| + format = kFileFormatPcm16kHzFile;
|
| + codecInst = &dummyCodec;
|
| } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| @@ -829,7 +820,7 @@ int TransmitMixer::StartRecordingCall(const char* fileName,
|
|
|
| // Destroy the old instance
|
| if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_call_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_call_recorder_.reset();
|
| }
|
|
|
| @@ -874,17 +865,15 @@ int TransmitMixer::StartRecordingCall(OutStream* stream,
|
| const uint32_t notificationTime(0); // Not supported in VoE
|
| CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
|
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() invalid compression");
|
| - return (-1);
|
| + if (codecInst != nullptr && codecInst->channels != 1) {
|
| + _engineStatisticsPtr->SetLastError(
|
| + VE_BAD_ARGUMENT, kTraceError,
|
| + "StartRecordingCall() invalid compression");
|
| + return (-1);
|
| }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| + if (codecInst == nullptr) {
|
| + format = kFileFormatPcm16kHzFile;
|
| + codecInst = &dummyCodec;
|
| } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| @@ -899,7 +888,7 @@ int TransmitMixer::StartRecordingCall(OutStream* stream,
|
|
|
| // Destroy the old instance
|
| if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_call_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_call_recorder_.reset();
|
| }
|
|
|
| @@ -949,7 +938,7 @@ int TransmitMixer::StopRecordingCall()
|
| return -1;
|
| }
|
|
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| + file_call_recorder_->RegisterModuleFileCallback(nullptr);
|
| file_call_recorder_.reset();
|
| _fileCallRecording = false;
|
|
|
| @@ -990,9 +979,9 @@ int TransmitMixer::DeRegisterExternalMediaProcessing(ProcessingTypes type) {
|
|
|
| rtc::CritScope cs(&_callbackCritSect);
|
| if (type == kRecordingAllChannelsMixed) {
|
| - external_postproc_ptr_ = NULL;
|
| + external_postproc_ptr_ = nullptr;
|
| } else if (type == kRecordingPreprocessing) {
|
| - external_preproc_ptr_ = NULL;
|
| + external_preproc_ptr_ = nullptr;
|
| } else {
|
| return -1;
|
| }
|
|
|