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}
This commit is contained in:
saza 2017-07-18 04:12:29 -07:00 committed by Commit Bot
parent 0f2f169a6e
commit 43a85f0343
10 changed files with 285 additions and 454 deletions

View File

@ -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
}

View File

@ -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),

View File

@ -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

View File

@ -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),

View File

@ -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<rtc::PlatformThread> _ptrThreadPlay;
std::unique_ptr<rtc::PlatformThread> _ptrThreadRec;
int32_t _id;
AudioMixerManagerLinuxPulse _mixerManager;

View File

@ -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;

View File

@ -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<bool> (_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<bool> (_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<uint32_t> (_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<uint16_t> ((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";
}
}

View File

@ -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;

View File

@ -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 <dlfcn.h>
@ -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;