Remove AudioDeviceObserver and make ADM not inherit from the Module interface.

(Re-upload of https://codereview.webrtc.org/3020493002/)

Bug: webrtc:4690, webrtc:7306
Change-Id: I67fb9ebca1296aabc08eae8a292a5c69832dc35e
Reviewed-on: https://webrtc-review.googlesource.com/5360
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20083}
This commit is contained in:
Fredrik Solenberg
2017-10-02 14:55:33 +02:00
committed by Commit Bot
parent c007857ab9
commit 34cdd2d402
35 changed files with 14 additions and 698 deletions

View File

@ -12,12 +12,12 @@
#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_
#include "modules/audio_device/include/audio_device_defines.h"
#include "modules/include/module.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/refcount.h"
namespace webrtc {
class AudioDeviceModule : public RefCountedModule {
class AudioDeviceModule : public rtc::RefCountInterface {
public:
enum ErrorCode {
kAdmErrNone = 0,
@ -52,21 +52,11 @@ class AudioDeviceModule : public RefCountedModule {
const int32_t id,
const AudioLayer audio_layer);
// TODO(solenberg): Remove temporary implementation of Module interface.
int64_t TimeUntilNextProcess() override {
// Make sure Process() isn't called very often.
return 1000000;
}
void Process() override {}
// Retrieve the currently utilized audio layer
virtual int32_t ActiveAudioLayer(AudioLayer* audioLayer) const = 0;
// Error handling
virtual ErrorCode LastError() const = 0;
virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) {
return 0;
}
// Full-duplex transportation of PCM audio
virtual int32_t RegisterAudioCallback(AudioTransport* audioCallback) = 0;

View File

@ -24,22 +24,6 @@ static const int kAdmMaxGuidSize = 128;
static const int kAdmMinPlayoutBufferSizeMs = 10;
static const int kAdmMaxPlayoutBufferSizeMs = 250;
// ----------------------------------------------------------------------------
// AudioDeviceObserver
// ----------------------------------------------------------------------------
class AudioDeviceObserver {
public:
enum ErrorCode { kRecordingError = 0, kPlayoutError = 1 };
enum WarningCode { kRecordingWarning = 0, kPlayoutWarning = 1 };
virtual void OnErrorIsReported(const ErrorCode error) = 0;
virtual void OnWarningIsReported(const WarningCode warning) = 0;
protected:
virtual ~AudioDeviceObserver() {}
};
// ----------------------------------------------------------------------------
// AudioTransport
// ----------------------------------------------------------------------------

View File

@ -23,9 +23,6 @@ class FakeAudioDeviceModule : public AudioDeviceModule {
virtual int32_t Release() const { return 0; }
private:
virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) {
return 0;
}
virtual int32_t RegisterAudioCallback(AudioTransport* audioCallback) {
return 0;
}

View File

@ -21,18 +21,12 @@ namespace test {
class MockAudioDeviceModule : public AudioDeviceModule {
public:
// Module.
MOCK_METHOD0(TimeUntilNextProcess, int64_t());
MOCK_METHOD0(Process, void());
MOCK_METHOD1(ProcessThreadAttached, void(ProcessThread*));
// RefCountedModule.
// RefCounted
MOCK_CONST_METHOD0(AddRef, int32_t());
MOCK_CONST_METHOD0(Release, int32_t());
// AudioDeviceModule.
MOCK_CONST_METHOD1(ActiveAudioLayer, int32_t(AudioLayer* audioLayer));
MOCK_CONST_METHOD0(LastError, ErrorCode());
MOCK_METHOD1(RegisterEventObserver,
int32_t(AudioDeviceObserver* eventCallback));
MOCK_METHOD1(RegisterAudioCallback, int32_t(AudioTransport* audioCallback));
MOCK_METHOD0(Init, int32_t());
MOCK_METHOD0(Terminate, int32_t());