Fix warnings, simplify ADM.

This is in preparation for adding a gn target for audio_device_tests.

BUG=webrtc:6170,webrtc:163
NOTRY=True

Review-Url: https://codereview.webrtc.org/2222563002
Cr-Commit-Position: refs/heads/master@{#13768}
This commit is contained in:
maxmorin 2016-08-16 00:56:09 -07:00 committed by Commit bot
parent cc168360f4
commit 88e31a3fd8
10 changed files with 48 additions and 45 deletions

View File

@ -179,6 +179,16 @@ class FakeAudioCaptureModule
int32_t EnableBuiltInAGC(bool enable) override { return -1; }
bool BuiltInNSIsAvailable() const override { return false; }
int32_t EnableBuiltInNS(bool enable) override { return -1; }
#if defined(WEBRTC_IOS)
int GetPlayoutAudioParameters(
webrtc::AudioParameters* params) const override {
return -1;
}
int GetRecordAudioParameters(webrtc::AudioParameters* params) const override {
return -1;
}
#endif // WEBRTC_IOS
// End of functions inherited from webrtc::AudioDeviceModule.
// The following function is inherited from rtc::MessageHandler.

View File

@ -57,11 +57,6 @@ int32_t AudioDeviceGeneric::EnableBuiltInAEC(bool enable) {
return -1;
}
bool AudioDeviceGeneric::BuiltInAECIsEnabled() const {
LOG_F(LS_ERROR) << "Not supported on this platform";
return false;
}
bool AudioDeviceGeneric::BuiltInAGCIsAvailable() const {
LOG_F(LS_ERROR) << "Not supported on this platform";
return false;
@ -82,15 +77,18 @@ int32_t AudioDeviceGeneric::EnableBuiltInNS(bool enable) {
return -1;
}
#if defined(WEBRTC_IOS)
int AudioDeviceGeneric::GetPlayoutAudioParameters(
AudioParameters* params) const {
LOG_F(LS_ERROR) << "Not supported on this platform";
return -1;
}
int AudioDeviceGeneric::GetRecordAudioParameters(
AudioParameters* params) const {
LOG_F(LS_ERROR) << "Not supported on this platform";
return -1;
}
#endif // WEBRTC_IOS
} // namespace webrtc

View File

@ -164,13 +164,12 @@ class AudioDeviceGeneric {
virtual int32_t EnableBuiltInAGC(bool enable);
virtual int32_t EnableBuiltInNS(bool enable);
// Windows Core Audio only.
virtual bool BuiltInAECIsEnabled() const;
// iOS only.
// TODO(henrika): add Android support.
#if defined(WEBRTC_IOS)
virtual int GetPlayoutAudioParameters(AudioParameters* params) const;
virtual int GetRecordAudioParameters(AudioParameters* params) const;
#endif // WEBRTC_IOS
virtual bool PlayoutWarning() const = 0;
virtual bool PlayoutError() const = 0;

View File

@ -1776,14 +1776,6 @@ int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const {
return ok;
}
bool AudioDeviceModuleImpl::BuiltInAECIsEnabled() const {
LOG(INFO) << __FUNCTION__;
CHECK_INITIALIZED_BOOL();
bool isEnabled = _ptrAudioDevice->BuiltInAECIsEnabled();
LOG(INFO) << "output: " << isEnabled;
return isEnabled;
}
bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const {
LOG(INFO) << __FUNCTION__;
CHECK_INITIALIZED_BOOL();
@ -1832,6 +1824,7 @@ int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) {
return ok;
}
#if defined(WEBRTC_IOS)
int AudioDeviceModuleImpl::GetPlayoutAudioParameters(
AudioParameters* params) const {
LOG(INFO) << __FUNCTION__;
@ -1847,6 +1840,7 @@ int AudioDeviceModuleImpl::GetRecordAudioParameters(
LOG(INFO) << "output: " << r;
return r;
}
#endif // WEBRTC_IOS
// ============================================================================
// Private Methods

View File

@ -42,7 +42,7 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
int32_t AttachAudioBuffer();
AudioDeviceModuleImpl(const int32_t id, const AudioLayer audioLayer);
virtual ~AudioDeviceModuleImpl();
~AudioDeviceModuleImpl() override;
int64_t TimeUntilNextProcess() override;
void Process() override;
@ -178,7 +178,6 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
int32_t SetLoudspeakerStatus(bool enable) override;
int32_t GetLoudspeakerStatus(bool* enabled) const override;
bool BuiltInAECIsEnabled() const override;
bool BuiltInAECIsAvailable() const override;
int32_t EnableBuiltInAEC(bool enable) override;
bool BuiltInAGCIsAvailable() const override;
@ -186,8 +185,10 @@ class AudioDeviceModuleImpl : public AudioDeviceModule {
bool BuiltInNSIsAvailable() const override;
int32_t EnableBuiltInNS(bool enable) override;
#if defined(WEBRTC_IOS)
int GetPlayoutAudioParameters(AudioParameters* params) const override;
int GetRecordAudioParameters(AudioParameters* params) const override;
#endif // WEBRTC_IOS
int32_t Id() { return _id; }
#if defined(WEBRTC_ANDROID)

View File

@ -192,30 +192,23 @@ class AudioDeviceModule : public RefCountedModule {
virtual int32_t GetLoudspeakerStatus(bool* enabled) const = 0;
// Only supported on Android.
// TODO(henrika): Make pure virtual after updating Chromium.
virtual bool BuiltInAECIsAvailable() const { return false; }
virtual bool BuiltInAGCIsAvailable() const { return false; }
virtual bool BuiltInNSIsAvailable() const { return false; }
virtual bool BuiltInAECIsAvailable() const = 0;
virtual bool BuiltInAGCIsAvailable() const = 0;
virtual bool BuiltInNSIsAvailable() const = 0;
// Enables the built-in audio effects. Only supported on Android.
// TODO(henrika): Make pure virtual after updating Chromium.
virtual int32_t EnableBuiltInAEC(bool enable) { return -1; }
virtual int32_t EnableBuiltInAGC(bool enable) { return -1; }
virtual int32_t EnableBuiltInNS(bool enable) { return -1; }
// Don't use.
virtual bool BuiltInAECIsEnabled() const { return false; }
virtual int32_t EnableBuiltInAEC(bool enable) = 0;
virtual int32_t EnableBuiltInAGC(bool enable) = 0;
virtual int32_t EnableBuiltInNS(bool enable) = 0;
// Only supported on iOS.
// TODO(henrika): Make pure virtual after updating Chromium.
virtual int GetPlayoutAudioParameters(AudioParameters* params) const {
return -1;
}
virtual int GetRecordAudioParameters(AudioParameters* params) const {
return -1;
}
// Only supported on iOS.
#if defined(WEBRTC_IOS)
virtual int GetPlayoutAudioParameters(AudioParameters* params) const = 0;
virtual int GetRecordAudioParameters(AudioParameters* params) const = 0;
#endif // WEBRTC_IOS
protected:
virtual ~AudioDeviceModule() {}
~AudioDeviceModule() override {}
};
} // namespace webrtc

View File

@ -8,6 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_FAKE_AUDIO_DEVICE_H_
#define WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_FAKE_AUDIO_DEVICE_H_
#include "webrtc/modules/audio_device/include/audio_device.h"
namespace webrtc {
@ -146,11 +149,21 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
virtual int32_t GetLoudspeakerStatus(bool* enabled) const { return 0; }
virtual bool BuiltInAECIsAvailable() const { return false; }
virtual int32_t EnableBuiltInAEC(bool enable) { return -1; }
virtual bool BuiltInAECIsEnabled() const { return false; }
virtual bool BuiltInAGCIsAvailable() const { return false; }
virtual int32_t EnableBuiltInAGC(bool enable) { return -1; }
virtual bool BuiltInNSIsAvailable() const { return false; }
virtual int32_t EnableBuiltInNS(bool enable) { return -1; }
#if defined(WEBRTC_IOS)
virtual int GetPlayoutAudioParameters(AudioParameters* params) const {
return -1;
}
virtual int GetRecordAudioParameters(AudioParameters* params) const {
return -1;
}
#endif // WEBRTC_IOS
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_DEVICE_INCLUDE_FAKE_AUDIO_DEVICE_H_

View File

@ -125,9 +125,10 @@ class MockAudioDeviceModule : public AudioDeviceModule {
MOCK_METHOD1(EnableBuiltInAEC, int32_t(bool enable));
MOCK_METHOD1(EnableBuiltInAGC, int32_t(bool enable));
MOCK_METHOD1(EnableBuiltInNS, int32_t(bool enable));
MOCK_CONST_METHOD0(BuiltInAECIsEnabled, bool());
#if defined(WEBRTC_IOS)
MOCK_CONST_METHOD1(GetPlayoutAudioParameters, int(AudioParameters* params));
MOCK_CONST_METHOD1(GetRecordAudioParameters, int(AudioParameters* params));
#endif // WEBRTC_IOS
};
} // namespace test
} // namespace webrtc

View File

@ -4194,11 +4194,6 @@ int32_t AudioDeviceWindowsCore::EnableBuiltInAEC(bool enable)
return 0;
}
bool AudioDeviceWindowsCore::BuiltInAECIsEnabled() const
{
return _builtInAecEnabled;
}
int AudioDeviceWindowsCore::SetDMOProperties()
{
HRESULT hr = S_OK;

View File

@ -192,7 +192,6 @@ public:
virtual int32_t CPULoad(uint16_t& load) const;
virtual int32_t EnableBuiltInAEC(bool enable);
virtual bool BuiltInAECIsEnabled() const;
public:
virtual bool PlayoutWarning() const;