This patch fixes the converity warnings in voice engine.
Review URL: https://webrtc-codereview.appspot.com/373017 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1579 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
91c630851a
commit
79af734807
@ -5366,16 +5366,20 @@ Channel::GetRemoteRTCPData(
|
||||
remoteSSRC = it->remoteSSRC;
|
||||
}
|
||||
|
||||
*jitter = it->jitter;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId, _channelId),
|
||||
"GetRemoteRTCPData() => jitter = %lu", *jitter);
|
||||
if (jitter) {
|
||||
*jitter = it->jitter;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId, _channelId),
|
||||
"GetRemoteRTCPData() => jitter = %lu", *jitter);
|
||||
}
|
||||
|
||||
*fractionLost = it->fractionLost;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId, _channelId),
|
||||
"GetRemoteRTCPData() => fractionLost = %lu",
|
||||
*fractionLost);
|
||||
if (fractionLost) {
|
||||
*fractionLost = it->fractionLost;
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId, _channelId),
|
||||
"GetRemoteRTCPData() => fractionLost = %lu",
|
||||
*fractionLost);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -201,7 +201,7 @@ void ChannelManagerBase::GetItemIds(WebRtc_Word32* channelsArray,
|
||||
MapItem* it = _items.First();
|
||||
numOfChannels = (numOfChannels <= _items.Size()) ?
|
||||
numOfChannels : _items.Size();
|
||||
for (int i = 0; i < numOfChannels; i++)
|
||||
for (int i = 0; i < numOfChannels && it != NULL; i++)
|
||||
{
|
||||
channelsArray[i] = it->GetId();
|
||||
it = _items.Next(it);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -393,7 +393,8 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm)
|
||||
|
||||
// Register the ADM to the process thread, which will drive the error
|
||||
// callback mechanism
|
||||
if (_moduleProcessThreadPtr->RegisterModule(_audioDevicePtr) != 0)
|
||||
if (_moduleProcessThreadPtr &&
|
||||
_moduleProcessThreadPtr->RegisterModule(_audioDevicePtr) != 0)
|
||||
{
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
kTraceError,
|
||||
@ -407,10 +408,20 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm)
|
||||
// Reinitialize the ADM
|
||||
|
||||
// Register the AudioObserver implementation
|
||||
_audioDevicePtr->RegisterEventObserver(this);
|
||||
if (_audioDevicePtr->RegisterEventObserver(this) != 0) {
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
kTraceWarning,
|
||||
"Init() failed to register event observer "
|
||||
"for the ADM");
|
||||
}
|
||||
|
||||
// Register the AudioTransport implementation
|
||||
_audioDevicePtr->RegisterAudioCallback(this);
|
||||
if (_audioDevicePtr->RegisterAudioCallback(this) != 0) {
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
kTraceWarning,
|
||||
"Init() failed to register audio callback "
|
||||
"for the ADM");
|
||||
}
|
||||
|
||||
// ADM initialization
|
||||
if (_audioDevicePtr->Init() != 0)
|
||||
@ -472,7 +483,11 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm)
|
||||
}
|
||||
|
||||
// Set number of channels
|
||||
_audioDevicePtr->StereoPlayoutIsAvailable(&available);
|
||||
if (_audioDevicePtr->StereoPlayoutIsAvailable(&available) != 0) {
|
||||
_engineStatistics.SetLastError(VE_SOUNDCARD_ERROR, kTraceWarning,
|
||||
"Init() failed to query stereo playout "
|
||||
"mode");
|
||||
}
|
||||
if (_audioDevicePtr->SetStereoPlayout(available) != 0)
|
||||
{
|
||||
_engineStatistics.SetLastError(VE_SOUNDCARD_ERROR, kTraceWarning,
|
||||
@ -1626,8 +1641,18 @@ WebRtc_Word32 VoEBaseImpl::TerminateInternal()
|
||||
"TerminateInternal() failed to stop "
|
||||
"recording");
|
||||
}
|
||||
_audioDevicePtr->RegisterEventObserver(NULL);
|
||||
_audioDevicePtr->RegisterAudioCallback(NULL);
|
||||
if (_audioDevicePtr->RegisterEventObserver(NULL) != 0) {
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
kTraceWarning,
|
||||
"TerminateInternal() failed to de-"
|
||||
"register event observer for the ADM");
|
||||
}
|
||||
if (_audioDevicePtr->RegisterAudioCallback(NULL) != 0) {
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
kTraceWarning,
|
||||
"TerminateInternal() failed to de-"
|
||||
"register audio callback for the ADM");
|
||||
}
|
||||
if (_audioDevicePtr->Terminate() != 0)
|
||||
{
|
||||
_engineStatistics.SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -270,7 +270,11 @@ int VoEExternalMediaImpl::ExternalRecordingInsertData(
|
||||
if (!_externalPlayout)
|
||||
{
|
||||
// Use real playout delay if external playout is not enabled.
|
||||
_audioDevicePtr->PlayoutDelay(&playoutDelayMS);
|
||||
if (_audioDevicePtr->PlayoutDelay(&playoutDelayMS) != 0) {
|
||||
_engineStatistics.SetLastError(
|
||||
VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning,
|
||||
"PlayoutDelay() unable to get the playout delay");
|
||||
}
|
||||
totalDelayMS = current_delay_ms + playoutDelayMS;
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -397,8 +397,11 @@ int VoEHardwareImpl::SetRecordingDevice(int index,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Cannot return error because of sanity above
|
||||
_audioDevicePtr->RecordingChannel(&recCh);
|
||||
if (_audioDevicePtr->SetRecordingChannel(recCh) != 0) {
|
||||
_engineStatistics.SetLastError(
|
||||
VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning,
|
||||
"SetRecordingChannel() unable to set the recording channel");
|
||||
}
|
||||
|
||||
// Map indices to unsigned since underlying functions need that
|
||||
WebRtc_UWord16 indexU = static_cast<WebRtc_UWord16> (index);
|
||||
@ -438,7 +441,12 @@ int VoEHardwareImpl::SetRecordingDevice(int index,
|
||||
|
||||
// Set number of channels
|
||||
bool available(false);
|
||||
_audioDevicePtr->StereoRecordingIsAvailable(&available);
|
||||
if (_audioDevicePtr->StereoRecordingIsAvailable(&available) != 0) {
|
||||
_engineStatistics.SetLastError(
|
||||
VE_SOUNDCARD_ERROR, kTraceWarning,
|
||||
"StereoRecordingIsAvailable() failed to query stereo recording");
|
||||
}
|
||||
|
||||
if (_audioDevicePtr->SetStereoRecording(available ? true : false) != 0)
|
||||
{
|
||||
_engineStatistics.SetLastError(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -290,6 +290,7 @@ int VoENetworkImpl::GetLocalIP(char ipAddr[64], bool ipv6)
|
||||
_engineStatistics.SetLastError(
|
||||
VE_INVALID_IP_ADDRESS, kTraceError,
|
||||
"GetLocalIP() failed to retrieve local IP - 1");
|
||||
UdpTransport::Destroy(socketPtr);
|
||||
return -1;
|
||||
}
|
||||
// Convert 128-bit address to character string (a:b:c:d:e:f:g:h)
|
||||
@ -310,6 +311,7 @@ int VoENetworkImpl::GetLocalIP(char ipAddr[64], bool ipv6)
|
||||
_engineStatistics.SetLastError(
|
||||
VE_INVALID_IP_ADDRESS, kTraceError,
|
||||
"GetLocalIP() failed to retrieve local IP - 2");
|
||||
UdpTransport::Destroy(socketPtr);
|
||||
return -1;
|
||||
}
|
||||
// Convert 32-bit address to character string (x.y.z.w)
|
||||
|
Loading…
Reference in New Issue
Block a user