From 22963abffe4179e75f18a2e7be1d1c58c9518089 Mon Sep 17 00:00:00 2001 From: "xians@google.com" Date: Wed, 3 Aug 2011 12:40:23 +0000 Subject: [PATCH] Removing the "initialized after" warnings. This CL tweat the order of the initialization in the constructor to adapt to the order of declaration of the members. Review URL: http://webrtc-codereview.appspot.com/99002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@294 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/voice_engine/main/source/channel.cc | 92 +++++++++---------- src/voice_engine/main/source/channel.h | 2 +- src/voice_engine/main/source/dtmf_inband.cc | 10 +- .../main/source/monitor_module.cc | 2 +- src/voice_engine/main/source/output_mixer.cc | 12 +-- src/voice_engine/main/source/shared_data.cc | 2 +- src/voice_engine/main/source/statistics.cc | 4 +- .../main/source/transmit_mixer.cc | 27 +++--- 8 files changed, 74 insertions(+), 77 deletions(-) diff --git a/src/voice_engine/main/source/channel.cc b/src/voice_engine/main/source/channel.cc index 608f744e5..190c2201a 100644 --- a/src/voice_engine/main/source/channel.cc +++ b/src/voice_engine/main/source/channel.cc @@ -1070,22 +1070,15 @@ Channel::Channel(const WebRtc_Word32 channelId, _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), _transmitCritSect(*CriticalSectionWrapper::CreateCriticalSection()), - _channelId(channelId), _instanceId(instanceId), - _playing(false), - _sending(false), - _receiving(false), - _mixFileWithMicrophone(false), - _timeStamp(0), // This is just an offset, RTP module will add it's own random offset + _channelId(channelId), _rtpRtcpModule(*RtpRtcp::CreateRtpRtcp(VoEModuleId( - instanceId, channelId), true)), + instanceId, channelId), true)), _audioCodingModule(*AudioCodingModule::Create( - VoEModuleId(instanceId, channelId))), + VoEModuleId(instanceId, channelId))), #ifndef WEBRTC_EXTERNAL_TRANSPORT - _socketTransportModule( - *UdpTransport::Create( - VoEModuleId(instanceId, channelId), - numSocketThreads)), + _socketTransportModule(*UdpTransport::Create( + VoEModuleId(instanceId, channelId), numSocketThreads)), #endif #ifdef WEBRTC_SRTP _srtpModule(*SrtpModule::CreateSrtpModule(VoEModuleId(instanceId, @@ -1093,30 +1086,9 @@ Channel::Channel(const WebRtc_Word32 channelId, #endif _rtpDumpIn(*RtpDump::CreateRtpDump()), _rtpDumpOut(*RtpDump::CreateRtpDump()), - _transportPtr(NULL), - _encryptionPtr(NULL), - _rxAudioProcessingModulePtr(NULL), -#ifdef WEBRTC_DTMF_DETECTION - _telephoneEventDetectionPtr(NULL), -#endif - _rxVadObserverPtr(NULL), - _oldVadDecision(-1), - _sendFrameType(0), _outputAudioLevel(), - _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), - _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), - _encrypting(false), - _decrypting(false), - _encryptionRTPBufferPtr(NULL), - _decryptionRTPBufferPtr(NULL), - _encryptionRTCPBufferPtr(NULL), - _decryptionRTCPBufferPtr(NULL), _externalTransport(false), - _engineStatisticsPtr(NULL), - _moduleProcessThreadPtr(NULL), - _audioDeviceModulePtr(NULL), - _voiceEngineObserverPtr(NULL), - _callbackCritSectPtr(NULL), + _audioLevel_dBov(100), _inputFilePlayerPtr(NULL), _outputFilePlayerPtr(NULL), _outputFileRecorderPtr(NULL), @@ -1128,34 +1100,62 @@ Channel::Channel(const WebRtc_Word32 channelId, _inputFilePlaying(false), _outputFilePlaying(false), _outputFileRecording(false), - _outputExternalMedia(false), + _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), + _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), _inputExternalMedia(false), + _outputExternalMedia(false), _inputExternalMediaCallbackPtr(NULL), _outputExternalMediaCallbackPtr(NULL), + _encryptionRTPBufferPtr(NULL), + _decryptionRTPBufferPtr(NULL), + _encryptionRTCPBufferPtr(NULL), + _decryptionRTCPBufferPtr(NULL), + _timeStamp(0), // This is just an offset, RTP module will add it's own random offset + _sendTelephoneEventPayloadType(106), + _playoutTimeStampRTP(0), + _playoutTimeStampRTCP(0), + _numberOfDiscardedPackets(0), + _engineStatisticsPtr(NULL), + _moduleProcessThreadPtr(NULL), + _audioDeviceModulePtr(NULL), + _voiceEngineObserverPtr(NULL), + _callbackCritSectPtr(NULL), + _transportPtr(NULL), + _encryptionPtr(NULL), + _rxAudioProcessingModulePtr(NULL), +#ifdef WEBRTC_DTMF_DETECTION + _telephoneEventDetectionPtr(NULL), +#endif + _rxVadObserverPtr(NULL), + _oldVadDecision(-1), + _sendFrameType(0), _rtpObserverPtr(NULL), _rtcpObserverPtr(NULL), + _outputIsOnHold(false), + _externalPlayout(false), + _inputIsOnHold(false), + _playing(false), + _sending(false), + _receiving(false), + _mixFileWithMicrophone(false), + _rtpObserver(false), + _rtcpObserver(false), _mute(false), _panLeft(1.0f), _panRight(1.0f), _outputGain(1.0f), + _encrypting(false), + _decrypting(false), _playOutbandDtmfEvent(false), _playInbandDtmfEvent(false), - _sendTelephoneEventPayloadType(106), _inbandTelephoneEventDetection(false), _outOfBandTelephoneEventDetecion(false), - _rtpObserver(false), - _rtcpObserver(false), - _playoutTimeStampRTP(0), - _playoutTimeStampRTCP(0), - _numberOfDiscardedPackets(0), _extraPayloadType(0), _insertExtraRTPPacket(false), _extraMarkerBit(false), _lastLocalTimeStamp(0), _lastPayloadType(0), - _outputIsOnHold(false), - _externalPlayout(false), - _inputIsOnHold(false), + _includeAudioLevelIndication(false), _rtpPacketTimedOut(false), _rtpPacketTimeOutIsEnabled(false), _rtpTimeOutSeconds(0), @@ -1171,9 +1171,7 @@ Channel::Channel(const WebRtc_Word32 channelId, _RxVadDetection(false), _rxApmIsEnabled(false), _rxAgcIsEnabled(false), - _rxNsIsEnabled(false), - _audioLevel_dBov(100), - _includeAudioLevelIndication(false) + _rxNsIsEnabled(false) { WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), "Channel::Channel() - ctor"); diff --git a/src/voice_engine/main/source/channel.h b/src/voice_engine/main/source/channel.h index aface12e9..95cfd6341 100644 --- a/src/voice_engine/main/source/channel.h +++ b/src/voice_engine/main/source/channel.h @@ -584,8 +584,8 @@ private: bool _outputFileRecording; DtmfInbandQueue _inbandDtmfQueue; DtmfInband _inbandDtmfGenerator; - bool _outputExternalMedia; bool _inputExternalMedia; + bool _outputExternalMedia; VoEMediaProcess* _inputExternalMediaCallbackPtr; VoEMediaProcess* _outputExternalMediaCallbackPtr; WebRtc_UWord8* _encryptionRTPBufferPtr; diff --git a/src/voice_engine/main/source/dtmf_inband.cc b/src/voice_engine/main/source/dtmf_inband.cc index 44505c93f..473af1038 100644 --- a/src/voice_engine/main/source/dtmf_inband.cc +++ b/src/voice_engine/main/source/dtmf_inband.cc @@ -65,17 +65,17 @@ const WebRtc_Word16 Dtmf_dBm0kHz[37]= DtmfInband::DtmfInband(const WebRtc_Word32 id) : - _id(id), _critSect(*CriticalSectionWrapper::CreateCriticalSection()), + _id(id), _outputFrequencyHz(8000), - _reinit(true), - _remainingSamples(0), _frameLengthSamples(0), + _remainingSamples(0), _eventCode(0), _attenuationDb(0), + _lengthMs(0), + _reinit(true), _playing(false), - _delaySinceLastToneMS(1000), - _lengthMs(0) + _delaySinceLastToneMS(1000) { memset(_oldOutputLow, 0, sizeof(_oldOutputLow)); memset(_oldOutputHigh, 0, sizeof(_oldOutputHigh)); diff --git a/src/voice_engine/main/source/monitor_module.cc b/src/voice_engine/main/source/monitor_module.cc index 834264e3f..6314f386c 100644 --- a/src/voice_engine/main/source/monitor_module.cc +++ b/src/voice_engine/main/source/monitor_module.cc @@ -16,8 +16,8 @@ namespace webrtc { namespace voe { MonitorModule::MonitorModule() : - _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), _observerPtr(NULL), + _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), _lastProcessTime(GET_TIME_IN_MS()) { } diff --git a/src/voice_engine/main/source/output_mixer.cc b/src/voice_engine/main/source/output_mixer.cc index a701ad9e9..f3ec5327e 100644 --- a/src/voice_engine/main/source/output_mixer.cc +++ b/src/voice_engine/main/source/output_mixer.cc @@ -120,18 +120,18 @@ OutputMixer::Create(OutputMixer*& mixer, const WebRtc_UWord32 instanceId) OutputMixer::OutputMixer(const WebRtc_UWord32 instanceId) : _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), - _instanceId(instanceId), - _outputFileRecorderPtr(NULL), - _outputFileRecording(false), - _dtmfGenerator(instanceId), _mixerModule(*AudioConferenceMixer:: CreateAudioConferenceMixer(instanceId)), - _externalMediaCallbackPtr(NULL), _audioLevel(), + _dtmfGenerator(instanceId), + _instanceId(instanceId), + _externalMediaCallbackPtr(NULL), _externalMedia(false), _panLeft(1.0f), _panRight(1.0f), - _mixingFrequencyHz(8000) + _mixingFrequencyHz(8000), + _outputFileRecorderPtr(NULL), + _outputFileRecording(false) { WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,-1), "OutputMixer::OutputMixer() - ctor"); diff --git a/src/voice_engine/main/source/shared_data.cc b/src/voice_engine/main/source/shared_data.cc index 81b360c4d..ddb257e47 100644 --- a/src/voice_engine/main/source/shared_data.cc +++ b/src/voice_engine/main/source/shared_data.cc @@ -25,13 +25,13 @@ static WebRtc_Word32 _gInstanceCounter = 0; SharedData::SharedData() : _instanceId(++_gInstanceCounter), + _apiCritPtr(CriticalSectionWrapper::CreateCriticalSection()), _channelManager(_gInstanceCounter), _engineStatistics(_gInstanceCounter), _usingExternalAudioDevice(false), _audioDevicePtr(NULL), _audioProcessingModulePtr(NULL), _moduleProcessThreadPtr(ProcessThread::CreateProcessThread()), - _apiCritPtr(CriticalSectionWrapper::CreateCriticalSection()), _externalRecording(false), _externalPlayout(false) { diff --git a/src/voice_engine/main/source/statistics.cc b/src/voice_engine/main/source/statistics.cc index eabf9a0a5..a5340300c 100644 --- a/src/voice_engine/main/source/statistics.cc +++ b/src/voice_engine/main/source/statistics.cc @@ -23,8 +23,8 @@ namespace voe { Statistics::Statistics(const WebRtc_UWord32 instanceId) : _critPtr(CriticalSectionWrapper::CreateCriticalSection()), _instanceId(instanceId), - _isInitialized(false), - _lastError(0) + _lastError(0), + _isInitialized(false) { } diff --git a/src/voice_engine/main/source/transmit_mixer.cc b/src/voice_engine/main/source/transmit_mixer.cc index d135f4415..00c0d0188 100644 --- a/src/voice_engine/main/source/transmit_mixer.cc +++ b/src/voice_engine/main/source/transmit_mixer.cc @@ -162,18 +162,11 @@ TransmitMixer::Destroy(TransmitMixer*& mixer) } TransmitMixer::TransmitMixer(const WebRtc_UWord32 instanceId) : - _instanceId(instanceId), _engineStatisticsPtr(NULL), _channelManagerPtr(NULL), _audioProcessingModulePtr(NULL), - _critSect(*CriticalSectionWrapper::CreateCriticalSection()), - _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), - -#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION - _timeActive(0), - _penaltyCounter(0), - _typingNoiseWarning(0), -#endif + _voiceEngineObserverPtr(NULL), + _processThreadPtr(NULL), _filePlayerPtr(NULL), _fileRecorderPtr(NULL), _fileCallRecorderPtr(NULL), @@ -185,18 +178,24 @@ TransmitMixer::TransmitMixer(const WebRtc_UWord32 instanceId) : _filePlaying(false), _fileRecording(false), _fileCallRecording(false), + _audioLevel(), + _critSect(*CriticalSectionWrapper::CreateCriticalSection()), + _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), +#ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION + _timeActive(0), + _penaltyCounter(0), + _typingNoiseWarning(0), +#endif + _saturationWarning(0), + _noiseWarning(0), + _instanceId(instanceId), _mixFileWithMicrophone(false), _captureLevel(0), - _audioLevel(), _externalMedia(false), _externalMediaCallbackPtr(NULL), _mute(false), _remainingMuteMicTimeMs(0), _mixingFrequency(0), - _voiceEngineObserverPtr(NULL), - _processThreadPtr(NULL), - _saturationWarning(0), - _noiseWarning(0), _includeAudioLevelIndication(false), _audioLevel_dBov(100) {