From e313e0278315c918d1ae810f79e4b3f176d58659 Mon Sep 17 00:00:00 2001 From: solenberg Date: Tue, 8 Sep 2015 02:16:04 -0700 Subject: [PATCH] Remove unnecessary fields from VoE SharedData. BUG=webrtc:4690 Review URL: https://codereview.webrtc.org/1304933008 Cr-Commit-Position: refs/heads/master@{#9882} --- webrtc/voice_engine/shared_data.cc | 4 +- webrtc/voice_engine/shared_data.h | 7 --- webrtc/voice_engine/voe_base_impl.cc | 11 +---- webrtc/voice_engine/voe_file_impl.cc | 10 +---- webrtc/voice_engine/voe_hardware_impl.cc | 56 +++++++++++------------- 5 files changed, 31 insertions(+), 57 deletions(-) diff --git a/webrtc/voice_engine/shared_data.cc b/webrtc/voice_engine/shared_data.cc index ad00e038f6..754368b3d8 100644 --- a/webrtc/voice_engine/shared_data.cc +++ b/webrtc/voice_engine/shared_data.cc @@ -29,9 +29,7 @@ SharedData::SharedData(const Config& config) : _channelManager(_gInstanceCounter, config), _engineStatistics(_gInstanceCounter), _audioDevicePtr(NULL), - _moduleProcessThreadPtr(ProcessThread::Create()), - _externalRecording(false), - _externalPlayout(false) + _moduleProcessThreadPtr(ProcessThread::Create()) { Trace::CreateTrace(); if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0) diff --git a/webrtc/voice_engine/shared_data.h b/webrtc/voice_engine/shared_data.h index 3ab1d45ac5..311bfa063d 100644 --- a/webrtc/voice_engine/shared_data.h +++ b/webrtc/voice_engine/shared_data.h @@ -44,10 +44,6 @@ public: TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } OutputMixer* output_mixer() { return _outputMixerPtr; } CriticalSectionWrapper* crit_sec() { return _apiCritPtr; } - bool ext_recording() const { return _externalRecording; } - void set_ext_recording(bool value) { _externalRecording = value; } - bool ext_playout() const { return _externalPlayout; } - void set_ext_playout(bool value) { _externalPlayout = value; } ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } AudioDeviceModule::AudioLayer audio_device_layer() const { return _audioDeviceLayer; @@ -76,9 +72,6 @@ protected: rtc::scoped_ptr audioproc_; rtc::scoped_ptr _moduleProcessThreadPtr; - bool _externalRecording; - bool _externalPlayout; - AudioDeviceModule::AudioLayer _audioDeviceLayer; SharedData(const Config& config); diff --git a/webrtc/voice_engine/voe_base_impl.cc b/webrtc/voice_engine/voe_base_impl.cc index 1dc89e7ee1..94cd98f797 100644 --- a/webrtc/voice_engine/voe_base_impl.cc +++ b/webrtc/voice_engine/voe_base_impl.cc @@ -642,10 +642,7 @@ int32_t VoEBaseImpl::AddExternalTransportBuild(char* str) const { int VoEBaseImpl::LastError() { return (shared_->statistics().LastError()); } int32_t VoEBaseImpl::StartPlayout() { - if (shared_->audio_device()->Playing()) { - return 0; - } - if (!shared_->ext_playout()) { + if (!shared_->audio_device()->Playing()) { if (shared_->audio_device()->InitPlayout() != 0) { LOG_F(LS_ERROR) << "Failed to initialize playout"; return -1; @@ -671,10 +668,7 @@ int32_t VoEBaseImpl::StopPlayout() { } int32_t VoEBaseImpl::StartSend() { - if (shared_->audio_device()->Recording()) { - return 0; - } - if (!shared_->ext_recording()) { + if (!shared_->audio_device()->Recording()) { if (shared_->audio_device()->InitRecording() != 0) { LOG_F(LS_ERROR) << "Failed to initialize recording"; return -1; @@ -684,7 +678,6 @@ int32_t VoEBaseImpl::StartSend() { return -1; } } - return 0; } diff --git a/webrtc/voice_engine/voe_file_impl.cc b/webrtc/voice_engine/voe_file_impl.cc index 78613b03f5..bc9245fdf2 100644 --- a/webrtc/voice_engine/voe_file_impl.cc +++ b/webrtc/voice_engine/voe_file_impl.cc @@ -396,10 +396,7 @@ int VoEFileImpl::StartRecordingMicrophone(const char* fileNameUTF8, "StartRecordingMicrophone() failed to start recording"); return -1; } - if (_shared->audio_device()->Recording()) { - return 0; - } - if (!_shared->ext_recording()) { + if (!_shared->audio_device()->Recording()) { if (_shared->audio_device()->InitRecording() != 0) { WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), "StartRecordingMicrophone() failed to initialize recording"); @@ -429,10 +426,7 @@ int VoEFileImpl::StartRecordingMicrophone(OutStream* stream, "StartRecordingMicrophone() failed to start recording"); return -1; } - if (_shared->audio_device()->Recording()) { - return 0; - } - if (!_shared->ext_recording()) { + if (!_shared->audio_device()->Recording()) { if (_shared->audio_device()->InitRecording() != 0) { WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), "StartRecordingMicrophone() failed to initialize recording"); diff --git a/webrtc/voice_engine/voe_hardware_impl.cc b/webrtc/voice_engine/voe_hardware_impl.cc index bac08724c5..b4a39f37fc 100644 --- a/webrtc/voice_engine/voe_hardware_impl.cc +++ b/webrtc/voice_engine/voe_hardware_impl.cc @@ -357,21 +357,19 @@ int VoEHardwareImpl::SetRecordingDevice(int index, // Restore recording if it was enabled already when calling this function. if (isRecording) { - if (!_shared->ext_recording()) { - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetRecordingDevice() recording is now being restored..."); - if (_shared->audio_device()->InitRecording() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVoice, - VoEId(_shared->instance_id(), -1), - "SetRecordingDevice() failed to initialize recording"); - return -1; - } - if (_shared->audio_device()->StartRecording() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVoice, - VoEId(_shared->instance_id(), -1), - "SetRecordingDevice() failed to start recording"); - return -1; - } + WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetRecordingDevice() recording is now being restored..."); + if (_shared->audio_device()->InitRecording() != 0) { + WEBRTC_TRACE(kTraceError, kTraceVoice, + VoEId(_shared->instance_id(), -1), + "SetRecordingDevice() failed to initialize recording"); + return -1; + } + if (_shared->audio_device()->StartRecording() != 0) { + WEBRTC_TRACE(kTraceError, kTraceVoice, + VoEId(_shared->instance_id(), -1), + "SetRecordingDevice() failed to start recording"); + return -1; } } @@ -445,21 +443,19 @@ int VoEHardwareImpl::SetPlayoutDevice(int index) { // Restore playout if it was enabled already when calling this function. if (isPlaying) { - if (!_shared->ext_playout()) { - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), - "SetPlayoutDevice() playout is now being restored..."); - if (_shared->audio_device()->InitPlayout() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVoice, - VoEId(_shared->instance_id(), -1), - "SetPlayoutDevice() failed to initialize playout"); - return -1; - } - if (_shared->audio_device()->StartPlayout() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVoice, - VoEId(_shared->instance_id(), -1), - "SetPlayoutDevice() failed to start playout"); - return -1; - } + WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), + "SetPlayoutDevice() playout is now being restored..."); + if (_shared->audio_device()->InitPlayout() != 0) { + WEBRTC_TRACE(kTraceError, kTraceVoice, + VoEId(_shared->instance_id(), -1), + "SetPlayoutDevice() failed to initialize playout"); + return -1; + } + if (_shared->audio_device()->StartPlayout() != 0) { + WEBRTC_TRACE(kTraceError, kTraceVoice, + VoEId(_shared->instance_id(), -1), + "SetPlayoutDevice() failed to start playout"); + return -1; } }