From 43a85f03435f92306e3626fdc00352bbdd0d21a0 Mon Sep 17 00:00:00 2001 From: saza Date: Tue, 18 Jul 2017 04:12:29 -0700 Subject: [PATCH] Patch set 1: Run a script to replace occurrences of WEBRTC_TRACE logging with the new style, on webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc. Patch set 2: - Manually fix log lines not handled by the script - Adjust some lines, to conform with code style - Update the included headers - Remove the now unused object ID variables - - This explains why there's so many files edited BUG=webrtc:5118 TBR=henrika@webrtc.org Review-Url: https://codereview.webrtc.org/2978083002 Cr-Commit-Position: refs/heads/master@{#19071} --- .../modules/audio_device/audio_device_impl.cc | 6 +- .../linux/audio_device_alsa_linux.cc | 3 +- .../linux/audio_device_alsa_linux.h | 2 +- .../linux/audio_device_pulse_linux.cc | 4 +- .../linux/audio_device_pulse_linux.h | 3 +- .../linux/audio_mixer_manager_alsa_linux.cc | 472 +++++++----------- .../linux/audio_mixer_manager_alsa_linux.h | 3 +- .../linux/audio_mixer_manager_pulse_linux.cc | 229 ++++----- .../linux/audio_mixer_manager_pulse_linux.h | 3 +- .../linux/latebindingsymboltable_linux.cc | 14 +- 10 files changed, 285 insertions(+), 454 deletions(-) diff --git a/webrtc/modules/audio_device/audio_device_impl.cc b/webrtc/modules/audio_device/audio_device_impl.cc index 1731c38716..58d58d3d03 100644 --- a/webrtc/modules/audio_device/audio_device_impl.cc +++ b/webrtc/modules/audio_device/audio_device_impl.cc @@ -257,7 +257,7 @@ int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() { LOG(INFO) << "attempting to use the Linux PulseAudio APIs..."; // create *Linux PulseAudio* implementation - AudioDeviceLinuxPulse* pulseDevice = new AudioDeviceLinuxPulse(Id()); + AudioDeviceLinuxPulse* pulseDevice = new AudioDeviceLinuxPulse(); if (pulseDevice->Init() == AudioDeviceGeneric::InitStatus::OK) { ptrAudioDevice = pulseDevice; LOG(INFO) << "Linux PulseAudio APIs will be utilized"; @@ -266,7 +266,7 @@ int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() { #endif #if defined(LINUX_ALSA) // create *Linux ALSA Audio* implementation - ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); + ptrAudioDevice = new AudioDeviceLinuxALSA(); if (ptrAudioDevice != NULL) { // Pulse Audio was not supported => revert to ALSA instead _platformAudioLayer = @@ -281,7 +281,7 @@ int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() { } else if (audioLayer == kLinuxAlsaAudio) { #if defined(LINUX_ALSA) // create *Linux ALSA Audio* implementation - ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); + ptrAudioDevice = new AudioDeviceLinuxALSA(); LOG(INFO) << "Linux ALSA APIs will be utilized"; #endif } diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc index 4d0dbada2f..ffa7dc5fdf 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc @@ -58,9 +58,8 @@ static const unsigned int ALSA_CAPTURE_WAIT_TIMEOUT = 5; // in ms #define FUNC_GET_DEVICE_NAME 1 #define FUNC_GET_DEVICE_NAME_FOR_AN_ENUM 2 -AudioDeviceLinuxALSA::AudioDeviceLinuxALSA(const int32_t id) : +AudioDeviceLinuxALSA::AudioDeviceLinuxALSA() : _ptrAudioBuffer(NULL), - _mixerManager(id), _inputDeviceIndex(0), _outputDeviceIndex(0), _inputDeviceIsSpecified(false), diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h index 6cda100bec..7e07ed82d6 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.h @@ -33,7 +33,7 @@ class EventWrapper; class AudioDeviceLinuxALSA : public AudioDeviceGeneric { public: - AudioDeviceLinuxALSA(const int32_t id); + AudioDeviceLinuxALSA(); virtual ~AudioDeviceLinuxALSA(); // Retrieve the currently utilized audio layer diff --git a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc index 88fbb424bd..187a4ce65a 100644 --- a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc @@ -27,14 +27,12 @@ webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; namespace webrtc { -AudioDeviceLinuxPulse::AudioDeviceLinuxPulse(const int32_t id) +AudioDeviceLinuxPulse::AudioDeviceLinuxPulse() : _ptrAudioBuffer(NULL), _timeEventRec(*EventWrapper::Create()), _timeEventPlay(*EventWrapper::Create()), _recStartEvent(*EventWrapper::Create()), _playStartEvent(*EventWrapper::Create()), - _id(id), - _mixerManager(id), _inputDeviceIndex(0), _outputDeviceIndex(0), _inputDeviceIsSpecified(false), diff --git a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.h b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.h index 78909c185a..b69533e3b2 100644 --- a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.h +++ b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.h @@ -95,7 +95,7 @@ class EventWrapper; class AudioDeviceLinuxPulse: public AudioDeviceGeneric { public: - AudioDeviceLinuxPulse(const int32_t id); + AudioDeviceLinuxPulse(); virtual ~AudioDeviceLinuxPulse(); // Retrieve the currently utilized audio layer @@ -289,7 +289,6 @@ private: // TODO(pbos): Remove unique_ptr and use directly without resetting. std::unique_ptr _ptrThreadPlay; std::unique_ptr _ptrThreadRec; - int32_t _id; AudioMixerManagerLinuxPulse _mixerManager; diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc index 1a30fec274..8bc63c3806 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc @@ -11,7 +11,7 @@ #include #include "webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" extern webrtc::adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; @@ -24,15 +24,13 @@ extern webrtc::adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; namespace webrtc { -AudioMixerManagerLinuxALSA::AudioMixerManagerLinuxALSA(const int32_t id) : - _id(id), +AudioMixerManagerLinuxALSA::AudioMixerManagerLinuxALSA() : _outputMixerHandle(NULL), _inputMixerHandle(NULL), _outputMixerElement(NULL), _inputMixerElement(NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, - "%s constructed", __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__ << " created"; memset(_outputMixerStr, 0, kAdmMaxDeviceNameSize); memset(_inputMixerStr, 0, kAdmMaxDeviceNameSize); @@ -40,8 +38,7 @@ AudioMixerManagerLinuxALSA::AudioMixerManagerLinuxALSA(const int32_t id) : AudioMixerManagerLinuxALSA::~AudioMixerManagerLinuxALSA() { - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, - "%s destructed", __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__ << " destroyed"; Close(); } @@ -51,8 +48,7 @@ AudioMixerManagerLinuxALSA::~AudioMixerManagerLinuxALSA() int32_t AudioMixerManagerLinuxALSA::Close() { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; rtc::CritScope lock(&_critSect); @@ -65,8 +61,7 @@ int32_t AudioMixerManagerLinuxALSA::Close() int32_t AudioMixerManagerLinuxALSA::CloseSpeaker() { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; rtc::CritScope lock(&_critSect); @@ -74,28 +69,24 @@ int32_t AudioMixerManagerLinuxALSA::CloseSpeaker() if (_outputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing playout mixer"); + LOG(LS_VERBOSE) << "Closing playout mixer"; LATE(snd_mixer_free)(_outputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error freeing playout mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error freeing playout mixer: " + << LATE(snd_strerror)(errVal); } errVal = LATE(snd_mixer_detach)(_outputMixerHandle, _outputMixerStr); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error detachinging playout mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error detaching playout mixer: " + << LATE(snd_strerror)(errVal); } errVal = LATE(snd_mixer_close)(_outputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error snd_mixer_close(handleMixer) errVal=%d", - errVal); + LOG(LS_ERROR) << "Error snd_mixer_close(handleMixer) errVal=" + << errVal; } _outputMixerHandle = NULL; _outputMixerElement = NULL; @@ -107,7 +98,7 @@ int32_t AudioMixerManagerLinuxALSA::CloseSpeaker() int32_t AudioMixerManagerLinuxALSA::CloseMicrophone() { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; rtc::CritScope lock(&_critSect); @@ -115,39 +106,32 @@ int32_t AudioMixerManagerLinuxALSA::CloseMicrophone() if (_inputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer"); + LOG(LS_VERBOSE) << "Closing record mixer"; LATE(snd_mixer_free)(_inputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error freeing record mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error freeing record mixer: " + << LATE(snd_strerror)(errVal); } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer 2"); + LOG(LS_VERBOSE) << "Closing record mixer 2"; errVal = LATE(snd_mixer_detach)(_inputMixerHandle, _inputMixerStr); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error detachinging record mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error detaching record mixer: " + << LATE(snd_strerror)(errVal); } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer 3"); + LOG(LS_VERBOSE) << "Closing record mixer 3"; errVal = LATE(snd_mixer_close)(_inputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error snd_mixer_close(handleMixer) errVal=%d", - errVal); + LOG(LS_ERROR) << "Error snd_mixer_close(handleMixer) errVal=" + << errVal; } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer 4"); + LOG(LS_VERBOSE) << "Closing record mixer 4"; _inputMixerHandle = NULL; _inputMixerElement = NULL; } @@ -158,8 +142,8 @@ int32_t AudioMixerManagerLinuxALSA::CloseMicrophone() int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::OpenSpeaker(name=%s)", deviceName); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::OpenSpeaker(name=" + << deviceName << ")"; rtc::CritScope lock(&_critSect); @@ -169,29 +153,25 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) // if (_outputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing playout mixer"); + LOG(LS_VERBOSE) << "Closing playout mixer"; LATE(snd_mixer_free)(_outputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error freeing playout mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error freeing playout mixer: " + << LATE(snd_strerror)(errVal); } errVal = LATE(snd_mixer_detach)(_outputMixerHandle, _outputMixerStr); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error detachinging playout mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error detaching playout mixer: " + << LATE(snd_strerror)(errVal); } errVal = LATE(snd_mixer_close)(_outputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error snd_mixer_close(handleMixer) errVal=%d", - errVal); + LOG(LS_ERROR) << "Error snd_mixer_close(handleMixer) errVal=" + << errVal; } } _outputMixerHandle = NULL; @@ -200,23 +180,21 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) errVal = LATE(snd_mixer_open)(&_outputMixerHandle, 0); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "snd_mixer_open(&_outputMixerHandle, 0) - error"); + LOG(LS_ERROR) << "snd_mixer_open(&_outputMixerHandle, 0) - error"; return -1; } char controlName[kAdmMaxDeviceNameSize] = { 0 }; GetControlName(controlName, deviceName); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " snd_mixer_attach(_outputMixerHandle, %s)", controlName); + LOG(LS_VERBOSE) << "snd_mixer_attach(_outputMixerHandle, " << controlName + << ")"; errVal = LATE(snd_mixer_attach)(_outputMixerHandle, controlName); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_attach(_outputMixerHandle, %s) error: %s", - controlName, LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "snd_mixer_attach(_outputMixerHandle, " << controlName + << ") error: " << LATE(snd_strerror)(errVal); _outputMixerHandle = NULL; return -1; } @@ -225,10 +203,9 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) errVal = LATE(snd_mixer_selem_register)(_outputMixerHandle, NULL, NULL); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_selem_register(_outputMixerHandle," - " NULL, NULL), error: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) + << "snd_mixer_selem_register(_outputMixerHandle, NULL, NULL), " + << "error: " << LATE(snd_strerror)(errVal); _outputMixerHandle = NULL; return -1; } @@ -241,9 +218,8 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) if (_outputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " the output mixer device is now open (0x%x)", - _outputMixerHandle); + LOG(LS_VERBOSE) << "the output mixer device is now open (" + << _outputMixerHandle << ")"; } return 0; @@ -251,9 +227,8 @@ int32_t AudioMixerManagerLinuxALSA::OpenSpeaker(char* deviceName) int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::OpenMicrophone(name=%s)", - deviceName); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::OpenMicrophone(name=" + << deviceName << ")"; rtc::CritScope lock(&_critSect); @@ -263,38 +238,31 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) // if (_inputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer"); + LOG(LS_VERBOSE) << "Closing record mixer"; LATE(snd_mixer_free)(_inputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error freeing record mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error freeing record mixer: " + << LATE(snd_strerror)(errVal); } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer"); + LOG(LS_VERBOSE) << "Closing record mixer"; errVal = LATE(snd_mixer_detach)(_inputMixerHandle, _inputMixerStr); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error detachinging record mixer: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error detaching record mixer: " + << LATE(snd_strerror)(errVal); } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer"); + LOG(LS_VERBOSE) << "Closing record mixer"; errVal = LATE(snd_mixer_close)(_inputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error snd_mixer_close(handleMixer) errVal=%d", - errVal); + LOG(LS_ERROR) << "Error snd_mixer_close(handleMixer) errVal=" + << errVal; } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "Closing record mixer"); + LOG(LS_VERBOSE) << "Closing record mixer"; } _inputMixerHandle = NULL; _inputMixerElement = NULL; @@ -302,23 +270,21 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) errVal = LATE(snd_mixer_open)(&_inputMixerHandle, 0); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_open(&_inputMixerHandle, 0) - error"); + LOG(LS_ERROR) << "snd_mixer_open(&_inputMixerHandle, 0) - error"; return -1; } char controlName[kAdmMaxDeviceNameSize] = { 0 }; GetControlName(controlName, deviceName); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " snd_mixer_attach(_inputMixerHandle, %s)", controlName); + LOG(LS_VERBOSE) << "snd_mixer_attach(_inputMixerHandle, " << controlName + << ")"; errVal = LATE(snd_mixer_attach)(_inputMixerHandle, controlName); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_attach(_inputMixerHandle, %s) error: %s", - controlName, LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "snd_mixer_attach(_inputMixerHandle, " << controlName + << ") error: " << LATE(snd_strerror)(errVal); _inputMixerHandle = NULL; return -1; @@ -328,10 +294,9 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) errVal = LATE(snd_mixer_selem_register)(_inputMixerHandle, NULL, NULL); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_selem_register(_inputMixerHandle," - " NULL, NULL), error: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) + << "snd_mixer_selem_register(_inputMixerHandle, NULL, NULL), " + << "error: " << LATE(snd_strerror)(errVal); _inputMixerHandle = NULL; return -1; @@ -344,9 +309,8 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) if (_inputMixerHandle != NULL) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " the input mixer device is now open (0x%x)", - _inputMixerHandle); + LOG(LS_VERBOSE) << "the input mixer device is now open (" + << _inputMixerHandle << ")"; } return 0; @@ -354,15 +318,14 @@ int32_t AudioMixerManagerLinuxALSA::OpenMicrophone(char *deviceName) bool AudioMixerManagerLinuxALSA::SpeakerIsInitialized() const { - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__; return (_outputMixerHandle != NULL); } bool AudioMixerManagerLinuxALSA::MicrophoneIsInitialized() const { - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__; return (_inputMixerHandle != NULL); } @@ -370,16 +333,14 @@ bool AudioMixerManagerLinuxALSA::MicrophoneIsInitialized() const int32_t AudioMixerManagerLinuxALSA::SetSpeakerVolume( uint32_t volume) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::SetSpeakerVolume(volume=%u)", - volume); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetSpeakerVolume(volume=" + << volume << ")"; rtc::CritScope lock(&_critSect); if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -388,9 +349,8 @@ int32_t AudioMixerManagerLinuxALSA::SetSpeakerVolume( volume); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error changing master volume: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error changing master volume: " + << LATE(snd_strerror)(errVal); return -1; } @@ -403,8 +363,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerVolume( if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -417,14 +376,12 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerVolume( &vol); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "Error getting outputvolume: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting outputvolume: " + << LATE(snd_strerror)(errVal); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " AudioMixerManagerLinuxALSA::SpeakerVolume() => vol=%i", - vol); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SpeakerVolume() => vol=" + << vol; volume = static_cast (vol); @@ -437,8 +394,7 @@ int32_t AudioMixerManagerLinuxALSA::MaxSpeakerVolume( if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avilable output mixer element exists"); + LOG(LS_WARNING) << "no avilable output mixer element exists"; return -1; } @@ -449,15 +405,13 @@ int32_t AudioMixerManagerLinuxALSA::MaxSpeakerVolume( LATE(snd_mixer_selem_get_playback_volume_range)(_outputMixerElement, &minVol, &maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Playout hardware volume range, min: %d, max: %d", - minVol, maxVol); + LOG(LS_VERBOSE) << "Playout hardware volume range, min: " << minVol + << ", max: " << maxVol; if (maxVol <= minVol) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting get_playback_volume_range: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting get_playback_volume_range: " + << LATE(snd_strerror)(errVal); } maxVolume = static_cast (maxVol); @@ -471,8 +425,7 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -483,15 +436,13 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( LATE(snd_mixer_selem_get_playback_volume_range)(_outputMixerElement, &minVol, &maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Playout hardware volume range, min: %d, max: %d", - minVol, maxVol); + LOG(LS_VERBOSE) << "Playout hardware volume range, min: " << minVol + << ", max: " << maxVol; if (maxVol <= minVol) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting get_playback_volume_range: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting get_playback_volume_range: " + << LATE(snd_strerror)(errVal); } minVolume = static_cast (minVol); @@ -512,8 +463,7 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -524,19 +474,19 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( _outputMixerElement, &minVol, &maxVol); if ((maxVol <= minVol) || (errVal != 0)) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " Error getting playback volume range: %s", snd_strerror(errVal)); + LOG(LS_WARNING) << "Error getting playback volume range: " + << snd_strerror(errVal); } maxVol = maxVolume; errVal = snd_mixer_selem_set_playback_volume_range( _outputMixerElement, minVol, maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Playout hardware volume range, min: %d, max: %d", minVol, maxVol); + LOG(LS_VERBOSE) << "Playout hardware volume range, min: " << minVol + << ", max: " << maxVol; if (errVal != 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting playback volume range: %s", snd_strerror(errVal)); + LOG(LS_ERROR) << "Error setting playback volume range: " + << snd_strerror(errVal); return -1; } @@ -553,8 +503,7 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -565,19 +514,19 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume( _outputMixerElement, &minVol, &maxVol); if ((maxVol <= minVol) || (errVal != 0)) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " Error getting playback volume range: %s", snd_strerror(errVal)); + LOG(LS_WARNING) << "Error getting playback volume range: " + << snd_strerror(errVal); } minVol = minVolume; errVal = snd_mixer_selem_set_playback_volume_range( _outputMixerElement, minVol, maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Playout hardware volume range, min: %d, max: %d", minVol, maxVol); + LOG(LS_VERBOSE) << "Playout hardware volume range, min: " << minVol + << ", max: " << maxVol; if (errVal != 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting playback volume range: %s", snd_strerror(errVal)); + LOG(LS_ERROR) << "Error setting playback volume range: " + << snd_strerror(errVal); return -1; } @@ -591,8 +540,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerVolumeStepSize( if (_outputMixerHandle == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer exists"); + LOG(LS_WARNING) << "no avaliable output mixer exists"; return -1; } @@ -607,8 +555,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerVolumeIsAvailable( { if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -622,8 +569,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerMuteIsAvailable( { if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -634,16 +580,14 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerMuteIsAvailable( int32_t AudioMixerManagerLinuxALSA::SetSpeakerMute(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::SetSpeakerMute(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetSpeakerMute(enable=" + << enable << ")"; rtc::CritScope lock(&_critSect); if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -652,8 +596,7 @@ int32_t AudioMixerManagerLinuxALSA::SetSpeakerMute(bool enable) SpeakerMuteIsAvailable(available); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to mute the speaker"); + LOG(LS_WARNING) << "it is not possible to mute the speaker"; return -1; } @@ -663,9 +606,8 @@ int32_t AudioMixerManagerLinuxALSA::SetSpeakerMute(bool enable) !enable); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting playback switch: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error setting playback switch: " + << LATE(snd_strerror)(errVal); return -1; } @@ -677,8 +619,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerMute(bool& enabled) const if (_outputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer exists"); + LOG(LS_WARNING) << "no avaliable output mixer exists"; return -1; } @@ -687,8 +628,7 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerMute(bool& enabled) const LATE(snd_mixer_selem_has_playback_switch)(_outputMixerElement); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to mute the speaker"); + LOG(LS_WARNING) << "it is not possible to mute the speaker"; return -1; } @@ -703,9 +643,8 @@ int32_t AudioMixerManagerLinuxALSA::SpeakerMute(bool& enabled) const &value); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting playback switch: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting playback switch: " + << LATE(snd_strerror)(errVal); return -1; } @@ -720,8 +659,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMuteIsAvailable( { if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -731,16 +669,14 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMuteIsAvailable( int32_t AudioMixerManagerLinuxALSA::SetMicrophoneMute(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::SetMicrophoneMute(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetMicrophoneMute(enable=" + << enable << ")"; rtc::CritScope lock(&_critSect); if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -749,8 +685,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneMute(bool enable) MicrophoneMuteIsAvailable(available); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to mute the microphone"); + LOG(LS_WARNING) << "it is not possible to mute the microphone"; return -1; } @@ -760,9 +695,8 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneMute(bool enable) !enable); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting capture switch: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error setting capture switch: " + << LATE(snd_strerror)(errVal); return -1; } @@ -774,8 +708,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMute(bool& enabled) const if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer exists"); + LOG(LS_WARNING) << "no avaliable input mixer exists"; return -1; } @@ -784,8 +717,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMute(bool& enabled) const LATE(snd_mixer_selem_has_capture_switch)(_inputMixerElement); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to mute the microphone"); + LOG(LS_WARNING) << "it is not possible to mute the microphone"; return -1; } @@ -800,9 +732,8 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMute(bool& enabled) const &value); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting capture switch: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting capture switch: " + << LATE(snd_strerror)(errVal); return -1; } @@ -817,8 +748,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneBoostIsAvailable( { if (_inputMixerHandle == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer exists"); + LOG(LS_WARNING) << "no avaliable input mixer exists"; return -1; } @@ -830,16 +760,14 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneBoostIsAvailable( int32_t AudioMixerManagerLinuxALSA::SetMicrophoneBoost(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::SetMicrophoneBoost(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetMicrophoneBoost(enable=" + << enable << ")"; rtc::CritScope lock(&_critSect); if (_inputMixerHandle == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer exists"); + LOG(LS_WARNING) << "no avaliable input mixer exists"; return -1; } @@ -848,8 +776,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneBoost(bool enable) MicrophoneMuteIsAvailable(available); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to enable microphone boost"); + LOG(LS_WARNING) << "it is not possible to enable microphone boost"; return -1; } @@ -863,8 +790,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneBoost(bool& enabled) const if (_inputMixerHandle == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer exists"); + LOG(LS_WARNING) << "no avaliable input mixer exists"; return -1; } @@ -879,8 +805,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneVolumeIsAvailable( { if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -892,16 +817,14 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneVolumeIsAvailable( int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( uint32_t volume) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxALSA::SetMicrophoneVolume(volume=%u)", - volume); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetMicrophoneVolume(volume=" + << volume << ")"; rtc::CritScope lock(&_critSect); if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -911,9 +834,8 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( volume); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error changing microphone volume: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error changing microphone volume: " + << LATE(snd_strerror)(errVal); return -1; } @@ -933,8 +855,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -945,19 +866,19 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( &minVol, &maxVol); if ((maxVol <= minVol) || (errVal != 0)) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " Error getting capture volume range: %s", snd_strerror(errVal)); + LOG(LS_WARNING) << "Error getting capture volume range: " + << snd_strerror(errVal); } maxVol = (long int)maxVolume; printf("min %d max %d", minVol, maxVol); errVal = snd_mixer_selem_set_capture_volume_range(_inputMixerElement, minVol, maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Capture hardware volume range, min: %d, max: %d", minVol, maxVol); + LOG(LS_VERBOSE) << "Capture hardware volume range, min: " << minVol + << ", max: " << maxVol; if (errVal != 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting capture volume range: %s", snd_strerror(errVal)); + LOG(LS_ERROR) << "Error setting capture volume range: " + << snd_strerror(errVal); return -1; } @@ -974,8 +895,7 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable output mixer element exists"); + LOG(LS_WARNING) << "no avaliable output mixer element exists"; return -1; } @@ -987,20 +907,20 @@ int32_t AudioMixerManagerLinuxALSA::SetMicrophoneVolume( if (maxVol <= minVol) { //maxVol = 255; - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " Error getting capture volume range: %s", snd_strerror(errVal)); + LOG(LS_WARNING) << "Error getting capture volume range: " + << snd_strerror(errVal); } printf("min %d max %d", minVol, maxVol); minVol = (long int)minVolume; errVal = snd_mixer_selem_set_capture_volume_range( _inputMixerElement, minVol, maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Capture hardware volume range, min: %d, max: %d", minVol, maxVol); + LOG(LS_VERBOSE) << "Capture hardware volume range, min: " << minVol + << ", max: " << maxVol; if (errVal != 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error setting capture volume range: %s", snd_strerror(errVal)); + LOG(LS_ERROR) << "Error setting capture volume range: " + << snd_strerror(errVal); return -1; } @@ -1014,8 +934,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneVolume( if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -1029,14 +948,12 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneVolume( &vol); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "Error getting inputvolume: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting inputvolume: " + << LATE(snd_strerror)(errVal); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " AudioMixerManagerLinuxALSA::MicrophoneVolume() => vol=%i", - vol); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::MicrophoneVolume() => vol=" + << vol; volume = static_cast (vol); @@ -1049,8 +966,7 @@ int32_t AudioMixerManagerLinuxALSA::MaxMicrophoneVolume( if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -1060,8 +976,7 @@ int32_t AudioMixerManagerLinuxALSA::MaxMicrophoneVolume( // check if we have mic volume at all if (!LATE(snd_mixer_selem_has_capture_volume)(_inputMixerElement)) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " No microphone volume available"); + LOG(LS_ERROR) << "No microphone volume available"; return -1; } @@ -1069,14 +984,12 @@ int32_t AudioMixerManagerLinuxALSA::MaxMicrophoneVolume( LATE(snd_mixer_selem_get_capture_volume_range)(_inputMixerElement, &minVol, &maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Microphone hardware volume range, min: %d, max: %d", - minVol, maxVol); + LOG(LS_VERBOSE) << "Microphone hardware volume range, min: " << minVol + << ", max: " << maxVol; if (maxVol <= minVol) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting microphone volume range: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting microphone volume range: " + << LATE(snd_strerror)(errVal); } maxVolume = static_cast (maxVol); @@ -1090,8 +1003,7 @@ int32_t AudioMixerManagerLinuxALSA::MinMicrophoneVolume( if (_inputMixerElement == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer element exists"); + LOG(LS_WARNING) << "no avaliable input mixer element exists"; return -1; } @@ -1102,14 +1014,12 @@ int32_t AudioMixerManagerLinuxALSA::MinMicrophoneVolume( LATE(snd_mixer_selem_get_capture_volume_range)(_inputMixerElement, &minVol, &maxVol); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Microphone hardware volume range, min: %d, max: %d", - minVol, maxVol); + LOG(LS_VERBOSE) << "Microphone hardware volume range, min: " << minVol + << ", max: " << maxVol; if (maxVol <= minVol) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " Error getting microphone volume range: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "Error getting microphone volume range: " + << LATE(snd_strerror)(errVal); } minVolume = static_cast (minVol); @@ -1123,8 +1033,7 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneVolumeStepSize( if (_inputMixerHandle == NULL) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " no avaliable input mixer exists"); + LOG(LS_WARNING) << "no avaliable input mixer exists"; return -1; } @@ -1143,9 +1052,8 @@ int32_t AudioMixerManagerLinuxALSA::LoadMicMixerElement() const int errVal = LATE(snd_mixer_load)(_inputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "snd_mixer_load(_inputMixerHandle), error: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "snd_mixer_load(_inputMixerHandle), error: " + << LATE(snd_strerror)(errVal); _inputMixerHandle = NULL; return -1; } @@ -1165,13 +1073,11 @@ int32_t AudioMixerManagerLinuxALSA::LoadMicMixerElement() const if (strcmp(selemName, "Capture") == 0) // "Capture", "Mic" { _inputMixerElement = elem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, - _id, " Capture element set"); + LOG(LS_VERBOSE) << "Capture element set"; } else if (strcmp(selemName, "Mic") == 0) { micElem = elem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, - _id, " Mic element found"); + LOG(LS_VERBOSE) << "Mic element found"; } } @@ -1189,13 +1095,11 @@ int32_t AudioMixerManagerLinuxALSA::LoadMicMixerElement() const if (micElem != NULL) { _inputMixerElement = micElem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Using Mic as capture volume."); + LOG(LS_VERBOSE) << "Using Mic as capture volume."; } else { _inputMixerElement = NULL; - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "Could not find capture volume on the mixer."); + LOG(LS_ERROR) << "Could not find capture volume on the mixer."; return -1; } @@ -1209,9 +1113,8 @@ int32_t AudioMixerManagerLinuxALSA::LoadSpeakerMixerElement() const int errVal = LATE(snd_mixer_load)(_outputMixerHandle); if (errVal < 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " snd_mixer_load(_outputMixerHandle), error: %s", - LATE(snd_strerror)(errVal)); + LOG(LS_ERROR) << "snd_mixer_load(_outputMixerHandle), error: " + << LATE(snd_strerror)(errVal); _outputMixerHandle = NULL; return -1; } @@ -1229,26 +1132,22 @@ int32_t AudioMixerManagerLinuxALSA::LoadSpeakerMixerElement() const if (LATE(snd_mixer_selem_is_active)(elem)) { selemName = LATE(snd_mixer_selem_get_name)(elem); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "snd_mixer_selem_get_name %d: %s =%x", mixerIdx, - selemName, elem); + LOG(LS_VERBOSE) << "snd_mixer_selem_get_name " << mixerIdx << ": " + << selemName << " =" << elem; // "Master", "PCM", "Wave", "Master Mono", "PC Speaker", "PCM", "Wave" if (strcmp(selemName, "PCM") == 0) { _outputMixerElement = elem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, - _id, " PCM element set"); + LOG(LS_VERBOSE) << "PCM element set"; } else if (strcmp(selemName, "Master") == 0) { masterElem = elem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, - _id, " Master element found"); + LOG(LS_VERBOSE) << "Master element found"; } else if (strcmp(selemName, "Speaker") == 0) { speakerElem = elem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, - _id, " Speaker element found"); + LOG(LS_VERBOSE) << "Speaker element found"; } } @@ -1265,18 +1164,15 @@ int32_t AudioMixerManagerLinuxALSA::LoadSpeakerMixerElement() const if (masterElem != NULL) { _outputMixerElement = masterElem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Using Master as output volume."); + LOG(LS_VERBOSE) << "Using Master as output volume."; } else if (speakerElem != NULL) { _outputMixerElement = speakerElem; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " Using Speaker as output volume."); + LOG(LS_VERBOSE) << "Using Speaker as output volume."; } else { _outputMixerElement = NULL; - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - "Could not find output volume in the mixer."); + LOG(LS_ERROR) << "Could not find output volume in the mixer."; return -1; } } diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h index d9838328d1..532b66a99f 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h @@ -54,7 +54,7 @@ public: bool MicrophoneIsInitialized() const; public: - AudioMixerManagerLinuxALSA(const int32_t id); + AudioMixerManagerLinuxALSA(); ~AudioMixerManagerLinuxALSA(); private: @@ -64,7 +64,6 @@ private: private: rtc::CriticalSection _critSect; - int32_t _id; mutable snd_mixer_t* _outputMixerHandle; char _outputMixerStr[kAdmMaxDeviceNameSize]; mutable snd_mixer_t* _inputMixerHandle; diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc index 8325b505e9..c7899a96c7 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc @@ -12,7 +12,7 @@ #include "webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h" #include "webrtc/rtc_base/checks.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" extern webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; @@ -41,8 +41,7 @@ class AutoPulseLock { pa_threaded_mainloop* const pa_mainloop_; }; -AudioMixerManagerLinuxPulse::AudioMixerManagerLinuxPulse(const int32_t id) : - _id(id), +AudioMixerManagerLinuxPulse::AudioMixerManagerLinuxPulse() : _paOutputDeviceIndex(-1), _paInputDeviceIndex(-1), _paPlayStream(NULL), @@ -57,15 +56,13 @@ AudioMixerManagerLinuxPulse::AudioMixerManagerLinuxPulse(const int32_t id) : _paChannels(0), _paObjectsSet(false) { - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, - "%s constructed", __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__ << " created"; } AudioMixerManagerLinuxPulse::~AudioMixerManagerLinuxPulse() { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, - "%s destructed", __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__ << " destroyed"; Close(); } @@ -79,13 +76,11 @@ int32_t AudioMixerManagerLinuxPulse::SetPulseAudioObjects( pa_context* context) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; if (!mainloop || !context) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " could not set PulseAudio objects for mixer"); + LOG(LS_ERROR) << "could not set PulseAudio objects for mixer"; return -1; } @@ -93,8 +88,7 @@ int32_t AudioMixerManagerLinuxPulse::SetPulseAudioObjects( _paContext = context; _paObjectsSet = true; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " the PulseAudio objects for the mixer has been set"); + LOG(LS_VERBOSE) << "the PulseAudio objects for the mixer has been set"; return 0; } @@ -102,8 +96,7 @@ int32_t AudioMixerManagerLinuxPulse::SetPulseAudioObjects( int32_t AudioMixerManagerLinuxPulse::Close() { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; CloseSpeaker(); CloseMicrophone(); @@ -119,8 +112,7 @@ int32_t AudioMixerManagerLinuxPulse::Close() int32_t AudioMixerManagerLinuxPulse::CloseSpeaker() { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; // Reset the index to -1 _paOutputDeviceIndex = -1; @@ -132,8 +124,7 @@ int32_t AudioMixerManagerLinuxPulse::CloseSpeaker() int32_t AudioMixerManagerLinuxPulse::CloseMicrophone() { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_VERBOSE) << __FUNCTION__; // Reset the index to -1 _paInputDeviceIndex = -1; @@ -145,8 +136,7 @@ int32_t AudioMixerManagerLinuxPulse::CloseMicrophone() int32_t AudioMixerManagerLinuxPulse::SetPlayStream(pa_stream* playStream) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetPlayStream(playStream)"); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetPlayStream(playStream)"; _paPlayStream = playStream; return 0; @@ -155,8 +145,7 @@ int32_t AudioMixerManagerLinuxPulse::SetPlayStream(pa_stream* playStream) int32_t AudioMixerManagerLinuxPulse::SetRecStream(pa_stream* recStream) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetRecStream(recStream)"); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetRecStream(recStream)"; _paRecStream = recStream; return 0; @@ -166,16 +155,14 @@ int32_t AudioMixerManagerLinuxPulse::OpenSpeaker( uint16_t deviceIndex) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::OpenSpeaker(deviceIndex=%d)", - deviceIndex); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::OpenSpeaker(deviceIndex=" + << deviceIndex << ")"; // No point in opening the speaker // if PA objects have not been set if (!_paObjectsSet) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " PulseAudio objects has not been set"); + LOG(LS_ERROR) << "PulseAudio objects has not been set"; return -1; } @@ -183,8 +170,7 @@ int32_t AudioMixerManagerLinuxPulse::OpenSpeaker( // output device to control _paOutputDeviceIndex = deviceIndex; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " the output mixer device is now open"); + LOG(LS_VERBOSE) << "the output mixer device is now open"; return 0; } @@ -193,16 +179,15 @@ int32_t AudioMixerManagerLinuxPulse::OpenMicrophone( uint16_t deviceIndex) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::OpenMicrophone" - "(deviceIndex=%d)", deviceIndex); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::OpenMicrophone(deviceIndex=" + << deviceIndex << ")"; // No point in opening the microphone // if PA objects have not been set if (!_paObjectsSet) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " PulseAudio objects have not been set"); + LOG(LS_ERROR) << "PulseAudio objects have not been set"; return -1; } @@ -210,8 +195,7 @@ int32_t AudioMixerManagerLinuxPulse::OpenMicrophone( // input device to control _paInputDeviceIndex = deviceIndex; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " the input mixer device is now open"); + LOG(LS_VERBOSE) << "the input mixer device is now open"; return 0; } @@ -219,8 +203,7 @@ int32_t AudioMixerManagerLinuxPulse::OpenMicrophone( bool AudioMixerManagerLinuxPulse::SpeakerIsInitialized() const { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__; return (_paOutputDeviceIndex != -1); } @@ -228,8 +211,7 @@ bool AudioMixerManagerLinuxPulse::SpeakerIsInitialized() const bool AudioMixerManagerLinuxPulse::MicrophoneIsInitialized() const { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", - __FUNCTION__); + LOG(LS_INFO) << __FUNCTION__; return (_paInputDeviceIndex != -1); } @@ -238,14 +220,12 @@ int32_t AudioMixerManagerLinuxPulse::SetSpeakerVolume( uint32_t volume) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetSpeakerVolume(volume=%u)", - volume); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetSpeakerVolume(volume=" + << volume << ")"; if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -262,8 +242,7 @@ int32_t AudioMixerManagerLinuxPulse::SetSpeakerVolume( LATE(pa_stream_get_sample_spec)(_paPlayStream); if (!spec) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, - " could not get sample specification"); + LOG(LS_ERROR) << "could not get sample specification"; return -1; } @@ -293,9 +272,8 @@ int32_t AudioMixerManagerLinuxPulse::SetSpeakerVolume( if (setFailed) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " could not set speaker volume, error%d", - LATE(pa_context_errno)(_paContext)); + LOG(LS_WARNING) << "could not set speaker volume, error=" + << LATE(pa_context_errno)(_paContext); return -1; } @@ -308,8 +286,7 @@ AudioMixerManagerLinuxPulse::SpeakerVolume(uint32_t& volume) const { if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -328,9 +305,8 @@ AudioMixerManagerLinuxPulse::SpeakerVolume(uint32_t& volume) const volume = _paSpeakerVolume; } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "\tAudioMixerManagerLinuxPulse::SpeakerVolume() => vol=%i", - volume); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SpeakerVolume() => vol=" + << volume; return 0; } @@ -341,8 +317,7 @@ AudioMixerManagerLinuxPulse::MaxSpeakerVolume(uint32_t& maxVolume) const if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -359,8 +334,7 @@ AudioMixerManagerLinuxPulse::MinSpeakerVolume(uint32_t& minVolume) const if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -375,8 +349,7 @@ AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -384,9 +357,9 @@ AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const // There are PA_VOLUME_NORM+1 steps stepSize = 1; - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "\tAudioMixerManagerLinuxPulse::SpeakerVolumeStepSize() => " - "size=%i", stepSize); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize() => size=" + << stepSize; return 0; } @@ -397,8 +370,7 @@ AudioMixerManagerLinuxPulse::SpeakerVolumeIsAvailable(bool& available) RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -414,8 +386,7 @@ AudioMixerManagerLinuxPulse::SpeakerMuteIsAvailable(bool& available) RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -428,14 +399,12 @@ AudioMixerManagerLinuxPulse::SpeakerMuteIsAvailable(bool& available) int32_t AudioMixerManagerLinuxPulse::SetSpeakerMute(bool enable) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetSpeakerMute(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetSpeakerMute(enable=" + << enable << ")"; if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -470,9 +439,8 @@ int32_t AudioMixerManagerLinuxPulse::SetSpeakerMute(bool enable) if (setFailed) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " could not mute speaker, error%d", - LATE(pa_context_errno)(_paContext)); + LOG(LS_WARNING) << "could not mute speaker, error=" + << LATE(pa_context_errno)(_paContext); return -1; } @@ -484,8 +452,7 @@ int32_t AudioMixerManagerLinuxPulse::SpeakerMute(bool& enabled) const if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -501,10 +468,8 @@ int32_t AudioMixerManagerLinuxPulse::SpeakerMute(bool& enabled) const { enabled = _paSpeakerMute; } - - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " AudioMixerManagerLinuxPulse::SpeakerMute() => " - "enabled=%i, enabled"); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SpeakerMute() => enabled=" + << enabled; return 0; } @@ -515,8 +480,7 @@ AudioMixerManagerLinuxPulse::StereoPlayoutIsAvailable(bool& available) RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paOutputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " output device index has not been set"); + LOG(LS_WARNING) << "output device index has not been set"; return -1; } @@ -549,8 +513,7 @@ AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable(bool& available) RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -580,9 +543,9 @@ AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable(bool& available) available = static_cast (_paChannels == 2); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable()" - " => available=%i, available"); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::StereoRecordingIsAvailable()" + << " => available=" << available; return 0; } @@ -593,8 +556,7 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneMuteIsAvailable( RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -607,14 +569,12 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneMuteIsAvailable( int32_t AudioMixerManagerLinuxPulse::SetMicrophoneMute(bool enable) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetMicrophoneMute(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetMicrophoneMute(enable=" + << enable << ")"; if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -650,9 +610,8 @@ int32_t AudioMixerManagerLinuxPulse::SetMicrophoneMute(bool enable) if (setFailed) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " could not mute microphone, error%d", - LATE(pa_context_errno)(_paContext)); + LOG(LS_WARNING) << "could not mute microphone, error=" + << LATE(pa_context_errno)(_paContext); return -1; } @@ -664,8 +623,7 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneMute(bool& enabled) const RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -688,9 +646,9 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneMute(bool& enabled) const enabled = static_cast (_paMute); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "\tAudioMixerManagerLinuxPulse::MicrophoneMute() =>" - " enabled=%i", enabled); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::MicrophoneMute() => enabled=" + << enabled; return 0; } @@ -701,8 +659,7 @@ AudioMixerManagerLinuxPulse::MicrophoneBoostIsAvailable(bool& available) RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -717,14 +674,12 @@ AudioMixerManagerLinuxPulse::MicrophoneBoostIsAvailable(bool& available) int32_t AudioMixerManagerLinuxPulse::SetMicrophoneBoost(bool enable) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetMicrophoneBoost(enable=%u)", - enable); + LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetMicrophoneBoost(enable=" + << enable << ")"; if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -733,8 +688,7 @@ int32_t AudioMixerManagerLinuxPulse::SetMicrophoneBoost(bool enable) MicrophoneBoostIsAvailable(available); if (!available) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " it is not possible to enable microphone boost"); + LOG(LS_WARNING) << "it is not possible to enable microphone boost"; return -1; } @@ -748,8 +702,7 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneBoost(bool& enabled) const RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -765,8 +718,7 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeIsAvailable( RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -779,14 +731,13 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeIsAvailable( int32_t AudioMixerManagerLinuxPulse::SetMicrophoneVolume(uint32_t volume) { - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "AudioMixerManagerLinuxPulse::SetMicrophoneVolume" - "(volume=%u)", volume); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::SetMicrophoneVolume(volume=" << volume + << ")"; if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -845,9 +796,8 @@ AudioMixerManagerLinuxPulse::SetMicrophoneVolume(uint32_t volume) if (setFailed) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " could not set microphone volume, error%d", - LATE(pa_context_errno)(_paContext)); + LOG(LS_WARNING) << "could not set microphone volume, error=" + << LATE(pa_context_errno)(_paContext); return -1; } @@ -860,8 +810,7 @@ AudioMixerManagerLinuxPulse::MicrophoneVolume(uint32_t& volume) const if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -886,9 +835,9 @@ AudioMixerManagerLinuxPulse::MicrophoneVolume(uint32_t& volume) const volume = static_cast (_paVolume); } - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - " AudioMixerManagerLinuxPulse::MicrophoneVolume()" - " => vol=%i, volume"); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::MicrophoneVolume() => vol=" + << volume; return 0; } @@ -899,8 +848,7 @@ AudioMixerManagerLinuxPulse::MaxMicrophoneVolume(uint32_t& maxVolume) const if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -918,8 +866,7 @@ AudioMixerManagerLinuxPulse::MinMicrophoneVolume(uint32_t& minVolume) const if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -934,8 +881,7 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize( RTC_DCHECK(thread_checker_.CalledOnValidThread()); if (_paInputDeviceIndex == -1) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " input device index has not been set"); + LOG(LS_WARNING) << "input device index has not been set"; return -1; } @@ -964,9 +910,9 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize( stepSize = static_cast ((PA_VOLUME_NORM + 1) / _paVolSteps); - WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, - "\tAudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize()" - " => size=%i", stepSize); + LOG(LS_VERBOSE) + << "AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize() => size=" + << stepSize; return 0; } @@ -1014,8 +960,7 @@ AudioMixerManagerLinuxPulse::PaSetVolumeCallback(pa_context * c, { if (!success) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1, - " failed to set volume"); + LOG(LS_ERROR) << "failed to set volume"; } } diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h index a5806af96e..40265d6916 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.h @@ -65,7 +65,7 @@ public: bool MicrophoneIsInitialized() const; public: - AudioMixerManagerLinuxPulse(const int32_t id); + AudioMixerManagerLinuxPulse(); ~AudioMixerManagerLinuxPulse(); private: @@ -89,7 +89,6 @@ private: bool GetSourceInfoByIndex(int device_index) const; private: - int32_t _id; int16_t _paOutputDeviceIndex; int16_t _paInputDeviceIndex; diff --git a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc index 1052f86143..549f6e9e83 100644 --- a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc +++ b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc @@ -10,7 +10,7 @@ #include "webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" #ifdef WEBRTC_LINUX #include @@ -39,8 +39,7 @@ DllHandle InternalLoadDll(const char dll_name[]) { #error Not implemented #endif if (handle == kInvalidDllHandle) { - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, -1, - "Can't load %s : %s", dll_name, GetDllError()); + LOG(LS_WARNING) << "Can't load " << dll_name << " : " << GetDllError(); } return handle; } @@ -56,8 +55,7 @@ void InternalUnloadDll(DllHandle handle) { // https://code.google.com/p/address-sanitizer/issues/detail?id=89 #if !defined(ADDRESS_SANITIZER) if (dlclose(handle) != 0) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1, - "%s", GetDllError()); + LOG(LS_ERROR) << GetDllError(); } #endif // !defined(ADDRESS_SANITIZER) #else @@ -72,12 +70,10 @@ static bool LoadSymbol(DllHandle handle, *symbol = dlsym(handle, symbol_name); char *err = dlerror(); if (err) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1, - "Error loading symbol %s : %d", symbol_name, err); + LOG(LS_ERROR) << "Error loading symbol " << symbol_name << " : " << err; return false; } else if (!*symbol) { - WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1, - "Symbol %s is NULL", symbol_name); + LOG(LS_ERROR) << "Symbol " << symbol_name << " is NULL"; return false; } return true;