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