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

Unified Diff: webrtc/voice_engine/channel.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 side-by-side diff with in-line comments
Download patch
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index a9cf2b26dc8edea51bb8d56b57d13a52275e58b2..db5b2169b29b41c1284cb98a36d48dd29073a12a 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -460,7 +460,7 @@ bool Channel::SendRtp(const uint8_t* data,
rtc::CritScope cs(&_callbackCritSect);
- if (_transportPtr == NULL) {
+ if (_transportPtr == nullptr) {
WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::SendPacket() failed to send RTP packet due to"
" invalid transport object");
@@ -486,7 +486,7 @@ bool Channel::SendRtcp(const uint8_t* data, size_t len) {
"Channel::SendRtcp(len=%" PRIuS ")", len);
rtc::CritScope cs(&_callbackCritSect);
- if (_transportPtr == NULL) {
+ if (_transportPtr == nullptr) {
WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::SendRtcp() failed to send RTCP packet"
" due to invalid transport object");
@@ -589,8 +589,8 @@ int32_t Channel::OnReceivedPayloadData(const uint8_t* payloadData,
}
int64_t round_trip_time = 0;
- _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), &round_trip_time, NULL, NULL,
- NULL);
+ _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), &round_trip_time, nullptr, nullptr,
+ nullptr);
std::vector<uint16_t> nack_list = audio_coding_->GetNackList(round_trip_time);
if (!nack_list.empty()) {
@@ -826,7 +826,7 @@ int32_t Channel::CreateChannel(
instanceId);
channel = new Channel(channelId, instanceId, config);
- if (channel == NULL) {
+ if (channel == nullptr) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
"Channel::CreateChannel() unable to allocate memory for"
" channel");
@@ -908,8 +908,8 @@ Channel::Channel(int32_t channelId,
_outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026),
_outputFileRecording(false),
_outputExternalMedia(false),
- _inputExternalMediaCallbackPtr(NULL),
- _outputExternalMediaCallbackPtr(NULL),
+ _inputExternalMediaCallbackPtr(nullptr),
+ _outputExternalMediaCallbackPtr(nullptr),
_timeStamp(0), // This is just an offset, RTP module will add it's own
// random offset
ntp_estimator_(Clock::GetRealTimeClock()),
@@ -921,14 +921,14 @@ Channel::Channel(int32_t channelId,
rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()),
capture_start_rtp_time_stamp_(-1),
capture_start_ntp_time_ms_(-1),
- _engineStatisticsPtr(NULL),
- _outputMixerPtr(NULL),
- _transmitMixerPtr(NULL),
- _moduleProcessThreadPtr(NULL),
- _audioDeviceModulePtr(NULL),
- _voiceEngineObserverPtr(NULL),
- _callbackCritSectPtr(NULL),
- _transportPtr(NULL),
+ _engineStatisticsPtr(nullptr),
+ _outputMixerPtr(nullptr),
+ _transmitMixerPtr(nullptr),
+ _moduleProcessThreadPtr(nullptr),
+ _audioDeviceModulePtr(nullptr),
+ _voiceEngineObserverPtr(nullptr),
+ _callbackCritSectPtr(nullptr),
+ _transportPtr(nullptr),
_sendFrameType(0),
_externalMixing(false),
_mixFileWithMicrophone(false),
@@ -988,7 +988,7 @@ Channel::Channel(int32_t channelId,
}
Channel::~Channel() {
- rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL);
+ rtp_receive_statistics_->RegisterRtcpStatisticsCallback(nullptr);
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::~Channel() - dtor");
@@ -1004,15 +1004,15 @@ Channel::~Channel() {
{
rtc::CritScope cs(&_fileCritSect);
if (input_file_player_) {
- input_file_player_->RegisterModuleFileCallback(NULL);
+ input_file_player_->RegisterModuleFileCallback(nullptr);
input_file_player_->StopPlayingFile();
}
if (output_file_player_) {
- output_file_player_->RegisterModuleFileCallback(NULL);
+ output_file_player_->RegisterModuleFileCallback(nullptr);
output_file_player_->StopPlayingFile();
}
if (output_file_recorder_) {
- output_file_recorder_->RegisterModuleFileCallback(NULL);
+ output_file_recorder_->RegisterModuleFileCallback(nullptr);
output_file_recorder_->StopRecording();
}
}
@@ -1021,12 +1021,12 @@ Channel::~Channel() {
// 1. De-register callbacks in modules
// 2. De-register modules in process thread
// 3. Destroy modules
- if (audio_coding_->RegisterTransportCallback(NULL) == -1) {
+ if (audio_coding_->RegisterTransportCallback(nullptr) == -1) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
"~Channel() failed to de-register transport callback"
" (Audio coding module)");
}
- if (audio_coding_->RegisterVADCallback(NULL) == -1) {
+ if (audio_coding_->RegisterVADCallback(nullptr) == -1) {
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
"~Channel() failed to de-register VAD callback"
" (Audio coding module)");
@@ -1045,7 +1045,8 @@ int32_t Channel::Init() {
// --- Initial sanity
- if ((_engineStatisticsPtr == NULL) || (_moduleProcessThreadPtr == NULL)) {
+ if ((_engineStatisticsPtr == nullptr) ||
+ (_moduleProcessThreadPtr == nullptr)) {
WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Init() must call SetEngineInformation() first");
return -1;
@@ -1311,7 +1312,7 @@ int32_t Channel::DeRegisterVoiceEngineObserver() {
"DeRegisterVoiceEngineObserver() observer already disabled");
return 0;
}
- _voiceEngineObserverPtr = NULL;
+ _voiceEngineObserverPtr = nullptr;
return 0;
}
@@ -1630,7 +1631,7 @@ int32_t Channel::DeRegisterExternalTransport() {
"disabled");
}
_externalTransport = false;
- _transportPtr = NULL;
+ _transportPtr = nullptr;
return 0;
}
@@ -1728,7 +1729,8 @@ bool Channel::IsPacketRetransmitted(const RTPHeader& header,
return false;
// Check if this is a retransmission.
int64_t min_rtt = 0;
- _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL);
+ _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), nullptr, nullptr, &min_rtt,
+ nullptr);
return !in_order && statistician->IsRetransmitOfOldPacket(header, min_rtt);
}
@@ -1769,7 +1771,7 @@ int32_t Channel::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
uint32_t ntp_frac = 0;
uint32_t rtp_timestamp = 0;
if (0 !=
- _rtpRtcpModule->RemoteNTP(&ntp_secs, &ntp_frac, NULL, NULL,
+ _rtpRtcpModule->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr,
&rtp_timestamp)) {
// Waiting for RTCP.
return 0;
@@ -1807,7 +1809,7 @@ int Channel::StartPlayingFileLocally(const char* fileName,
rtc::CritScope cs(&_fileCritSect);
if (output_file_player_) {
- output_file_player_->RegisterModuleFileCallback(NULL);
+ output_file_player_->RegisterModuleFileCallback(nullptr);
output_file_player_.reset();
}
@@ -1854,10 +1856,10 @@ int Channel::StartPlayingFileLocally(InStream* stream,
" volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)",
format, volumeScaling, startPosition, stopPosition);
- if (stream == NULL) {
+ if (stream == nullptr) {
_engineStatisticsPtr->SetLastError(
VE_BAD_FILE, kTraceError,
- "StartPlayingFileLocally() NULL as input stream");
+ "StartPlayingFileLocally() null as input stream");
return -1;
}
@@ -1873,7 +1875,7 @@ int Channel::StartPlayingFileLocally(InStream* stream,
// Destroy the old instance
if (output_file_player_) {
- output_file_player_->RegisterModuleFileCallback(NULL);
+ output_file_player_->RegisterModuleFileCallback(nullptr);
output_file_player_.reset();
}
@@ -1927,7 +1929,7 @@ int Channel::StopPlayingFileLocally() {
"StopPlayingFile() could not stop playing");
return -1;
}
- output_file_player_->RegisterModuleFileCallback(NULL);
+ output_file_player_->RegisterModuleFileCallback(nullptr);
output_file_player_.reset();
channel_state_.SetOutputFilePlaying(false);
}
@@ -2001,7 +2003,7 @@ int Channel::StartPlayingFileAsMicrophone(const char* fileName,
// Destroy the old instance
if (input_file_player_) {
- input_file_player_->RegisterModuleFileCallback(NULL);
+ input_file_player_->RegisterModuleFileCallback(nullptr);
input_file_player_.reset();
}
@@ -2045,10 +2047,10 @@ int Channel::StartPlayingFileAsMicrophone(InStream* stream,
"volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)",
format, volumeScaling, startPosition, stopPosition);
- if (stream == NULL) {
+ if (stream == nullptr) {
_engineStatisticsPtr->SetLastError(
VE_BAD_FILE, kTraceError,
- "StartPlayingFileAsMicrophone NULL as input stream");
+ "StartPlayingFileAsMicrophone null as input stream");
return -1;
}
@@ -2063,7 +2065,7 @@ int Channel::StartPlayingFileAsMicrophone(InStream* stream,
// Destroy the old instance
if (input_file_player_) {
- input_file_player_->RegisterModuleFileCallback(NULL);
+ input_file_player_->RegisterModuleFileCallback(nullptr);
input_file_player_.reset();
}
@@ -2113,7 +2115,7 @@ int Channel::StopPlayingFileAsMicrophone() {
"StopPlayingFile() could not stop playing");
return -1;
}
- input_file_player_->RegisterModuleFileCallback(NULL);
+ input_file_player_->RegisterModuleFileCallback(nullptr);
input_file_player_.reset();
channel_state_.SetInputFilePlaying(false);
@@ -2139,14 +2141,14 @@ int Channel::StartRecordingPlayout(const char* fileName,
const uint32_t notificationTime(0); // Not supported in VoE
CodecInst dummyCodec = {100, "L16", 16000, 320, 1, 320000};
- if ((codecInst != NULL) &&
+ if ((codecInst != nullptr) &&
((codecInst->channels < 1) || (codecInst->channels > 2))) {
_engineStatisticsPtr->SetLastError(
VE_BAD_ARGUMENT, kTraceError,
"StartRecordingPlayout() invalid compression");
return (-1);
}
- if (codecInst == NULL) {
+ if (codecInst == nullptr) {
format = kFileFormatPcm16kHzFile;
codecInst = &dummyCodec;
} else if ((STR_CASE_CMP(codecInst->plname, "L16") == 0) ||
@@ -2161,7 +2163,7 @@ int Channel::StartRecordingPlayout(const char* fileName,
// Destroy the old instance
if (output_file_recorder_) {
- output_file_recorder_->RegisterModuleFileCallback(NULL);
+ output_file_recorder_->RegisterModuleFileCallback(nullptr);
output_file_recorder_.reset();
}
@@ -2204,13 +2206,13 @@ int Channel::StartRecordingPlayout(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) {
+ if (codecInst != nullptr && codecInst->channels != 1) {
_engineStatisticsPtr->SetLastError(
VE_BAD_ARGUMENT, kTraceError,
"StartRecordingPlayout() invalid compression");
return (-1);
}
- if (codecInst == NULL) {
+ if (codecInst == nullptr) {
format = kFileFormatPcm16kHzFile;
codecInst = &dummyCodec;
} else if ((STR_CASE_CMP(codecInst->plname, "L16") == 0) ||
@@ -2225,7 +2227,7 @@ int Channel::StartRecordingPlayout(OutStream* stream,
// Destroy the old instance
if (output_file_recorder_) {
- output_file_recorder_->RegisterModuleFileCallback(NULL);
+ output_file_recorder_->RegisterModuleFileCallback(nullptr);
output_file_recorder_.reset();
}
@@ -2272,7 +2274,7 @@ int Channel::StopRecordingPlayout() {
"StopRecording() could not stop recording");
return (-1);
}
- output_file_recorder_->RegisterModuleFileCallback(NULL);
+ output_file_recorder_->RegisterModuleFileCallback(nullptr);
output_file_recorder_.reset();
_outputFileRecording = false;
@@ -2500,7 +2502,7 @@ int Channel::SetRTCP_CNAME(const char cName[256]) {
}
int Channel::GetRemoteRTCP_CNAME(char cName[256]) {
- if (cName == NULL) {
+ if (cName == nullptr) {
_engineStatisticsPtr->SetLastError(
VE_INVALID_ARGUMENT, kTraceError,
"GetRemoteRTCP_CNAME() invalid CNAME input buffer");
@@ -2547,7 +2549,7 @@ int Channel::GetRemoteRTCPData(unsigned int& NTPHigh,
// has been received)
playoutTimestamp = playout_timestamp_rtcp_;
- if (NULL != jitter || NULL != fractionLost) {
+ if (nullptr != jitter || nullptr != fractionLost) {
// Get all RTCP receiver report blocks that have been received on this
// channel. If we receive RTP packets from a remote source we know the
// remote SSRC and use the report block from him.
@@ -2600,7 +2602,7 @@ int Channel::SendApplicationDefinedRTCPPacket(
"SendApplicationDefinedRTCPPacket() not sending");
return -1;
}
- if (NULL == data) {
+ if (nullptr == data) {
_engineStatisticsPtr->SetLastError(
VE_INVALID_ARGUMENT, kTraceError,
"SendApplicationDefinedRTCPPacket() invalid data value");
@@ -2664,7 +2666,7 @@ int Channel::GetRTPStatistics(unsigned int& averageJitterMs,
int Channel::GetRemoteRTCPReportBlocks(
std::vector<ReportBlock>* report_blocks) {
- if (report_blocks == NULL) {
+ if (report_blocks == nullptr) {
_engineStatisticsPtr->SetLastError(
VE_INVALID_ARGUMENT, kTraceError,
"GetRemoteRTCPReportBlock()s invalid report_blocks.");
@@ -2894,7 +2896,7 @@ void Channel::DisassociateSendChannel(int channel_id) {
if (channel && channel->ChannelId() == channel_id) {
// If this channel is associated with a send channel of the specified
// Channel ID, disassociate with it.
- ChannelOwner ref(NULL);
+ ChannelOwner ref(nullptr);
associate_send_channel_ = ref;
}
}
@@ -2972,7 +2974,7 @@ int Channel::DeRegisterExternalMediaProcessing(ProcessingTypes type) {
return 0;
}
_outputExternalMedia = false;
- _outputExternalMediaCallbackPtr = NULL;
+ _outputExternalMediaCallbackPtr = nullptr;
} else if (kRecordingPerChannel == type) {
if (!_inputExternalMediaCallbackPtr) {
_engineStatisticsPtr->SetLastError(
@@ -2982,7 +2984,7 @@ int Channel::DeRegisterExternalMediaProcessing(ProcessingTypes type) {
return 0;
}
channel_state_.SetInputExternalMedia(false);
- _inputExternalMediaCallbackPtr = NULL;
+ _inputExternalMediaCallbackPtr = nullptr;
}
return 0;

Powered by Google App Engine
This is Rietveld 408576698