Removes unused APIs from the ADM (part II).
Removes: int32_t SpeakerVolumeStepSize(uint16_t* stepSize) int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) int32_t MicrophoneBoostIsAvailable(bool* available) int32_t SetMicrophoneBoost(bool enable) int32_t MicrophoneBoost(bool* enabled) int32_t SetPlayoutBuffer(const BufferType type, uint16_t sizeMS = 0) int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) int32_t CPULoad(uint16_t* load) int32_t StartRawOutputFileRecording(const char pcmFileNameUTF8[kAdmMaxFileNameSize]) int32_t StopRawOutputFileRecording() int32_t StartRawInputFileRecording(const char pcmFileNameUTF8[kAdmMaxFileNameSize]) int32_t StopRawInputFileRecording() int32_t ResetAudioDevice() BUG=webrtc:7306 Review-Url: https://codereview.webrtc.org/3006803002 Cr-Commit-Position: refs/heads/master@{#19632}
This commit is contained in:
parent
137cd1d788
commit
9868042b05
@ -276,11 +276,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return output_.MinSpeakerVolume(minVolume);
|
||||
}
|
||||
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override{
|
||||
available = false;
|
||||
return -1;
|
||||
@ -306,11 +301,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
@ -341,21 +331,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t SetMicrophoneBoost(bool enable) override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t MicrophoneBoost(bool& enabled) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
available = false;
|
||||
@ -394,18 +369,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type, uint16_t sizeMS) override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type, uint16_t& sizeMS) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t PlayoutDelay(uint16_t& delay_ms) const override {
|
||||
// Best guess we can do is to use half of the estimated total delay.
|
||||
delay_ms = audio_manager_->GetDelayEstimateInMilliseconds() / 2;
|
||||
@ -421,11 +384,6 @@ class AudioDeviceTemplate : public AudioDeviceGeneric {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t CPULoad(uint16_t& load) const override {
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool PlayoutWarning() const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -280,28 +280,6 @@ void AudioDeviceBuffer::SetVQEData(int play_delay_ms,
|
||||
clock_drift_ = clock_drift;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::StartInputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize]) {
|
||||
LOG(LS_WARNING) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::StopInputFileRecording() {
|
||||
LOG(LS_WARNING) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::StartOutputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize]) {
|
||||
LOG(LS_WARNING) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::StopOutputFileRecording() {
|
||||
LOG(LS_WARNING) << "Not implemented";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceBuffer::SetRecordedBuffer(const void* audio_buffer,
|
||||
size_t samples_per_channel) {
|
||||
RTC_DCHECK_RUN_ON(&recording_thread_checker_);
|
||||
|
||||
@ -108,14 +108,6 @@ class AudioDeviceBuffer {
|
||||
virtual int32_t RequestPlayoutData(size_t samples_per_channel);
|
||||
virtual int32_t GetPlayoutData(void* audio_buffer);
|
||||
|
||||
// TODO(henrika): these methods should not be used and does not contain any
|
||||
// valid implementation. Investigate the possibility to either remove them
|
||||
// or add a proper implementation if needed.
|
||||
int32_t StartInputFileRecording(const char fileName[kAdmMaxFileNameSize]);
|
||||
int32_t StopInputFileRecording();
|
||||
int32_t StartOutputFileRecording(const char fileName[kAdmMaxFileNameSize]);
|
||||
int32_t StopOutputFileRecording();
|
||||
|
||||
int32_t SetTypingStatus(bool typing_status);
|
||||
|
||||
// Called on iOS where the native audio layer can be interrupted by other
|
||||
|
||||
@ -202,9 +202,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t MinSpeakerVolume(uint32_t* min_volume) const override {
|
||||
return impl_->MinSpeakerVolume(min_volume);
|
||||
}
|
||||
int32_t SpeakerVolumeStepSize(uint16_t* step_size) const override {
|
||||
return impl_->SpeakerVolumeStepSize(step_size);
|
||||
}
|
||||
int32_t MicrophoneVolumeIsAvailable(bool* available) override {
|
||||
return impl_->MicrophoneVolumeIsAvailable(available);
|
||||
}
|
||||
@ -220,9 +217,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t MinMicrophoneVolume(uint32_t* min_volume) const override {
|
||||
return impl_->MinMicrophoneVolume(min_volume);
|
||||
}
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t* step_size) const override {
|
||||
return impl_->MicrophoneVolumeStepSize(step_size);
|
||||
}
|
||||
int32_t SpeakerMuteIsAvailable(bool* available) override {
|
||||
return impl_->SpeakerMuteIsAvailable(available);
|
||||
}
|
||||
@ -241,15 +235,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t MicrophoneMute(bool* enabled) const override {
|
||||
return impl_->MicrophoneMute(enabled);
|
||||
}
|
||||
int32_t MicrophoneBoostIsAvailable(bool* available) override {
|
||||
return impl_->MicrophoneBoostIsAvailable(available);
|
||||
}
|
||||
int32_t SetMicrophoneBoost(bool enable) override {
|
||||
return impl_->SetMicrophoneBoost(enable);
|
||||
}
|
||||
int32_t MicrophoneBoost(bool* enabled) const override {
|
||||
return impl_->MicrophoneBoost(enabled);
|
||||
}
|
||||
int32_t StereoPlayoutIsAvailable(bool* available) const override {
|
||||
return impl_->StereoPlayoutIsAvailable(available);
|
||||
}
|
||||
@ -274,35 +259,12 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t RecordingChannel(ChannelType* channel) const override {
|
||||
return impl_->RecordingChannel(channel);
|
||||
}
|
||||
int32_t SetPlayoutBuffer(const BufferType type, uint16_t size_ms) override {
|
||||
return impl_->SetPlayoutBuffer(type, size_ms);
|
||||
}
|
||||
int32_t PlayoutBuffer(BufferType* type, uint16_t* size_ms) const override {
|
||||
return impl_->PlayoutBuffer(type, size_ms);
|
||||
}
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override {
|
||||
return impl_->PlayoutDelay(delay_ms);
|
||||
}
|
||||
int32_t RecordingDelay(uint16_t* delay_ms) const override {
|
||||
return impl_->RecordingDelay(delay_ms);
|
||||
}
|
||||
int32_t CPULoad(uint16_t* load) const override {
|
||||
return impl_->CPULoad(load);
|
||||
}
|
||||
int32_t StartRawOutputFileRecording(
|
||||
const char pcm_file_name_utf8[kAdmMaxFileNameSize]) override {
|
||||
return impl_->StartRawOutputFileRecording(pcm_file_name_utf8);
|
||||
}
|
||||
int32_t StopRawOutputFileRecording() override {
|
||||
return impl_->StopRawOutputFileRecording();
|
||||
}
|
||||
int32_t StartRawInputFileRecording(
|
||||
const char pcm_file_name_utf8[kAdmMaxFileNameSize]) override {
|
||||
return impl_->StartRawInputFileRecording(pcm_file_name_utf8);
|
||||
}
|
||||
int32_t StopRawInputFileRecording() override {
|
||||
return impl_->StopRawInputFileRecording();
|
||||
}
|
||||
int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override {
|
||||
return impl_->SetRecordingSampleRate(samples_per_sec);
|
||||
}
|
||||
@ -315,7 +277,6 @@ class ADMWrapper : public AudioDeviceModule, public AudioTransport {
|
||||
int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const override {
|
||||
return impl_->PlayoutSampleRate(samples_per_sec);
|
||||
}
|
||||
int32_t ResetAudioDevice() override { return impl_->ResetAudioDevice(); }
|
||||
int32_t SetLoudspeakerStatus(bool enable) override {
|
||||
return impl_->SetLoudspeakerStatus(enable);
|
||||
}
|
||||
|
||||
@ -34,19 +34,6 @@ int32_t AudioDeviceGeneric::GetLoudspeakerStatus(bool& enable) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceGeneric::ResetAudioDevice() {
|
||||
LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceGeneric::SoundDeviceControl(unsigned int par1,
|
||||
unsigned int par2,
|
||||
unsigned int par3,
|
||||
unsigned int par4) {
|
||||
LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AudioDeviceGeneric::BuiltInAECIsAvailable() const {
|
||||
LOG_F(LS_ERROR) << "Not supported on this platform";
|
||||
return false;
|
||||
|
||||
@ -87,7 +87,6 @@ class AudioDeviceGeneric {
|
||||
virtual int32_t SpeakerVolume(uint32_t& volume) const = 0;
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const = 0;
|
||||
virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const = 0;
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const = 0;
|
||||
|
||||
// Microphone volume controls
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool& available) = 0;
|
||||
@ -95,7 +94,6 @@ class AudioDeviceGeneric {
|
||||
virtual int32_t MicrophoneVolume(uint32_t& volume) const = 0;
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const = 0;
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t& minVolume) const = 0;
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const = 0;
|
||||
|
||||
// Speaker mute control
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool& available) = 0;
|
||||
@ -107,11 +105,6 @@ class AudioDeviceGeneric {
|
||||
virtual int32_t SetMicrophoneMute(bool enable) = 0;
|
||||
virtual int32_t MicrophoneMute(bool& enabled) const = 0;
|
||||
|
||||
// Microphone boost control
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool& available) = 0;
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) = 0;
|
||||
virtual int32_t MicrophoneBoost(bool& enabled) const = 0;
|
||||
|
||||
// Stereo support
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool& available) = 0;
|
||||
virtual int32_t SetStereoPlayout(bool enable) = 0;
|
||||
@ -121,16 +114,9 @@ class AudioDeviceGeneric {
|
||||
virtual int32_t StereoRecording(bool& enabled) const = 0;
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS = 0) = 0;
|
||||
virtual int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const = 0;
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const = 0;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const = 0;
|
||||
|
||||
// CPU load
|
||||
virtual int32_t CPULoad(uint16_t& load) const = 0;
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec);
|
||||
virtual int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec);
|
||||
@ -139,15 +125,6 @@ class AudioDeviceGeneric {
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable);
|
||||
virtual int32_t GetLoudspeakerStatus(bool& enable) const;
|
||||
|
||||
// Reset Audio Device (for mobile devices)
|
||||
virtual int32_t ResetAudioDevice();
|
||||
|
||||
// Sound Audio Device control (for WinCE only)
|
||||
virtual int32_t SoundDeviceControl(unsigned int par1 = 0,
|
||||
unsigned int par2 = 0,
|
||||
unsigned int par3 = 0,
|
||||
unsigned int par4 = 0);
|
||||
|
||||
// Android only
|
||||
virtual bool BuiltInAECIsAvailable() const;
|
||||
virtual bool BuiltInAGCIsAvailable() const;
|
||||
|
||||
@ -635,26 +635,6 @@ int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const {
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SpeakerVolumeStepSize
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::SpeakerVolumeStepSize(uint16_t* stepSize) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_ptrAudioDevice->SpeakerVolumeStepSize(delta) == -1) {
|
||||
LOG(LERROR) << "failed to retrieve the speaker-volume step size";
|
||||
return -1;
|
||||
}
|
||||
|
||||
*stepSize = delta;
|
||||
LOG(INFO) << "output: " << *stepSize;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SpeakerMuteIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -751,54 +731,6 @@ int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const {
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneBoostIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::MicrophoneBoostIsAvailable(bool* available) {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
bool isAvailable(0);
|
||||
|
||||
if (_ptrAudioDevice->MicrophoneBoostIsAvailable(isAvailable) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*available = isAvailable;
|
||||
LOG(INFO) << "output: " << isAvailable;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetMicrophoneBoost
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::SetMicrophoneBoost(bool enable) {
|
||||
LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||
CHECK_INITIALIZED();
|
||||
return (_ptrAudioDevice->SetMicrophoneBoost(enable));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneBoost
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::MicrophoneBoost(bool* enabled) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
bool onOff(false);
|
||||
|
||||
if (_ptrAudioDevice->MicrophoneBoost(onOff) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*enabled = onOff;
|
||||
LOG(INFO) << "output: " << onOff;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneVolumeIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1120,26 +1052,6 @@ int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const {
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneVolumeStepSize
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::MicrophoneVolumeStepSize(
|
||||
uint16_t* stepSize) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_ptrAudioDevice->MicrophoneVolumeStepSize(delta) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*stepSize = delta;
|
||||
LOG(INFO) << "output: " << *stepSize;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutDevices
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1432,123 +1344,6 @@ int32_t AudioDeviceModuleImpl::RegisterAudioCallback(
|
||||
return _audioDeviceBuffer.RegisterAudioCallback(audioCallback);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StartRawInputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
if (NULL == pcmFileNameUTF8) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (_audioDeviceBuffer.StartInputFileRecording(pcmFileNameUTF8));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StopRawInputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::StopRawInputFileRecording() {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
return (_audioDeviceBuffer.StopInputFileRecording());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StartRawOutputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
if (NULL == pcmFileNameUTF8) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (_audioDeviceBuffer.StartOutputFileRecording(pcmFileNameUTF8));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StopRawOutputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::StopRawOutputFileRecording() {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
return (_audioDeviceBuffer.StopOutputFileRecording());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetPlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::SetPlayoutBuffer(const BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
if (type == kFixedBufferSize) {
|
||||
LOG(INFO) << __FUNCTION__ << "(fixed buffer, " << sizeMS << "ms)";
|
||||
} else if (type == kAdaptiveBufferSize) {
|
||||
LOG(INFO) << __FUNCTION__ << "(adaptive buffer, " << sizeMS << "ms)";
|
||||
} else {
|
||||
LOG(INFO) << __FUNCTION__ << "(?, " << sizeMS << "ms)";
|
||||
}
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
if (_ptrAudioDevice->PlayoutIsInitialized()) {
|
||||
LOG(LERROR) << "unable to modify the playout buffer while playing side is "
|
||||
"initialized";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t ret(0);
|
||||
|
||||
if (kFixedBufferSize == type) {
|
||||
if (sizeMS < kAdmMinPlayoutBufferSizeMs ||
|
||||
sizeMS > kAdmMaxPlayoutBufferSizeMs) {
|
||||
LOG(LERROR) << "size parameter is out of range";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = _ptrAudioDevice->SetPlayoutBuffer(type, sizeMS)) == -1) {
|
||||
LOG(LERROR) << "failed to set the playout buffer (error: " << LastError()
|
||||
<< ")";
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::PlayoutBuffer(BufferType* type,
|
||||
uint16_t* sizeMS) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
BufferType bufType;
|
||||
uint16_t size(0);
|
||||
|
||||
if (_ptrAudioDevice->PlayoutBuffer(bufType, size) == -1) {
|
||||
LOG(LERROR) << "failed to retrieve the buffer type and size";
|
||||
return -1;
|
||||
}
|
||||
|
||||
*type = bufType;
|
||||
*sizeMS = size;
|
||||
|
||||
LOG(INFO) << "output: type = " << *type << ", sizeMS = " << *sizeMS;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutDelay
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1587,26 +1382,6 @@ int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const {
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPULoad
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::CPULoad(uint16_t* load) const {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
uint16_t cpuLoad(0);
|
||||
|
||||
if (_ptrAudioDevice->CPULoad(cpuLoad) == -1) {
|
||||
LOG(LERROR) << "failed to retrieve the CPU load";
|
||||
return -1;
|
||||
}
|
||||
|
||||
*load = cpuLoad;
|
||||
LOG(INFO) << "output: " << *load;
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetRecordingSampleRate
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1681,16 +1456,6 @@ int32_t AudioDeviceModuleImpl::PlayoutSampleRate(
|
||||
return (0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetAudioDevice
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceModuleImpl::ResetAudioDevice() {
|
||||
LOG(INFO) << __FUNCTION__;
|
||||
FATAL() << "Should never be called";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetLoudspeakerStatus
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -110,7 +110,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
int32_t SpeakerVolume(uint32_t* volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t* maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t* minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const override;
|
||||
|
||||
// Microphone volume controls
|
||||
int32_t MicrophoneVolumeIsAvailable(bool* available) override;
|
||||
@ -118,7 +117,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
int32_t MicrophoneVolume(uint32_t* volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t* minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const override;
|
||||
|
||||
// Speaker mute control
|
||||
int32_t SpeakerMuteIsAvailable(bool* available) override;
|
||||
@ -130,11 +128,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool* enabled) const override;
|
||||
|
||||
// Microphone boost control
|
||||
int32_t MicrophoneBoostIsAvailable(bool* available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool* enabled) const override;
|
||||
|
||||
// Stereo support
|
||||
int32_t StereoPlayoutIsAvailable(bool* available) const override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
@ -146,22 +139,9 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
int32_t RecordingChannel(ChannelType* channel) const override;
|
||||
|
||||
// Delay information and control
|
||||
int32_t SetPlayoutBuffer(const BufferType type, uint16_t sizeMS = 0) override;
|
||||
int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const override;
|
||||
int32_t PlayoutDelay(uint16_t* delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t* delayMS) const override;
|
||||
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t* load) const override;
|
||||
|
||||
// Recording of raw PCM data
|
||||
int32_t StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) override;
|
||||
int32_t StopRawOutputFileRecording() override;
|
||||
int32_t StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) override;
|
||||
int32_t StopRawInputFileRecording() override;
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) override;
|
||||
int32_t RecordingSampleRate(uint32_t* samplesPerSec) const override;
|
||||
@ -169,7 +149,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
|
||||
int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const override;
|
||||
|
||||
// Mobile device specific functions
|
||||
int32_t ResetAudioDevice() override;
|
||||
int32_t SetLoudspeakerStatus(bool enable) override;
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override;
|
||||
|
||||
|
||||
@ -107,10 +107,6 @@ int32_t AudioDeviceDummy::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::MicrophoneVolumeIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
@ -129,10 +125,6 @@ int32_t AudioDeviceDummy::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::MicrophoneVolumeStepSize(uint16_t& stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::SpeakerMuteIsAvailable(bool& available) { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::SetSpeakerMute(bool enable) { return -1; }
|
||||
@ -147,14 +139,6 @@ int32_t AudioDeviceDummy::SetMicrophoneMute(bool enable) { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::MicrophoneMute(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::MicrophoneBoostIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::SetMicrophoneBoost(bool enable) { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::MicrophoneBoost(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::StereoPlayoutIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
@ -170,23 +154,10 @@ int32_t AudioDeviceDummy::SetStereoRecording(bool enable) { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::StereoRecording(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceDummy::PlayoutDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::RecordingDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
int32_t AudioDeviceDummy::CPULoad(uint16_t& load) const { return -1; }
|
||||
|
||||
bool AudioDeviceDummy::PlayoutWarning() const { return false; }
|
||||
|
||||
bool AudioDeviceDummy::PlayoutError() const { return false; }
|
||||
|
||||
@ -81,7 +81,6 @@ class AudioDeviceDummy : public AudioDeviceGeneric {
|
||||
int32_t SpeakerVolume(uint32_t& volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Microphone volume controls
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override;
|
||||
@ -89,7 +88,6 @@ class AudioDeviceDummy : public AudioDeviceGeneric {
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Speaker mute control
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override;
|
||||
@ -101,11 +99,6 @@ class AudioDeviceDummy : public AudioDeviceGeneric {
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool& enabled) const override;
|
||||
|
||||
// Microphone boost control
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool& enabled) const override;
|
||||
|
||||
// Stereo support
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
@ -115,16 +108,9 @@ class AudioDeviceDummy : public AudioDeviceGeneric {
|
||||
int32_t StereoRecording(bool& enabled) const override;
|
||||
|
||||
// Delay information and control
|
||||
int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) override;
|
||||
int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const override;
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
|
||||
@ -333,10 +333,6 @@ int32_t FileAudioDevice::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::MicrophoneVolumeIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
@ -355,10 +351,6 @@ int32_t FileAudioDevice::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::MicrophoneVolumeStepSize(uint16_t& stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::SpeakerMuteIsAvailable(bool& available) { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::SetSpeakerMute(bool enable) { return -1; }
|
||||
@ -373,14 +365,6 @@ int32_t FileAudioDevice::SetMicrophoneMute(bool enable) { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::MicrophoneMute(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::MicrophoneBoostIsAvailable(bool& available) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::SetMicrophoneBoost(bool enable) { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::MicrophoneBoost(bool& enabled) const { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::StereoPlayoutIsAvailable(bool& available) {
|
||||
available = true;
|
||||
return 0;
|
||||
@ -408,26 +392,12 @@ int32_t FileAudioDevice::StereoRecording(bool& enabled) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const {
|
||||
type = _playBufType;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::PlayoutDelay(uint16_t& delayMS) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FileAudioDevice::RecordingDelay(uint16_t& delayMS) const { return -1; }
|
||||
|
||||
int32_t FileAudioDevice::CPULoad(uint16_t& load) const { return -1; }
|
||||
|
||||
bool FileAudioDevice::PlayoutWarning() const { return false; }
|
||||
|
||||
bool FileAudioDevice::PlayoutError() const { return false; }
|
||||
|
||||
@ -102,7 +102,6 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
int32_t SpeakerVolume(uint32_t& volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Microphone volume controls
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override;
|
||||
@ -110,7 +109,6 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Speaker mute control
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override;
|
||||
@ -122,11 +120,6 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool& enabled) const override;
|
||||
|
||||
// Microphone boost control
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool& enabled) const override;
|
||||
|
||||
// Stereo support
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
@ -136,16 +129,9 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
int32_t StereoRecording(bool& enabled) const override;
|
||||
|
||||
// Delay information and control
|
||||
int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) override;
|
||||
int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const override;
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
@ -165,7 +151,6 @@ class FileAudioDevice : public AudioDeviceGeneric {
|
||||
|
||||
int32_t _playout_index;
|
||||
int32_t _record_index;
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
AudioDeviceBuffer* _ptrAudioBuffer;
|
||||
int8_t* _recordingBuffer; // In bytes.
|
||||
int8_t* _playoutBuffer; // In bytes.
|
||||
|
||||
@ -40,6 +40,8 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
kDefaultDevice = -2
|
||||
};
|
||||
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
enum BufferType {
|
||||
kFixedBufferSize = 0,
|
||||
kAdaptiveBufferSize = 1
|
||||
@ -127,7 +129,9 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
virtual int32_t SpeakerVolume(uint32_t* volume) const = 0;
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t* maxVolume) const = 0;
|
||||
virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const = 0;
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const = 0;
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const { return -1; }
|
||||
|
||||
// Microphone volume controls
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) = 0;
|
||||
@ -135,7 +139,11 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
virtual int32_t MicrophoneVolume(uint32_t* volume) const = 0;
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const = 0;
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const = 0;
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const = 0;
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Speaker mute control
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool* available) = 0;
|
||||
@ -147,10 +155,11 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
virtual int32_t SetMicrophoneMute(bool enable) = 0;
|
||||
virtual int32_t MicrophoneMute(bool* enabled) const = 0;
|
||||
|
||||
// Microphone boost control
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool* available) = 0;
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) = 0;
|
||||
virtual int32_t MicrophoneBoost(bool* enabled) const = 0;
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool* available) { return -1; }
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) { return -1; }
|
||||
virtual int32_t MicrophoneBoost(bool* enabled) const { return -1; }
|
||||
|
||||
// Stereo support
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool* available) const = 0;
|
||||
@ -162,23 +171,29 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
virtual int32_t SetRecordingChannel(const ChannelType channel) = 0;
|
||||
virtual int32_t RecordingChannel(ChannelType* channel) const = 0;
|
||||
|
||||
// Delay information and control
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t SetPlayoutBuffer(const BufferType type,
|
||||
uint16_t sizeMS = 0) = 0;
|
||||
virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const = 0;
|
||||
uint16_t sizeMS = 0) { return -1; }
|
||||
virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const {
|
||||
return -1;
|
||||
}
|
||||
// Delay information and control
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const = 0;
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const = 0;
|
||||
|
||||
// CPU load
|
||||
virtual int32_t CPULoad(uint16_t* load) const = 0;
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t CPULoad(uint16_t* load) const { return -1; }
|
||||
|
||||
// Recording of raw PCM data
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) = 0;
|
||||
virtual int32_t StopRawOutputFileRecording() = 0;
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
||||
virtual int32_t StopRawOutputFileRecording() { return -1; }
|
||||
virtual int32_t StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) = 0;
|
||||
virtual int32_t StopRawInputFileRecording() = 0;
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { return -1; }
|
||||
virtual int32_t StopRawInputFileRecording() { return -1; }
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) = 0;
|
||||
@ -186,8 +201,11 @@ class AudioDeviceModule : public RefCountedModule {
|
||||
virtual int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec) = 0;
|
||||
virtual int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const = 0;
|
||||
|
||||
// Deprecated.
|
||||
// TODO(henrika): to be removed.
|
||||
virtual int32_t ResetAudioDevice() { return -1; }
|
||||
|
||||
// Mobile device specific functions
|
||||
virtual int32_t ResetAudioDevice() = 0;
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) = 0;
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const = 0;
|
||||
|
||||
|
||||
@ -90,24 +90,17 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
virtual int32_t SpeakerVolume(uint32_t* volume) const { return 0; }
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t* maxVolume) const { return 0; }
|
||||
virtual int32_t MinSpeakerVolume(uint32_t* minVolume) const { return 0; }
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const { return 0; }
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool* available) { return 0; }
|
||||
virtual int32_t SetMicrophoneVolume(uint32_t volume) { return 0; }
|
||||
virtual int32_t MicrophoneVolume(uint32_t* volume) const { return 0; }
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const { return 0; }
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t* minVolume) const { return 0; }
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool* available) { return 0; }
|
||||
virtual int32_t SetSpeakerMute(bool enable) { return 0; }
|
||||
virtual int32_t SpeakerMute(bool* enabled) const { return 0; }
|
||||
virtual int32_t MicrophoneMuteIsAvailable(bool* available) { return 0; }
|
||||
virtual int32_t SetMicrophoneMute(bool enable) { return 0; }
|
||||
virtual int32_t MicrophoneMute(bool* enabled) const { return 0; }
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool* available) { return 0; }
|
||||
virtual int32_t SetMicrophoneBoost(bool enable) { return 0; }
|
||||
virtual int32_t MicrophoneBoost(bool* enabled) const { return 0; }
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool* available) const {
|
||||
*available = false;
|
||||
return 0;
|
||||
@ -120,29 +113,11 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
virtual int32_t StereoRecording(bool* enabled) const { return 0; }
|
||||
virtual int32_t SetRecordingChannel(const ChannelType channel) { return 0; }
|
||||
virtual int32_t RecordingChannel(ChannelType* channel) const { return 0; }
|
||||
virtual int32_t SetPlayoutBuffer(const BufferType type,
|
||||
uint16_t sizeMS = 0) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t PlayoutDelay(uint16_t* delayMS) const {
|
||||
*delayMS = 0;
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t RecordingDelay(uint16_t* delayMS) const { return 0; }
|
||||
virtual int32_t CPULoad(uint16_t* load) const { return 0; }
|
||||
virtual int32_t StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t StopRawOutputFileRecording() { return 0; }
|
||||
virtual int32_t StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t StopRawInputFileRecording() { return 0; }
|
||||
virtual int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) {
|
||||
return 0;
|
||||
}
|
||||
@ -153,7 +128,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
|
||||
return 0;
|
||||
}
|
||||
virtual int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const { return 0; }
|
||||
virtual int32_t ResetAudioDevice() { return 0; }
|
||||
virtual int32_t SetLoudspeakerStatus(bool enable) { return 0; }
|
||||
virtual int32_t GetLoudspeakerStatus(bool* enabled) const { return 0; }
|
||||
virtual bool BuiltInAECIsAvailable() const { return false; }
|
||||
|
||||
@ -72,22 +72,17 @@ class MockAudioDeviceModule : public AudioDeviceModule {
|
||||
MOCK_CONST_METHOD1(SpeakerVolume, int32_t(uint32_t* volume));
|
||||
MOCK_CONST_METHOD1(MaxSpeakerVolume, int32_t(uint32_t* maxVolume));
|
||||
MOCK_CONST_METHOD1(MinSpeakerVolume, int32_t(uint32_t* minVolume));
|
||||
MOCK_CONST_METHOD1(SpeakerVolumeStepSize, int32_t(uint16_t* stepSize));
|
||||
MOCK_METHOD1(MicrophoneVolumeIsAvailable, int32_t(bool* available));
|
||||
MOCK_METHOD1(SetMicrophoneVolume, int32_t(uint32_t volume));
|
||||
MOCK_CONST_METHOD1(MicrophoneVolume, int32_t(uint32_t* volume));
|
||||
MOCK_CONST_METHOD1(MaxMicrophoneVolume, int32_t(uint32_t* maxVolume));
|
||||
MOCK_CONST_METHOD1(MinMicrophoneVolume, int32_t(uint32_t* minVolume));
|
||||
MOCK_CONST_METHOD1(MicrophoneVolumeStepSize, int32_t(uint16_t* stepSize));
|
||||
MOCK_METHOD1(SpeakerMuteIsAvailable, int32_t(bool* available));
|
||||
MOCK_METHOD1(SetSpeakerMute, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(SpeakerMute, int32_t(bool* enabled));
|
||||
MOCK_METHOD1(MicrophoneMuteIsAvailable, int32_t(bool* available));
|
||||
MOCK_METHOD1(SetMicrophoneMute, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(MicrophoneMute, int32_t(bool* enabled));
|
||||
MOCK_METHOD1(MicrophoneBoostIsAvailable, int32_t(bool* available));
|
||||
MOCK_METHOD1(SetMicrophoneBoost, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(MicrophoneBoost, int32_t(bool* enabled));
|
||||
MOCK_CONST_METHOD1(StereoPlayoutIsAvailable, int32_t(bool* available));
|
||||
MOCK_METHOD1(SetStereoPlayout, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(StereoPlayout, int32_t(bool* enabled));
|
||||
@ -96,24 +91,12 @@ class MockAudioDeviceModule : public AudioDeviceModule {
|
||||
MOCK_CONST_METHOD1(StereoRecording, int32_t(bool* enabled));
|
||||
MOCK_METHOD1(SetRecordingChannel, int32_t(const ChannelType channel));
|
||||
MOCK_CONST_METHOD1(RecordingChannel, int32_t(ChannelType* channel));
|
||||
MOCK_METHOD2(SetPlayoutBuffer, int32_t(const BufferType type,
|
||||
uint16_t sizeMS));
|
||||
MOCK_CONST_METHOD2(PlayoutBuffer, int32_t(BufferType* type,
|
||||
uint16_t* sizeMS));
|
||||
MOCK_CONST_METHOD1(PlayoutDelay, int32_t(uint16_t* delayMS));
|
||||
MOCK_CONST_METHOD1(RecordingDelay, int32_t(uint16_t* delayMS));
|
||||
MOCK_CONST_METHOD1(CPULoad, int32_t(uint16_t* load));
|
||||
MOCK_METHOD1(StartRawOutputFileRecording,
|
||||
int32_t(const char pcmFileNameUTF8[kAdmMaxFileNameSize]));
|
||||
MOCK_METHOD0(StopRawOutputFileRecording, int32_t());
|
||||
MOCK_METHOD1(StartRawInputFileRecording,
|
||||
int32_t(const char pcmFileNameUTF8[kAdmMaxFileNameSize]));
|
||||
MOCK_METHOD0(StopRawInputFileRecording, int32_t());
|
||||
MOCK_METHOD1(SetRecordingSampleRate, int32_t(const uint32_t samplesPerSec));
|
||||
MOCK_CONST_METHOD1(RecordingSampleRate, int32_t(uint32_t* samplesPerSec));
|
||||
MOCK_METHOD1(SetPlayoutSampleRate, int32_t(const uint32_t samplesPerSec));
|
||||
MOCK_CONST_METHOD1(PlayoutSampleRate, int32_t(uint32_t* samplesPerSec));
|
||||
MOCK_METHOD0(ResetAudioDevice, int32_t());
|
||||
MOCK_METHOD1(SetLoudspeakerStatus, int32_t(bool enable));
|
||||
MOCK_CONST_METHOD1(GetLoudspeakerStatus, int32_t(bool* enabled));
|
||||
MOCK_CONST_METHOD0(BuiltInAECIsAvailable, bool());
|
||||
|
||||
@ -93,11 +93,8 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
||||
// These methods are currently not fully implemented on iOS:
|
||||
|
||||
// See audio_device_not_implemented.cc for trivial implementations.
|
||||
int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const override;
|
||||
int32_t ActiveAudioLayer(
|
||||
AudioDeviceModule::AudioLayer& audioLayer) const override;
|
||||
int32_t ResetAudioDevice() override;
|
||||
int32_t PlayoutIsAvailable(bool& available) override;
|
||||
int32_t RecordingIsAvailable(bool& available) override;
|
||||
int32_t SetAGC(bool enable) override;
|
||||
@ -125,31 +122,23 @@ class AudioDeviceIOS : public AudioDeviceGeneric,
|
||||
int32_t SpeakerVolume(uint32_t& volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneVolume(uint32_t volume) override;
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
|
||||
int32_t MicrophoneMuteIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool& enabled) const override;
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override;
|
||||
int32_t SetSpeakerMute(bool enable) override;
|
||||
int32_t SpeakerMute(bool& enabled) const override;
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool& enabled) const override;
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
int32_t StereoPlayout(bool& enabled) const override;
|
||||
int32_t StereoRecordingIsAvailable(bool& available) override;
|
||||
int32_t SetStereoRecording(bool enable) override;
|
||||
int32_t StereoRecording(bool& enabled) const override;
|
||||
int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) override;
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
|
||||
@ -15,23 +15,12 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
int32_t AudioDeviceIOS::PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::ActiveAudioLayer(
|
||||
AudioDeviceModule::AudioLayer& audioLayer) const {
|
||||
audioLayer = AudioDeviceModule::kPlatformDefaultAudio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::ResetAudioDevice() {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int16_t AudioDeviceIOS::PlayoutDevices() {
|
||||
// TODO(henrika): improve.
|
||||
LOG_F(LS_WARNING) << "Not implemented";
|
||||
@ -77,11 +66,6 @@ int32_t AudioDeviceIOS::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::SpeakerMuteIsAvailable(bool& available) {
|
||||
available = false;
|
||||
return 0;
|
||||
@ -146,21 +130,6 @@ int32_t AudioDeviceIOS::MicrophoneMute(bool& enabled) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::MicrophoneBoostIsAvailable(bool& available) {
|
||||
available = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::SetMicrophoneBoost(bool enable) {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::MicrophoneBoost(bool& enabled) const {
|
||||
enabled = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::StereoRecordingIsAvailable(bool& available) {
|
||||
available = false;
|
||||
return 0;
|
||||
@ -227,11 +196,6 @@ int32_t AudioDeviceIOS::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::MicrophoneVolumeStepSize(uint16_t& stepSize) const {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::PlayoutDeviceName(uint16_t index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) {
|
||||
@ -267,16 +231,4 @@ int32_t AudioDeviceIOS::RecordingIsAvailable(bool& available) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceIOS::CPULoad(uint16_t&) const {
|
||||
RTC_NOTREACHED() << "Not implemented";
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -82,7 +82,6 @@ AudioDeviceLinuxALSA::AudioDeviceLinuxALSA() :
|
||||
_playoutBuffer(NULL),
|
||||
_recordingFramesLeft(0),
|
||||
_playoutFramesLeft(0),
|
||||
_playBufType(AudioDeviceModule::kFixedBufferSize),
|
||||
_initialized(false),
|
||||
_recording(false),
|
||||
_playing(false),
|
||||
@ -94,9 +93,7 @@ AudioDeviceLinuxALSA::AudioDeviceLinuxALSA() :
|
||||
_playWarning(0),
|
||||
_playError(0),
|
||||
_recWarning(0),
|
||||
_recError(0),
|
||||
_playBufDelay(80),
|
||||
_playBufDelayFixed(80)
|
||||
_recError(0)
|
||||
{
|
||||
memset(_oldKeyState, 0, sizeof(_oldKeyState));
|
||||
LOG(LS_INFO) << __FUNCTION__ << " created";
|
||||
@ -353,22 +350,6 @@ int32_t AudioDeviceLinuxALSA::MinSpeakerVolume(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::SpeakerVolumeStepSize(
|
||||
uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.SpeakerVolumeStepSize(delta) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::SpeakerMuteIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
@ -477,58 +458,6 @@ int32_t AudioDeviceLinuxALSA::MicrophoneMute(bool& enabled) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::MicrophoneBoostIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
bool isAvailable(false);
|
||||
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
|
||||
|
||||
// Enumerate all avaliable microphone and make an attempt to open up the
|
||||
// input mixer corresponding to the currently selected input device.
|
||||
//
|
||||
if (!wasInitialized && InitMicrophone() == -1)
|
||||
{
|
||||
// If we end up here it means that the selected microphone has no volume
|
||||
// control, hence it is safe to state that there is no boost control
|
||||
// already at this stage.
|
||||
available = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if the selected microphone has a boost control
|
||||
_mixerManager.MicrophoneBoostIsAvailable(isAvailable);
|
||||
available = isAvailable;
|
||||
|
||||
// Close the initialized input mixer
|
||||
if (!wasInitialized)
|
||||
{
|
||||
_mixerManager.CloseMicrophone();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::SetMicrophoneBoost(bool enable)
|
||||
{
|
||||
|
||||
return (_mixerManager.SetMicrophoneBoost(enable));
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::MicrophoneBoost(bool& enabled) const
|
||||
{
|
||||
|
||||
bool onOff(0);
|
||||
|
||||
if (_mixerManager.MicrophoneBoost(onOff) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
enabled = onOff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::StereoRecordingIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
@ -769,22 +698,6 @@ int32_t AudioDeviceLinuxALSA::MinMicrophoneVolume(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::MicrophoneVolumeStepSize(
|
||||
uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.MicrophoneVolumeStepSize(delta) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t AudioDeviceLinuxALSA::PlayoutDevices()
|
||||
{
|
||||
|
||||
@ -1533,45 +1446,6 @@ bool AudioDeviceLinuxALSA::Playing() const
|
||||
{
|
||||
return (_playing);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetPlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS)
|
||||
{
|
||||
_playBufType = type;
|
||||
if (type == AudioDeviceModule::kFixedBufferSize)
|
||||
{
|
||||
_playBufDelayFixed = sizeMS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const
|
||||
{
|
||||
type = _playBufType;
|
||||
if (type == AudioDeviceModule::kFixedBufferSize)
|
||||
{
|
||||
sizeMS = _playBufDelayFixed;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeMS = _playBufDelay;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxALSA::CPULoad(uint16_t& load) const
|
||||
{
|
||||
|
||||
LOG(LS_WARNING) << "API call not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxALSA::PlayoutWarning() const
|
||||
{
|
||||
|
||||
@ -95,7 +95,6 @@ public:
|
||||
int32_t SpeakerVolume(uint32_t& volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Microphone volume controls
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override;
|
||||
@ -103,7 +102,6 @@ public:
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Speaker mute control
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override;
|
||||
@ -115,11 +113,6 @@ public:
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool& enabled) const override;
|
||||
|
||||
// Microphone boost control
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool& enabled) const override;
|
||||
|
||||
// Stereo support
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
@ -129,26 +122,19 @@ public:
|
||||
int32_t StereoRecording(bool& enabled) const override;
|
||||
|
||||
// Delay information and control
|
||||
int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) override;
|
||||
int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const override;
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
bool RecordingError() const override;
|
||||
void ClearPlayoutWarning() override;
|
||||
void ClearPlayoutError() override;
|
||||
void ClearRecordingWarning() override;
|
||||
void ClearRecordingError() override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
bool RecordingError() const override;
|
||||
void ClearPlayoutWarning() override;
|
||||
void ClearPlayoutError() override;
|
||||
void ClearRecordingWarning() override;
|
||||
void ClearRecordingError() override;
|
||||
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
|
||||
|
||||
private:
|
||||
int32_t GetDevicesInfo(const int32_t function,
|
||||
@ -210,8 +196,6 @@ private:
|
||||
uint32_t _recordingFramesLeft;
|
||||
uint32_t _playoutFramesLeft;
|
||||
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
|
||||
bool _initialized;
|
||||
bool _recording;
|
||||
bool _playing;
|
||||
@ -227,9 +211,6 @@ private:
|
||||
uint16_t _recWarning;
|
||||
uint16_t _recError;
|
||||
|
||||
uint16_t _playBufDelay; // playback delay
|
||||
uint16_t _playBufDelayFixed; // fixed playback delay
|
||||
|
||||
char _oldKeyState[32];
|
||||
#if defined(USE_X11)
|
||||
Display* _XDisplay;
|
||||
|
||||
@ -40,7 +40,6 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
|
||||
sample_rate_hz_(0),
|
||||
_recChannels(1),
|
||||
_playChannels(1),
|
||||
_playBufType(AudioDeviceModule::kFixedBufferSize),
|
||||
_initialized(false),
|
||||
_recording(false),
|
||||
_playing(false),
|
||||
@ -52,7 +51,6 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
|
||||
_stopPlay(false),
|
||||
_AGC(false),
|
||||
update_speaker_volume_at_startup_(false),
|
||||
_playBufDelayFixed(20),
|
||||
_sndCardPlayDelay(0),
|
||||
_sndCardRecDelay(0),
|
||||
_writeErrors(0),
|
||||
@ -398,19 +396,6 @@ int32_t AudioDeviceLinuxPulse::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.SpeakerVolumeStepSize(delta) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::SpeakerMuteIsAvailable(bool& available) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
bool isAvailable(false);
|
||||
@ -502,52 +487,6 @@ int32_t AudioDeviceLinuxPulse::MicrophoneMute(bool& enabled) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::MicrophoneBoostIsAvailable(bool& available) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
bool isAvailable(false);
|
||||
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
|
||||
|
||||
// Enumerate all avaliable microphone and make an attempt to open up the
|
||||
// input mixer corresponding to the currently selected input device.
|
||||
//
|
||||
if (!wasInitialized && InitMicrophone() == -1) {
|
||||
// If we end up here it means that the selected microphone has no
|
||||
// volume control, hence it is safe to state that there is no
|
||||
// boost control already at this stage.
|
||||
available = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if the selected microphone has a boost control
|
||||
_mixerManager.MicrophoneBoostIsAvailable(isAvailable);
|
||||
available = isAvailable;
|
||||
|
||||
// Close the initialized input mixer
|
||||
if (!wasInitialized) {
|
||||
_mixerManager.CloseMicrophone();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::SetMicrophoneBoost(bool enable) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
return (_mixerManager.SetMicrophoneBoost(enable));
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::MicrophoneBoost(bool& enabled) const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
bool onOff(0);
|
||||
|
||||
if (_mixerManager.MicrophoneBoost(onOff) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
enabled = onOff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::StereoRecordingIsAvailable(bool& available) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (_recChannels == 2 && _recording) {
|
||||
@ -727,20 +666,6 @@ int32_t AudioDeviceLinuxPulse::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::MicrophoneVolumeStepSize(
|
||||
uint16_t& stepSize) const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.MicrophoneVolumeStepSize(delta) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t AudioDeviceLinuxPulse::PlayoutDevices() {
|
||||
PaLock();
|
||||
|
||||
@ -1367,36 +1292,6 @@ bool AudioDeviceLinuxPulse::Playing() const {
|
||||
return (_playing);
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (type != AudioDeviceModule::kFixedBufferSize) {
|
||||
LOG(LS_ERROR) << "Adaptive buffer size not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
_playBufType = type;
|
||||
_playBufDelayFixed = sizeMS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
type = _playBufType;
|
||||
sizeMS = _playBufDelayFixed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceLinuxPulse::CPULoad(uint16_t& /*load*/) const {
|
||||
LOG(LS_WARNING) << "API call not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AudioDeviceLinuxPulse::PlayoutWarning() const {
|
||||
rtc::CritScope lock(&_critSect);
|
||||
return (_playWarning > 0);
|
||||
|
||||
@ -157,7 +157,6 @@ public:
|
||||
int32_t SpeakerVolume(uint32_t& volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Microphone volume controls
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available) override;
|
||||
@ -165,7 +164,6 @@ public:
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const override;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const override;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const override;
|
||||
|
||||
// Speaker mute control
|
||||
int32_t SpeakerMuteIsAvailable(bool& available) override;
|
||||
@ -177,11 +175,6 @@ public:
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool& enabled) const override;
|
||||
|
||||
// Microphone boost control
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool& enabled) const override;
|
||||
|
||||
// Stereo support
|
||||
int32_t StereoPlayoutIsAvailable(bool& available) override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
@ -191,16 +184,9 @@ public:
|
||||
int32_t StereoRecording(bool& enabled) const override;
|
||||
|
||||
// Delay information and control
|
||||
int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) override;
|
||||
int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const override;
|
||||
int32_t PlayoutDelay(uint16_t& delayMS) const override;
|
||||
int32_t RecordingDelay(uint16_t& delayMS) const override;
|
||||
|
||||
// CPU load
|
||||
int32_t CPULoad(uint16_t& load) const override;
|
||||
|
||||
bool PlayoutWarning() const override;
|
||||
bool PlayoutError() const override;
|
||||
bool RecordingWarning() const override;
|
||||
@ -295,8 +281,6 @@ private:
|
||||
uint8_t _recChannels;
|
||||
uint8_t _playChannels;
|
||||
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
|
||||
// Stores thread ID in constructor.
|
||||
// We can then use ThreadChecker::CalledOnValidThread() to ensure that
|
||||
// other methods are called from the same thread.
|
||||
@ -315,8 +299,6 @@ private:
|
||||
bool _AGC;
|
||||
bool update_speaker_volume_at_startup_;
|
||||
|
||||
uint16_t _playBufDelayFixed; // fixed playback delay
|
||||
|
||||
uint32_t _sndCardPlayDelay;
|
||||
uint32_t _sndCardRecDelay;
|
||||
|
||||
|
||||
@ -534,22 +534,6 @@ int32_t AudioMixerManagerLinuxALSA::MinSpeakerVolume(
|
||||
}
|
||||
*/
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::SpeakerVolumeStepSize(
|
||||
uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
if (_outputMixerHandle == NULL)
|
||||
{
|
||||
LOG(LS_WARNING) << "no avaliable output mixer exists";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The step size is always 1 for ALSA
|
||||
stepSize = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::SpeakerVolumeIsAvailable(
|
||||
bool& available)
|
||||
{
|
||||
@ -743,63 +727,6 @@ int32_t AudioMixerManagerLinuxALSA::MicrophoneMute(bool& enabled) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::MicrophoneBoostIsAvailable(
|
||||
bool& available)
|
||||
{
|
||||
if (_inputMixerHandle == NULL)
|
||||
{
|
||||
LOG(LS_WARNING) << "no avaliable input mixer exists";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Microphone boost cannot be enabled through ALSA Simple Mixer Interface
|
||||
available = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::SetMicrophoneBoost(bool enable)
|
||||
{
|
||||
LOG(LS_VERBOSE) << "AudioMixerManagerLinuxALSA::SetMicrophoneBoost(enable="
|
||||
<< enable << ")";
|
||||
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_inputMixerHandle == NULL)
|
||||
{
|
||||
LOG(LS_WARNING) << "no avaliable input mixer exists";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Ensure that the selected microphone destination has a valid mute control.
|
||||
bool available(false);
|
||||
MicrophoneMuteIsAvailable(available);
|
||||
if (!available)
|
||||
{
|
||||
LOG(LS_WARNING) << "it is not possible to enable microphone boost";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// It is assumed that the call above fails!
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::MicrophoneBoost(bool& enabled) const
|
||||
{
|
||||
|
||||
if (_inputMixerHandle == NULL)
|
||||
{
|
||||
LOG(LS_WARNING) << "no avaliable input mixer exists";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Microphone boost cannot be enabled on this platform!
|
||||
enabled = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::MicrophoneVolumeIsAvailable(
|
||||
bool& available)
|
||||
{
|
||||
@ -1027,22 +954,6 @@ int32_t AudioMixerManagerLinuxALSA::MinMicrophoneVolume(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxALSA::MicrophoneVolumeStepSize(
|
||||
uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
if (_inputMixerHandle == NULL)
|
||||
{
|
||||
LOG(LS_WARNING) << "no avaliable input mixer exists";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The step size is always 1 for ALSA
|
||||
stepSize = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Private Methods
|
||||
// ============================================================================
|
||||
|
||||
@ -30,7 +30,6 @@ public:
|
||||
int32_t SpeakerVolume(uint32_t& volume) const;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t SpeakerVolumeIsAvailable(bool& available);
|
||||
int32_t SpeakerMuteIsAvailable(bool& available);
|
||||
int32_t SetSpeakerMute(bool enable);
|
||||
@ -38,15 +37,11 @@ public:
|
||||
int32_t MicrophoneMuteIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneMute(bool enable);
|
||||
int32_t MicrophoneMute(bool& enabled) const;
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneBoost(bool enable);
|
||||
int32_t MicrophoneBoost(bool& enabled) const;
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneVolume(uint32_t volume);
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t Close();
|
||||
int32_t CloseSpeaker();
|
||||
int32_t CloseMicrophone();
|
||||
|
||||
@ -343,27 +343,6 @@ AudioMixerManagerLinuxPulse::MinSpeakerVolume(uint32_t& minVolume) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize(uint16_t& stepSize) const
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (_paOutputDeviceIndex == -1)
|
||||
{
|
||||
LOG(LS_WARNING) << "output device index has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The sink input (stream) will always have step size = 1
|
||||
// There are PA_VOLUME_NORM+1 steps
|
||||
stepSize = 1;
|
||||
|
||||
LOG(LS_VERBOSE)
|
||||
<< "AudioMixerManagerLinuxPulse::SpeakerVolumeStepSize() => size="
|
||||
<< stepSize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
AudioMixerManagerLinuxPulse::SpeakerVolumeIsAvailable(bool& available)
|
||||
{
|
||||
@ -653,65 +632,6 @@ int32_t AudioMixerManagerLinuxPulse::MicrophoneMute(bool& enabled) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t
|
||||
AudioMixerManagerLinuxPulse::MicrophoneBoostIsAvailable(bool& available)
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (_paInputDeviceIndex == -1)
|
||||
{
|
||||
LOG(LS_WARNING) << "input device index has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Always unavailable in Pulse Audio
|
||||
// Could make it possible to use PA_VOLUME_MAX
|
||||
// but that gives bad audio with some sound cards
|
||||
available = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxPulse::SetMicrophoneBoost(bool enable)
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
LOG(LS_VERBOSE) << "AudioMixerManagerLinuxPulse::SetMicrophoneBoost(enable="
|
||||
<< enable << ")";
|
||||
|
||||
if (_paInputDeviceIndex == -1)
|
||||
{
|
||||
LOG(LS_WARNING) << "input device index has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Ensure the selected microphone destination has a valid boost control
|
||||
bool available(false);
|
||||
MicrophoneBoostIsAvailable(available);
|
||||
if (!available)
|
||||
{
|
||||
LOG(LS_WARNING) << "it is not possible to enable microphone boost";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// It is assumed that the call above fails!
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxPulse::MicrophoneBoost(bool& enabled) const
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (_paInputDeviceIndex == -1)
|
||||
{
|
||||
LOG(LS_WARNING) << "input device index has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Microphone boost cannot be enabled on this platform!
|
||||
enabled = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeIsAvailable(
|
||||
bool& available)
|
||||
{
|
||||
@ -875,48 +795,6 @@ AudioMixerManagerLinuxPulse::MinMicrophoneVolume(uint32_t& minVolume) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize(
|
||||
uint16_t& stepSize) const
|
||||
{
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (_paInputDeviceIndex == -1)
|
||||
{
|
||||
LOG(LS_WARNING) << "input device index has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t deviceIndex = (uint32_t) _paInputDeviceIndex;
|
||||
|
||||
AutoPulseLock auto_lock(_paMainloop);
|
||||
|
||||
// Get the actual stream device index if we have a connected stream
|
||||
// The device used by the stream can be changed
|
||||
// during the call
|
||||
if (_paRecStream && (LATE(pa_stream_get_state)(_paRecStream)
|
||||
!= PA_STREAM_UNCONNECTED))
|
||||
{
|
||||
deviceIndex = LATE(pa_stream_get_device_index)(_paRecStream);
|
||||
}
|
||||
|
||||
pa_operation* paOperation = NULL;
|
||||
|
||||
// Get info for this source
|
||||
paOperation
|
||||
= LATE(pa_context_get_source_info_by_index)(_paContext, deviceIndex,
|
||||
PaSourceInfoCallback,
|
||||
(void*) this);
|
||||
|
||||
WaitForOperationCompletion(paOperation);
|
||||
|
||||
stepSize = static_cast<uint16_t> ((PA_VOLUME_NORM + 1) / _paVolSteps);
|
||||
|
||||
LOG(LS_VERBOSE)
|
||||
<< "AudioMixerManagerLinuxPulse::MicrophoneVolumeStepSize() => size="
|
||||
<< stepSize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Private Methods
|
||||
// ===========================================================================
|
||||
|
||||
@ -37,7 +37,6 @@ public:
|
||||
int32_t SpeakerVolume(uint32_t& volume) const;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t SpeakerVolumeIsAvailable(bool& available);
|
||||
int32_t SpeakerMuteIsAvailable(bool& available);
|
||||
int32_t SetSpeakerMute(bool enable);
|
||||
@ -47,15 +46,11 @@ public:
|
||||
int32_t MicrophoneMuteIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneMute(bool enable);
|
||||
int32_t MicrophoneMute(bool& enabled) const;
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneBoost(bool enable);
|
||||
int32_t MicrophoneBoost(bool& enabled) const;
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneVolume(uint32_t volume);
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t SetPulseAudioObjects(pa_threaded_mainloop* mainloop,
|
||||
pa_context* context);
|
||||
int32_t Close();
|
||||
|
||||
@ -125,7 +125,6 @@ AudioDeviceMac::AudioDeviceMac()
|
||||
_playChannels(N_PLAY_CHANNELS),
|
||||
_captureBufData(NULL),
|
||||
_renderBufData(NULL),
|
||||
_playBufType(AudioDeviceModule::kFixedBufferSize),
|
||||
_initialized(false),
|
||||
_isShutDown(false),
|
||||
_recording(false),
|
||||
@ -145,7 +144,6 @@ AudioDeviceMac::AudioDeviceMac()
|
||||
_captureDelayUs(0),
|
||||
_renderDelayUs(0),
|
||||
_renderDelayOffsetSamples(0),
|
||||
_playBufDelayFixed(20),
|
||||
_playWarning(0),
|
||||
_playError(0),
|
||||
_recWarning(0),
|
||||
@ -570,17 +568,6 @@ int32_t AudioDeviceMac::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.SpeakerVolumeStepSize(delta) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::SpeakerMuteIsAvailable(bool& available) {
|
||||
bool isAvailable(false);
|
||||
bool wasInitialized = _mixerManager.SpeakerIsInitialized();
|
||||
@ -670,50 +657,6 @@ int32_t AudioDeviceMac::MicrophoneMute(bool& enabled) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::MicrophoneBoostIsAvailable(bool& available) {
|
||||
bool isAvailable(false);
|
||||
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
|
||||
|
||||
// Enumerate all avaliable microphone and make an attempt to open up the
|
||||
// input mixer corresponding to the currently selected input device.
|
||||
//
|
||||
if (!wasInitialized && InitMicrophone() == -1) {
|
||||
// If we end up here it means that the selected microphone has no volume
|
||||
// control, hence it is safe to state that there is no boost control
|
||||
// already at this stage.
|
||||
available = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if the selected microphone has a boost control
|
||||
//
|
||||
_mixerManager.MicrophoneBoostIsAvailable(isAvailable);
|
||||
available = isAvailable;
|
||||
|
||||
// Close the initialized input mixer
|
||||
//
|
||||
if (!wasInitialized) {
|
||||
_mixerManager.CloseMicrophone();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::SetMicrophoneBoost(bool enable) {
|
||||
return (_mixerManager.SetMicrophoneBoost(enable));
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::MicrophoneBoost(bool& enabled) const {
|
||||
bool onOff(0);
|
||||
|
||||
if (_mixerManager.MicrophoneBoost(onOff) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
enabled = onOff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::StereoRecordingIsAvailable(bool& available) {
|
||||
bool isAvailable(false);
|
||||
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
|
||||
@ -873,17 +816,6 @@ int32_t AudioDeviceMac::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::MicrophoneVolumeStepSize(uint16_t& stepSize) const {
|
||||
uint16_t delta(0);
|
||||
|
||||
if (_mixerManager.MicrophoneVolumeStepSize(delta) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = delta;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t AudioDeviceMac::PlayoutDevices() {
|
||||
AudioDeviceID playDevices[MaxNumberDevices];
|
||||
return GetNumberDevices(kAudioDevicePropertyScopeOutput, playDevices,
|
||||
@ -1623,34 +1555,6 @@ bool AudioDeviceMac::Playing() const {
|
||||
return (_playing);
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS) {
|
||||
if (type != AudioDeviceModule::kFixedBufferSize) {
|
||||
LOG(LS_ERROR) << "Adaptive buffer size not supported on this platform";
|
||||
return -1;
|
||||
}
|
||||
|
||||
_playBufType = type;
|
||||
_playBufDelayFixed = sizeMS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioDeviceMac::PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const {
|
||||
type = _playBufType;
|
||||
sizeMS = _playBufDelayFixed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Not implemented for Mac.
|
||||
int32_t AudioDeviceMac::CPULoad(uint16_t& /*load*/) const {
|
||||
LOG(LS_WARNING) << "API call not supported on this platform";
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AudioDeviceMac::PlayoutWarning() const {
|
||||
return (_playWarning > 0);
|
||||
}
|
||||
@ -1978,9 +1882,10 @@ OSStatus AudioDeviceMac::SetDesiredPlayoutFormat() {
|
||||
WEBRTC_CA_RETURN_ON_ERR(AudioConverterNew(
|
||||
&_outDesiredFormat, &_outStreamFormat, &_renderConverter));
|
||||
|
||||
// Try to set buffer size to desired value (_playBufDelayFixed).
|
||||
// Try to set buffer size to desired value set to 20ms.
|
||||
const uint16_t kPlayBufDelayFixed = 20;
|
||||
UInt32 bufByteCount = static_cast<UInt32>(
|
||||
(_outStreamFormat.mSampleRate / 1000.0) * _playBufDelayFixed *
|
||||
(_outStreamFormat.mSampleRate / 1000.0) * kPlayBufDelayFixed *
|
||||
_outStreamFormat.mChannelsPerFrame * sizeof(Float32));
|
||||
if (_outStreamFormat.mFramesPerPacket != 0) {
|
||||
if (bufByteCount % _outStreamFormat.mFramesPerPacket != 0) {
|
||||
|
||||
@ -123,7 +123,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
virtual int32_t SpeakerVolume(uint32_t& volume) const;
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
|
||||
virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const;
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
|
||||
|
||||
// Microphone volume controls
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool& available);
|
||||
@ -131,7 +130,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
virtual int32_t MicrophoneVolume(uint32_t& volume) const;
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const;
|
||||
|
||||
// Microphone mute control
|
||||
virtual int32_t MicrophoneMuteIsAvailable(bool& available);
|
||||
@ -143,11 +141,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
virtual int32_t SetSpeakerMute(bool enable);
|
||||
virtual int32_t SpeakerMute(bool& enabled) const;
|
||||
|
||||
// Microphone boost control
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool& available);
|
||||
virtual int32_t SetMicrophoneBoost(bool enable);
|
||||
virtual int32_t MicrophoneBoost(bool& enabled) const;
|
||||
|
||||
// Stereo support
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool& available);
|
||||
virtual int32_t SetStereoPlayout(bool enable);
|
||||
@ -157,16 +150,9 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
virtual int32_t StereoRecording(bool& enabled) const;
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type,
|
||||
uint16_t sizeMS);
|
||||
virtual int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type,
|
||||
uint16_t& sizeMS) const;
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const;
|
||||
|
||||
// CPU load
|
||||
virtual int32_t CPULoad(uint16_t& load) const;
|
||||
|
||||
virtual bool PlayoutWarning() const;
|
||||
virtual bool PlayoutError() const;
|
||||
virtual bool RecordingWarning() const;
|
||||
@ -312,8 +298,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
|
||||
SInt16 _renderConvertData[PLAY_BUF_SIZE_IN_SAMPLES];
|
||||
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
|
||||
bool _initialized;
|
||||
bool _isShutDown;
|
||||
bool _recording;
|
||||
@ -349,8 +333,6 @@ class AudioDeviceMac : public AudioDeviceGeneric {
|
||||
|
||||
int32_t _renderDelayOffsetSamples;
|
||||
|
||||
uint16_t _playBufDelayFixed; // fixed playback delay
|
||||
|
||||
uint16_t _playWarning;
|
||||
uint16_t _playError;
|
||||
uint16_t _recWarning;
|
||||
|
||||
@ -337,19 +337,6 @@ int32_t AudioMixerManagerMac::MinSpeakerVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::SpeakerVolumeStepSize(uint16_t& stepSize) const {
|
||||
if (_outputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// volume range is 0.0 to 1.0
|
||||
// we convert that to 0 - 255
|
||||
stepSize = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::SpeakerVolumeIsAvailable(bool& available) {
|
||||
if (_outputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
@ -704,52 +691,6 @@ int32_t AudioMixerManagerMac::MicrophoneMute(bool& enabled) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::MicrophoneBoostIsAvailable(bool& available) {
|
||||
if (_inputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
available = false; // No AudioObjectPropertySelector value for Mic Boost
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::SetMicrophoneBoost(bool enable) {
|
||||
LOG(LS_VERBOSE) << "AudioMixerManagerMac::SetMicrophoneBoost(enable="
|
||||
<< enable << ")";
|
||||
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
if (_inputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Ensure that the selected microphone has a valid boost control.
|
||||
bool available(false);
|
||||
MicrophoneBoostIsAvailable(available);
|
||||
if (!available) {
|
||||
LOG(LS_WARNING) << "it is not possible to enable microphone boost";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// It is assumed that the call above fails!
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::MicrophoneBoost(bool& enabled) const {
|
||||
if (_inputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Microphone boost cannot be enabled on this platform!
|
||||
enabled = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::MicrophoneVolumeIsAvailable(bool& available) {
|
||||
if (_inputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
@ -929,20 +870,6 @@ int32_t AudioMixerManagerMac::MinMicrophoneVolume(uint32_t& minVolume) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AudioMixerManagerMac::MicrophoneVolumeStepSize(
|
||||
uint16_t& stepSize) const {
|
||||
if (_inputDeviceID == kAudioObjectUnknown) {
|
||||
LOG(LS_WARNING) << "device ID has not been set";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// volume range is 0.0 to 1.0
|
||||
// we convert that to 0 - 10
|
||||
stepSize = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Private Methods
|
||||
// ============================================================================
|
||||
|
||||
@ -28,7 +28,6 @@ class AudioMixerManagerMac {
|
||||
int32_t SpeakerVolume(uint32_t& volume) const;
|
||||
int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinSpeakerVolume(uint32_t& minVolume) const;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t SpeakerVolumeIsAvailable(bool& available);
|
||||
int32_t SpeakerMuteIsAvailable(bool& available);
|
||||
int32_t SetSpeakerMute(bool enable);
|
||||
@ -38,15 +37,11 @@ class AudioMixerManagerMac {
|
||||
int32_t MicrophoneMuteIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneMute(bool enable);
|
||||
int32_t MicrophoneMute(bool& enabled) const;
|
||||
int32_t MicrophoneBoostIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneBoost(bool enable);
|
||||
int32_t MicrophoneBoost(bool& enabled) const;
|
||||
int32_t MicrophoneVolumeIsAvailable(bool& available);
|
||||
int32_t SetMicrophoneVolume(uint32_t volume);
|
||||
int32_t MicrophoneVolume(uint32_t& volume) const;
|
||||
int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
|
||||
int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const;
|
||||
int32_t Close();
|
||||
int32_t CloseSpeaker();
|
||||
int32_t CloseMicrophone();
|
||||
|
||||
@ -438,7 +438,6 @@ AudioDeviceWindowsCore::AudioDeviceWindowsCore()
|
||||
_sndCardRecDelay(0),
|
||||
_writtenSamples(0),
|
||||
_readSamples(0),
|
||||
_playAcc(0),
|
||||
_recAudioFrameSize(0),
|
||||
_recSampleRate(0),
|
||||
_recBlockSize(0),
|
||||
@ -469,9 +468,7 @@ AudioDeviceWindowsCore::AudioDeviceWindowsCore()
|
||||
_playError(0),
|
||||
_recWarning(0),
|
||||
_recError(0),
|
||||
_playBufType(AudioDeviceModule::kAdaptiveBufferSize),
|
||||
_playBufDelay(80),
|
||||
_playBufDelayFixed(80),
|
||||
_usingInputDeviceIndex(false),
|
||||
_usingOutputDeviceIndex(false),
|
||||
_inputDevice(AudioDeviceModule::kDefaultCommunicationDevice),
|
||||
@ -530,7 +527,6 @@ AudioDeviceWindowsCore::AudioDeviceWindowsCore()
|
||||
|
||||
_perfCounterFreq.QuadPart = 1;
|
||||
_perfCounterFactor = 0.0;
|
||||
_avgCPULoad = 0.0;
|
||||
|
||||
// list of number of channels to use on recording side
|
||||
_recChannelsPrioList[0] = 2; // stereo is prio 1
|
||||
@ -1083,23 +1079,6 @@ int32_t AudioDeviceWindowsCore::MinSpeakerVolume(uint32_t& minVolume) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SpeakerVolumeStepSize
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::SpeakerVolumeStepSize(uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
if (!_speakerIsInitialized)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = CORE_SPEAKER_VOLUME_STEP_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SpeakerMuteIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1327,47 +1306,6 @@ Exit:
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneBoostIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::MicrophoneBoostIsAvailable(bool& available)
|
||||
{
|
||||
|
||||
available = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetMicrophoneBoost
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::SetMicrophoneBoost(bool enable)
|
||||
{
|
||||
|
||||
if (!_microphoneIsInitialized)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneBoost
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::MicrophoneBoost(bool& enabled) const
|
||||
{
|
||||
|
||||
if (!_microphoneIsInitialized)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StereoRecordingIsAvailable
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1650,23 +1588,6 @@ int32_t AudioDeviceWindowsCore::MinMicrophoneVolume(uint32_t& minVolume) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MicrophoneVolumeStepSize
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::MicrophoneVolumeStepSize(uint16_t& stepSize) const
|
||||
{
|
||||
|
||||
if (!_microphoneIsInitialized)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
stepSize = CORE_MICROPHONE_VOLUME_STEP_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutDevices
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -2827,8 +2748,6 @@ int32_t AudioDeviceWindowsCore::StartRecording()
|
||||
}
|
||||
LOG(LS_VERBOSE) << "capture audio stream has now started...";
|
||||
|
||||
_avgCPULoad = 0.0f;
|
||||
_playAcc = 0;
|
||||
_recording = true;
|
||||
|
||||
return 0;
|
||||
@ -3141,58 +3060,6 @@ bool AudioDeviceWindowsCore::Playing() const
|
||||
{
|
||||
return (_playing);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetPlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::SetPlayoutBuffer(const AudioDeviceModule::BufferType type, uint16_t sizeMS)
|
||||
{
|
||||
|
||||
rtc::CritScope lock(&_critSect);
|
||||
|
||||
_playBufType = type;
|
||||
|
||||
if (type == AudioDeviceModule::kFixedBufferSize)
|
||||
{
|
||||
_playBufDelayFixed = sizeMS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::PlayoutBuffer(AudioDeviceModule::BufferType& type, uint16_t& sizeMS) const
|
||||
{
|
||||
rtc::CritScope lock(&_critSect);
|
||||
type = _playBufType;
|
||||
|
||||
if (type == AudioDeviceModule::kFixedBufferSize)
|
||||
{
|
||||
sizeMS = _playBufDelayFixed;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use same value as for PlayoutDelay
|
||||
sizeMS = static_cast<uint16_t>(_sndCardPlayDelay);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CPULoad
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int32_t AudioDeviceWindowsCore::CPULoad(uint16_t& load) const
|
||||
{
|
||||
|
||||
load = static_cast<uint16_t> (100*_avgCPULoad);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PlayoutWarning
|
||||
@ -3388,10 +3255,6 @@ DWORD AudioDeviceWindowsCore::DoRenderThread()
|
||||
HRESULT hr = S_OK;
|
||||
HANDLE hMmTask = NULL;
|
||||
|
||||
LARGE_INTEGER t1;
|
||||
LARGE_INTEGER t2;
|
||||
int32_t time(0);
|
||||
|
||||
// Initialize COM as MTA in this thread.
|
||||
ScopedCOMInitializer comInit(ScopedCOMInitializer::kMTA);
|
||||
if (!comInit.succeeded()) {
|
||||
@ -3558,8 +3421,6 @@ DWORD AudioDeviceWindowsCore::DoRenderThread()
|
||||
_ptrRenderClient->GetBuffer(_playBlockSizeInFrames, &pData);
|
||||
EXIT_ON_ERROR(hr);
|
||||
|
||||
QueryPerformanceCounter(&t1); // measure time: START
|
||||
|
||||
if (_ptrAudioBuffer)
|
||||
{
|
||||
// Request data to be played out (#bytes =
|
||||
@ -3596,10 +3457,6 @@ DWORD AudioDeviceWindowsCore::DoRenderThread()
|
||||
nSamples = _ptrAudioBuffer->GetPlayoutData((int8_t*)pData);
|
||||
}
|
||||
|
||||
QueryPerformanceCounter(&t2); // measure time: STOP
|
||||
time = (int)(t2.QuadPart-t1.QuadPart);
|
||||
_playAcc += time;
|
||||
|
||||
DWORD dwFlags(0);
|
||||
hr = _ptrRenderClient->ReleaseBuffer(_playBlockSizeInFrames,
|
||||
dwFlags);
|
||||
@ -3878,8 +3735,6 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
LARGE_INTEGER t1;
|
||||
LARGE_INTEGER t2;
|
||||
int32_t time(0);
|
||||
|
||||
BYTE* syncBuffer = NULL;
|
||||
UINT32 syncBufIndex = 0;
|
||||
@ -4068,22 +3923,10 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
|
||||
|
||||
_ptrAudioBuffer->SetTypingStatus(KeyPressed());
|
||||
|
||||
QueryPerformanceCounter(&t1); // measure time: START
|
||||
|
||||
_UnLock(); // release lock while making the callback
|
||||
_ptrAudioBuffer->DeliverRecordedData();
|
||||
_Lock(); // restore the lock
|
||||
|
||||
QueryPerformanceCounter(&t2); // measure time: STOP
|
||||
|
||||
// Measure "average CPU load".
|
||||
// Basically what we do here is to measure how many percent of our 10ms period
|
||||
// is used for encoding and decoding. This value shuld be used as a warning indicator
|
||||
// only and not seen as an absolute value. Running at ~100% will lead to bad QoS.
|
||||
time = (int)(t2.QuadPart - t1.QuadPart);
|
||||
_avgCPULoad = (float)(_avgCPULoad*.99 + (time + _playAcc) / (double)(_perfCounterFreq.QuadPart));
|
||||
_playAcc = 0;
|
||||
|
||||
// Sanity check to ensure that essential states are not modified during the unlocked period
|
||||
if (_ptrCaptureClient == NULL || _ptrClientIn == NULL)
|
||||
{
|
||||
|
||||
@ -145,7 +145,6 @@ public:
|
||||
virtual int32_t SpeakerVolume(uint32_t& volume) const;
|
||||
virtual int32_t MaxSpeakerVolume(uint32_t& maxVolume) const;
|
||||
virtual int32_t MinSpeakerVolume(uint32_t& minVolume) const;
|
||||
virtual int32_t SpeakerVolumeStepSize(uint16_t& stepSize) const;
|
||||
|
||||
// Microphone volume controls
|
||||
virtual int32_t MicrophoneVolumeIsAvailable(bool& available);
|
||||
@ -153,7 +152,6 @@ public:
|
||||
virtual int32_t MicrophoneVolume(uint32_t& volume) const;
|
||||
virtual int32_t MaxMicrophoneVolume(uint32_t& maxVolume) const;
|
||||
virtual int32_t MinMicrophoneVolume(uint32_t& minVolume) const;
|
||||
virtual int32_t MicrophoneVolumeStepSize(uint16_t& stepSize) const;
|
||||
|
||||
// Speaker mute control
|
||||
virtual int32_t SpeakerMuteIsAvailable(bool& available);
|
||||
@ -165,11 +163,6 @@ public:
|
||||
virtual int32_t SetMicrophoneMute(bool enable);
|
||||
virtual int32_t MicrophoneMute(bool& enabled) const;
|
||||
|
||||
// Microphone boost control
|
||||
virtual int32_t MicrophoneBoostIsAvailable(bool& available);
|
||||
virtual int32_t SetMicrophoneBoost(bool enable);
|
||||
virtual int32_t MicrophoneBoost(bool& enabled) const;
|
||||
|
||||
// Stereo support
|
||||
virtual int32_t StereoPlayoutIsAvailable(bool& available);
|
||||
virtual int32_t SetStereoPlayout(bool enable);
|
||||
@ -179,14 +172,9 @@ public:
|
||||
virtual int32_t StereoRecording(bool& enabled) const;
|
||||
|
||||
// Delay information and control
|
||||
virtual int32_t SetPlayoutBuffer(const AudioDeviceModule::BufferType type, uint16_t sizeMS);
|
||||
virtual int32_t PlayoutBuffer(AudioDeviceModule::BufferType& type, uint16_t& sizeMS) const;
|
||||
virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
|
||||
virtual int32_t RecordingDelay(uint16_t& delayMS) const;
|
||||
|
||||
// CPU load
|
||||
virtual int32_t CPULoad(uint16_t& load) const;
|
||||
|
||||
virtual int32_t EnableBuiltInAEC(bool enable);
|
||||
|
||||
public:
|
||||
@ -312,7 +300,6 @@ private: // thread functions
|
||||
uint32_t _playChannels;
|
||||
uint32_t _sndCardPlayDelay;
|
||||
UINT64 _writtenSamples;
|
||||
LONGLONG _playAcc;
|
||||
|
||||
UINT _recAudioFrameSize;
|
||||
uint32_t _recSampleRate;
|
||||
@ -326,7 +313,6 @@ private: // thread functions
|
||||
|
||||
LARGE_INTEGER _perfCounterFreq;
|
||||
double _perfCounterFactor;
|
||||
float _avgCPULoad;
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
@ -351,9 +337,7 @@ private:
|
||||
uint16_t _recWarning;
|
||||
uint16_t _recError;
|
||||
|
||||
AudioDeviceModule::BufferType _playBufType;
|
||||
uint16_t _playBufDelay;
|
||||
uint16_t _playBufDelayFixed;
|
||||
|
||||
uint16_t _newMicLevel;
|
||||
|
||||
|
||||
@ -323,12 +323,6 @@ int32_t FakeAudioCaptureModule::MinSpeakerVolume(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SpeakerVolumeStepSize(
|
||||
uint16_t* /*step_size*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::MicrophoneVolumeIsAvailable(
|
||||
bool* /*available*/) {
|
||||
RTC_NOTREACHED();
|
||||
@ -359,12 +353,6 @@ int32_t FakeAudioCaptureModule::MinMicrophoneVolume(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::MicrophoneVolumeStepSize(
|
||||
uint16_t* /*step_size*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SpeakerMuteIsAvailable(bool* /*available*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
@ -395,22 +383,6 @@ int32_t FakeAudioCaptureModule::MicrophoneMute(bool* /*enabled*/) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::MicrophoneBoostIsAvailable(
|
||||
bool* /*available*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetMicrophoneBoost(bool /*enable*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::MicrophoneBoost(bool* /*enabled*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::StereoPlayoutIsAvailable(
|
||||
bool* available) const {
|
||||
// No recording device, just dropping audio. Stereo can be dropped just
|
||||
@ -467,18 +439,6 @@ int32_t FakeAudioCaptureModule::RecordingChannel(ChannelType* channel) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetPlayoutBuffer(const BufferType /*type*/,
|
||||
uint16_t /*size_ms*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::PlayoutBuffer(BufferType* /*type*/,
|
||||
uint16_t* /*size_ms*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::PlayoutDelay(uint16_t* delay_ms) const {
|
||||
// No delay since audio frames are dropped.
|
||||
*delay_ms = 0;
|
||||
@ -490,33 +450,6 @@ int32_t FakeAudioCaptureModule::RecordingDelay(uint16_t* /*delay_ms*/) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::CPULoad(uint16_t* /*load*/) const {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::StartRawOutputFileRecording(
|
||||
const char /*pcm_file_name_utf8*/[webrtc::kAdmMaxFileNameSize]) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::StopRawOutputFileRecording() {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::StartRawInputFileRecording(
|
||||
const char /*pcm_file_name_utf8*/[webrtc::kAdmMaxFileNameSize]) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::StopRawInputFileRecording() {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetRecordingSampleRate(
|
||||
const uint32_t /*samples_per_sec*/) {
|
||||
RTC_NOTREACHED();
|
||||
@ -541,11 +474,6 @@ int32_t FakeAudioCaptureModule::PlayoutSampleRate(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::ResetAudioDevice() {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FakeAudioCaptureModule::SetLoudspeakerStatus(bool /*enable*/) {
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
|
||||
@ -114,7 +114,6 @@ class FakeAudioCaptureModule
|
||||
int32_t SpeakerVolume(uint32_t* volume) const override;
|
||||
int32_t MaxSpeakerVolume(uint32_t* max_volume) const override;
|
||||
int32_t MinSpeakerVolume(uint32_t* min_volume) const override;
|
||||
int32_t SpeakerVolumeStepSize(uint16_t* step_size) const override;
|
||||
|
||||
int32_t MicrophoneVolumeIsAvailable(bool* available) override;
|
||||
int32_t SetMicrophoneVolume(uint32_t volume) override;
|
||||
@ -122,7 +121,6 @@ class FakeAudioCaptureModule
|
||||
int32_t MaxMicrophoneVolume(uint32_t* max_volume) const override;
|
||||
|
||||
int32_t MinMicrophoneVolume(uint32_t* min_volume) const override;
|
||||
int32_t MicrophoneVolumeStepSize(uint16_t* step_size) const override;
|
||||
|
||||
int32_t SpeakerMuteIsAvailable(bool* available) override;
|
||||
int32_t SetSpeakerMute(bool enable) override;
|
||||
@ -132,10 +130,6 @@ class FakeAudioCaptureModule
|
||||
int32_t SetMicrophoneMute(bool enable) override;
|
||||
int32_t MicrophoneMute(bool* enabled) const override;
|
||||
|
||||
int32_t MicrophoneBoostIsAvailable(bool* available) override;
|
||||
int32_t SetMicrophoneBoost(bool enable) override;
|
||||
int32_t MicrophoneBoost(bool* enabled) const override;
|
||||
|
||||
int32_t StereoPlayoutIsAvailable(bool* available) const override;
|
||||
int32_t SetStereoPlayout(bool enable) override;
|
||||
int32_t StereoPlayout(bool* enabled) const override;
|
||||
@ -145,27 +139,14 @@ class FakeAudioCaptureModule
|
||||
int32_t SetRecordingChannel(const ChannelType channel) override;
|
||||
int32_t RecordingChannel(ChannelType* channel) const override;
|
||||
|
||||
int32_t SetPlayoutBuffer(const BufferType type,
|
||||
uint16_t size_ms = 0) override;
|
||||
int32_t PlayoutBuffer(BufferType* type, uint16_t* size_ms) const override;
|
||||
int32_t PlayoutDelay(uint16_t* delay_ms) const override;
|
||||
int32_t RecordingDelay(uint16_t* delay_ms) const override;
|
||||
|
||||
int32_t CPULoad(uint16_t* load) const override;
|
||||
|
||||
int32_t StartRawOutputFileRecording(
|
||||
const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override;
|
||||
int32_t StopRawOutputFileRecording() override;
|
||||
int32_t StartRawInputFileRecording(
|
||||
const char pcm_file_name_utf8[webrtc::kAdmMaxFileNameSize]) override;
|
||||
int32_t StopRawInputFileRecording() override;
|
||||
|
||||
int32_t SetRecordingSampleRate(const uint32_t samples_per_sec) override;
|
||||
int32_t RecordingSampleRate(uint32_t* samples_per_sec) const override;
|
||||
int32_t SetPlayoutSampleRate(const uint32_t samples_per_sec) override;
|
||||
int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const override;
|
||||
|
||||
int32_t ResetAudioDevice() override;
|
||||
int32_t SetLoudspeakerStatus(bool enable) override;
|
||||
int32_t GetLoudspeakerStatus(bool* enabled) const override;
|
||||
bool BuiltInAECIsAvailable() const override { return false; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user