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}
diff --git a/call/call_unittest.cc b/call/call_unittest.cc
index b1ebb82..d614de6 100644
--- a/call/call_unittest.cc
+++ b/call/call_unittest.cc
@@ -432,10 +432,6 @@
 TEST(CallTest, RecreatingAudioStreamWithSameSsrcReusesRtpState) {
   constexpr uint32_t kSSRC = 12345;
   testing::NiceMock<test::MockAudioDeviceModule> mock_adm;
-  // Reply with a 10ms timer every time TimeUntilNextProcess is called to
-  // avoid entering a tight loop on the process thread.
-  EXPECT_CALL(mock_adm, TimeUntilNextProcess())
-       .WillRepeatedly(testing::Return(10));
   rtc::scoped_refptr<test::MockAudioMixer> mock_mixer(
       new rtc::RefCountedObject<test::MockAudioMixer>);
 
diff --git a/media/engine/apm_helpers_unittest.cc b/media/engine/apm_helpers_unittest.cc
index 315cdc8..ff9308a 100644
--- a/media/engine/apm_helpers_unittest.cc
+++ b/media/engine/apm_helpers_unittest.cc
@@ -25,11 +25,6 @@
 
 struct TestHelper {
   TestHelper() {
-    // Reply with a 10ms timer every time TimeUntilNextProcess is called to
-    // avoid entering a tight loop on the process thread.
-    EXPECT_CALL(mock_audio_device_, TimeUntilNextProcess())
-        .WillRepeatedly(testing::Return(10));
-
     // This replicates the conditions from voe_auto_test.
     Config config;
     config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
diff --git a/media/engine/webrtcvoiceengine_unittest.cc b/media/engine/webrtcvoiceengine_unittest.cc
index 30396d9..cf155e5 100644
--- a/media/engine/webrtcvoiceengine_unittest.cc
+++ b/media/engine/webrtcvoiceengine_unittest.cc
@@ -3341,9 +3341,6 @@
   testing::NiceMock<webrtc::test::MockAudioDeviceModule> adm;
   EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0));
   EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0));
-  // Return 100ms just in case this function gets called.  If we don't,
-  // we could enter a tight loop since the mock would return 0.
-  EXPECT_CALL(adm, TimeUntilNextProcess()).WillRepeatedly(Return(100));
   {
     rtc::scoped_refptr<webrtc::AudioProcessing> apm =
         webrtc::AudioProcessing::Create();
diff --git a/modules/audio_device/android/audio_device_template.h b/modules/audio_device/android/audio_device_template.h
index 8d69cb4..df9efee 100644
--- a/modules/audio_device/android/audio_device_template.h
+++ b/modules/audio_device/android/audio_device_template.h
@@ -391,30 +391,6 @@
     return 0;
   }
 
-  bool PlayoutWarning() const override {
-    return false;
-  }
-
-  bool PlayoutError() const override {
-    return false;
-  }
-
-  bool RecordingWarning() const override {
-    return false;
-  }
-
-  bool RecordingError() const override {
-    return false;
-  }
-
-  void ClearPlayoutWarning() override { LOG(INFO) << __FUNCTION__; }
-
-  void ClearPlayoutError() override { LOG(INFO) << __FUNCTION__; }
-
-  void ClearRecordingWarning() override { LOG(INFO) << __FUNCTION__; }
-
-  void ClearRecordingError() override { LOG(INFO) << __FUNCTION__; }
-
   void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override {
     LOG(INFO) << __FUNCTION__;
     output_.AttachAudioBuffer(audioBuffer);
diff --git a/modules/audio_device/audio_device_buffer.h b/modules/audio_device/audio_device_buffer.h
index d0eda40..b59779d 100644
--- a/modules/audio_device/audio_device_buffer.h
+++ b/modules/audio_device/audio_device_buffer.h
@@ -28,8 +28,6 @@
 // TODO(henrika): remove when no longer used by external client.
 const size_t kMaxBufferSizeBytes = 3840;  // 10ms in stereo @ 96kHz
 
-class AudioDeviceObserver;
-
 class AudioDeviceBuffer {
  public:
   enum LogState {
diff --git a/modules/audio_device/audio_device_config.h b/modules/audio_device/audio_device_config.h
index e2ad1fd..2d1e94f 100644
--- a/modules/audio_device/audio_device_config.h
+++ b/modules/audio_device/audio_device_config.h
@@ -13,7 +13,6 @@
 
 // Enumerators
 //
-enum { kAdmMaxIdleTimeProcess = 1000 };
 enum { GET_MIC_VOLUME_INTERVAL_MS = 1000 };
 
 // Platform specifics
diff --git a/modules/audio_device/audio_device_data_observer.cc b/modules/audio_device/audio_device_data_observer.cc
index a03c7fa..a72fb8d 100644
--- a/modules/audio_device/audio_device_data_observer.cc
+++ b/modules/audio_device/audio_device_data_observer.cc
@@ -36,12 +36,6 @@
   // Make sure we have a valid ADM before returning it to user.
   bool IsValid() { return is_valid_; }
 
-  // RefCountedModule methods overrides.
-  int64_t TimeUntilNextProcess() override {
-    return impl_->TimeUntilNextProcess();
-  }
-  void Process() override { return impl_->Process(); }
-
   // AudioTransport methods overrides.
   int32_t RecordedDataIsAvailable(const void* audioSamples,
                                   const size_t nSamples,
@@ -127,9 +121,6 @@
     return impl_->ActiveAudioLayer(audio_layer);
   }
   ErrorCode LastError() const override { return impl_->LastError(); }
-  int32_t RegisterEventObserver(AudioDeviceObserver* event_callback) override {
-    return impl_->RegisterEventObserver(event_callback);
-  }
   int32_t Init() override { return impl_->Init(); }
   int32_t Terminate() override { return impl_->Terminate(); }
   bool Initialized() const override { return impl_->Initialized(); }
diff --git a/modules/audio_device/audio_device_generic.h b/modules/audio_device/audio_device_generic.h
index 8f3e9dc..5679bd4 100644
--- a/modules/audio_device/audio_device_generic.h
+++ b/modules/audio_device/audio_device_generic.h
@@ -142,15 +142,6 @@
   virtual int GetRecordAudioParameters(AudioParameters* params) const;
 #endif  // WEBRTC_IOS
 
-  virtual bool PlayoutWarning() const = 0;
-  virtual bool PlayoutError() const = 0;
-  virtual bool RecordingWarning() const = 0;
-  virtual bool RecordingError() const = 0;
-  virtual void ClearPlayoutWarning() = 0;
-  virtual void ClearPlayoutError() = 0;
-  virtual void ClearRecordingWarning() = 0;
-  virtual void ClearRecordingError() = 0;
-
   virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0;
 
   virtual ~AudioDeviceGeneric() {}
diff --git a/modules/audio_device/audio_device_impl.cc b/modules/audio_device/audio_device_impl.cc
index 820d5f6..5701f59 100644
--- a/modules/audio_device/audio_device_impl.cc
+++ b/modules/audio_device/audio_device_impl.cc
@@ -116,11 +116,9 @@
 
 AudioDeviceModuleImpl::AudioDeviceModuleImpl(const int32_t id,
                                              const AudioLayer audioLayer)
-    : _ptrCbAudioDeviceObserver(NULL),
-      _ptrAudioDevice(NULL),
+    : _ptrAudioDevice(NULL),
       _id(id),
       _platformAudioLayer(audioLayer),
-      _lastProcessTime(rtc::TimeMillis()),
       _platformType(kPlatformNotSupported),
       _initialized(false),
       _lastError(kAdmErrNone) {
@@ -360,78 +358,6 @@
 }
 
 // ============================================================================
-//                                  Module
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-//  Module::TimeUntilNextProcess
-//
-//  Returns the number of milliseconds until the module want a worker thread
-//  to call Process().
-// ----------------------------------------------------------------------------
-
-int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() {
-  int64_t now = rtc::TimeMillis();
-  int64_t deltaProcess = kAdmMaxIdleTimeProcess - (now - _lastProcessTime);
-  return deltaProcess;
-}
-
-// ----------------------------------------------------------------------------
-//  Module::Process
-//
-//  Check for posted error and warning reports. Generate callbacks if
-//  new reports exists.
-// ----------------------------------------------------------------------------
-
-void AudioDeviceModuleImpl::Process() {
-  _lastProcessTime = rtc::TimeMillis();
-
-  // kPlayoutWarning
-  if (_ptrAudioDevice->PlayoutWarning()) {
-    rtc::CritScope lock(&_critSectEventCb);
-    if (_ptrCbAudioDeviceObserver) {
-      LOG(WARNING) << "=> OnWarningIsReported(kPlayoutWarning)";
-      _ptrCbAudioDeviceObserver->OnWarningIsReported(
-          AudioDeviceObserver::kPlayoutWarning);
-    }
-    _ptrAudioDevice->ClearPlayoutWarning();
-  }
-
-  // kPlayoutError
-  if (_ptrAudioDevice->PlayoutError()) {
-    rtc::CritScope lock(&_critSectEventCb);
-    if (_ptrCbAudioDeviceObserver) {
-      LOG(LERROR) << "=> OnErrorIsReported(kPlayoutError)";
-      _ptrCbAudioDeviceObserver->OnErrorIsReported(
-          AudioDeviceObserver::kPlayoutError);
-    }
-    _ptrAudioDevice->ClearPlayoutError();
-  }
-
-  // kRecordingWarning
-  if (_ptrAudioDevice->RecordingWarning()) {
-    rtc::CritScope lock(&_critSectEventCb);
-    if (_ptrCbAudioDeviceObserver) {
-      LOG(WARNING) << "=> OnWarningIsReported(kRecordingWarning)";
-      _ptrCbAudioDeviceObserver->OnWarningIsReported(
-          AudioDeviceObserver::kRecordingWarning);
-    }
-    _ptrAudioDevice->ClearRecordingWarning();
-  }
-
-  // kRecordingError
-  if (_ptrAudioDevice->RecordingError()) {
-    rtc::CritScope lock(&_critSectEventCb);
-    if (_ptrCbAudioDeviceObserver) {
-      LOG(LERROR) << "=> OnErrorIsReported(kRecordingError)";
-      _ptrCbAudioDeviceObserver->OnErrorIsReported(
-          AudioDeviceObserver::kRecordingError);
-    }
-    _ptrAudioDevice->ClearRecordingError();
-  }
-}
-
-// ============================================================================
 //                                    Public API
 // ============================================================================
 
@@ -1321,19 +1247,6 @@
 }
 
 // ----------------------------------------------------------------------------
-//  RegisterEventObserver
-// ----------------------------------------------------------------------------
-
-int32_t AudioDeviceModuleImpl::RegisterEventObserver(
-    AudioDeviceObserver* eventCallback) {
-  LOG(INFO) << __FUNCTION__;
-  rtc::CritScope lock(&_critSectEventCb);
-  _ptrCbAudioDeviceObserver = eventCallback;
-
-  return 0;
-}
-
-// ----------------------------------------------------------------------------
 //  RegisterAudioCallback
 // ----------------------------------------------------------------------------
 
diff --git a/modules/audio_device/audio_device_impl.h b/modules/audio_device/audio_device_impl.h
index 77c4cc5..864ab48 100644
--- a/modules/audio_device/audio_device_impl.h
+++ b/modules/audio_device/audio_device_impl.h
@@ -44,15 +44,11 @@
   AudioDeviceModuleImpl(const int32_t id, const AudioLayer audioLayer);
   ~AudioDeviceModuleImpl() override;
 
-  int64_t TimeUntilNextProcess() override;
-  void Process() override;
-
   // Retrieve the currently utilized audio layer
   int32_t ActiveAudioLayer(AudioLayer* audioLayer) const override;
 
   // Error handling
   ErrorCode LastError() const override;
-  int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) override;
 
   // Full-duplex transportation of PCM audio
   int32_t RegisterAudioCallback(AudioTransport* audioCallback) override;
@@ -178,11 +174,8 @@
   AudioLayer PlatformAudioLayer() const;
 
   rtc::CriticalSection _critSect;
-  rtc::CriticalSection _critSectEventCb;
   rtc::CriticalSection _critSectAudioCb;
 
-  AudioDeviceObserver* _ptrCbAudioDeviceObserver;
-
   AudioDeviceGeneric* _ptrAudioDevice;
 
   AudioDeviceBuffer _audioDeviceBuffer;
@@ -191,7 +184,6 @@
 #endif
   int32_t _id;
   AudioLayer _platformAudioLayer;
-  int64_t _lastProcessTime;
   PlatformType _platformType;
   bool _initialized;
   mutable ErrorCode _lastError;
diff --git a/modules/audio_device/dummy/audio_device_dummy.cc b/modules/audio_device/dummy/audio_device_dummy.cc
index cb41e4a..7ababa1 100644
--- a/modules/audio_device/dummy/audio_device_dummy.cc
+++ b/modules/audio_device/dummy/audio_device_dummy.cc
@@ -158,21 +158,5 @@
 
 int32_t AudioDeviceDummy::RecordingDelay(uint16_t& delayMS) const { return -1; }
 
-bool AudioDeviceDummy::PlayoutWarning() const { return false; }
-
-bool AudioDeviceDummy::PlayoutError() const { return false; }
-
-bool AudioDeviceDummy::RecordingWarning() const { return false; }
-
-bool AudioDeviceDummy::RecordingError() const { return false; }
-
-void AudioDeviceDummy::ClearPlayoutWarning() {}
-
-void AudioDeviceDummy::ClearPlayoutError() {}
-
-void AudioDeviceDummy::ClearRecordingWarning() {}
-
-void AudioDeviceDummy::ClearRecordingError() {}
-
 void AudioDeviceDummy::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {}
 }  // namespace webrtc
diff --git a/modules/audio_device/dummy/audio_device_dummy.h b/modules/audio_device/dummy/audio_device_dummy.h
index 5865720..5e2cecf 100644
--- a/modules/audio_device/dummy/audio_device_dummy.h
+++ b/modules/audio_device/dummy/audio_device_dummy.h
@@ -111,15 +111,6 @@
   int32_t PlayoutDelay(uint16_t& delayMS) const override;
   int32_t RecordingDelay(uint16_t& delayMS) 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;
-
   void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
 };
 
diff --git a/modules/audio_device/dummy/file_audio_device.cc b/modules/audio_device/dummy/file_audio_device.cc
index 2194748..7b3e17e 100644
--- a/modules/audio_device/dummy/file_audio_device.cc
+++ b/modules/audio_device/dummy/file_audio_device.cc
@@ -398,22 +398,6 @@
 
 int32_t FileAudioDevice::RecordingDelay(uint16_t& delayMS) const { return -1; }
 
-bool FileAudioDevice::PlayoutWarning() const { return false; }
-
-bool FileAudioDevice::PlayoutError() const { return false; }
-
-bool FileAudioDevice::RecordingWarning() const { return false; }
-
-bool FileAudioDevice::RecordingError() const { return false; }
-
-void FileAudioDevice::ClearPlayoutWarning() {}
-
-void FileAudioDevice::ClearPlayoutError() {}
-
-void FileAudioDevice::ClearRecordingWarning() {}
-
-void FileAudioDevice::ClearRecordingError() {}
-
 void FileAudioDevice::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
   rtc::CritScope lock(&_critSect);
 
diff --git a/modules/audio_device/dummy/file_audio_device.h b/modules/audio_device/dummy/file_audio_device.h
index 61e717e..11ed8b8 100644
--- a/modules/audio_device/dummy/file_audio_device.h
+++ b/modules/audio_device/dummy/file_audio_device.h
@@ -132,15 +132,6 @@
   int32_t PlayoutDelay(uint16_t& delayMS) const override;
   int32_t RecordingDelay(uint16_t& delayMS) 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;
-
   void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
 
  private:
diff --git a/modules/audio_device/include/audio_device.h b/modules/audio_device/include/audio_device.h
index b378f9f..55e6421 100644
--- a/modules/audio_device/include/audio_device.h
+++ b/modules/audio_device/include/audio_device.h
@@ -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 @@
       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;
diff --git a/modules/audio_device/include/audio_device_defines.h b/modules/audio_device/include/audio_device_defines.h
index 133819a..510b07c 100644
--- a/modules/audio_device/include/audio_device_defines.h
+++ b/modules/audio_device/include/audio_device_defines.h
@@ -25,22 +25,6 @@
 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
 // ----------------------------------------------------------------------------
 
diff --git a/modules/audio_device/include/fake_audio_device.h b/modules/audio_device/include/fake_audio_device.h
index c6765df..e6f05e7 100644
--- a/modules/audio_device/include/fake_audio_device.h
+++ b/modules/audio_device/include/fake_audio_device.h
@@ -23,9 +23,6 @@
   virtual int32_t Release() const { return 0; }
 
  private:
-  virtual int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) {
-    return 0;
-  }
   virtual int32_t RegisterAudioCallback(AudioTransport* audioCallback) {
     return 0;
   }
diff --git a/modules/audio_device/include/mock_audio_device.h b/modules/audio_device/include/mock_audio_device.h
index f824eeb..87dc64c 100644
--- a/modules/audio_device/include/mock_audio_device.h
+++ b/modules/audio_device/include/mock_audio_device.h
@@ -21,18 +21,12 @@
 
 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());
diff --git a/modules/audio_device/ios/audio_device_ios.h b/modules/audio_device/ios/audio_device_ios.h
index caaeaac..8235bf0 100644
--- a/modules/audio_device/ios/audio_device_ios.h
+++ b/modules/audio_device/ios/audio_device_ios.h
@@ -139,14 +139,6 @@
   int32_t StereoRecordingIsAvailable(bool& available) override;
   int32_t SetStereoRecording(bool enable) override;
   int32_t StereoRecording(bool& enabled) 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 {}
 
   // AudioSessionObserver methods. May be called from any thread.
   void OnInterruptionBegin() override;
diff --git a/modules/audio_device/ios/audio_device_not_implemented_ios.mm b/modules/audio_device/ios/audio_device_not_implemented_ios.mm
index dee3cc7..6dfc02b 100644
--- a/modules/audio_device/ios/audio_device_not_implemented_ios.mm
+++ b/modules/audio_device/ios/audio_device_not_implemented_ios.mm
@@ -91,22 +91,6 @@
   return -1;
 }
 
-bool AudioDeviceIOS::PlayoutWarning() const {
-  return false;
-}
-
-bool AudioDeviceIOS::PlayoutError() const {
-  return false;
-}
-
-bool AudioDeviceIOS::RecordingWarning() const {
-  return false;
-}
-
-bool AudioDeviceIOS::RecordingError() const {
-  return false;
-}
-
 int32_t AudioDeviceIOS::InitMicrophone() {
   return 0;
 }
diff --git a/modules/audio_device/linux/audio_device_alsa_linux.cc b/modules/audio_device/linux/audio_device_alsa_linux.cc
index f271606..bfddf3d 100644
--- a/modules/audio_device/linux/audio_device_alsa_linux.cc
+++ b/modules/audio_device/linux/audio_device_alsa_linux.cc
@@ -89,11 +89,7 @@
     _playIsInitialized(false),
     _AGC(false),
     _recordingDelay(0),
-    _playoutDelay(0),
-    _playWarning(0),
-    _playError(0),
-    _recWarning(0),
-    _recError(0)
+    _playoutDelay(0)
 {
     memset(_oldKeyState, 0, sizeof(_oldKeyState));
     LOG(LS_INFO) << __FUNCTION__ << " created";
@@ -166,10 +162,6 @@
           << "failed to open X display, typing detection will not work";
     }
 #endif
-    _playWarning = 0;
-    _playError = 0;
-    _recWarning = 0;
-    _recError = 0;
 
     _initialized = true;
 
@@ -1014,8 +1006,6 @@
         _handlePlayout, _playoutFramesIn10MS);
 
     // Init varaibles used for play
-    _playWarning = 0;
-    _playError = 0;
 
     if (_handlePlayout != NULL)
     {
@@ -1447,54 +1437,6 @@
     return (_playing);
 }
 
-bool AudioDeviceLinuxALSA::PlayoutWarning() const
-{
-    rtc::CritScope lock(&_critSect);
-    return (_playWarning > 0);
-}
-
-bool AudioDeviceLinuxALSA::PlayoutError() const
-{
-    rtc::CritScope lock(&_critSect);
-    return (_playError > 0);
-}
-
-bool AudioDeviceLinuxALSA::RecordingWarning() const
-{
-    rtc::CritScope lock(&_critSect);
-    return (_recWarning > 0);
-}
-
-bool AudioDeviceLinuxALSA::RecordingError() const
-{
-    rtc::CritScope lock(&_critSect);
-    return (_recError > 0);
-}
-
-void AudioDeviceLinuxALSA::ClearPlayoutWarning()
-{
-    rtc::CritScope lock(&_critSect);
-    _playWarning = 0;
-}
-
-void AudioDeviceLinuxALSA::ClearPlayoutError()
-{
-    rtc::CritScope lock(&_critSect);
-    _playError = 0;
-}
-
-void AudioDeviceLinuxALSA::ClearRecordingWarning()
-{
-    rtc::CritScope lock(&_critSect);
-    _recWarning = 0;
-}
-
-void AudioDeviceLinuxALSA::ClearRecordingError()
-{
-    rtc::CritScope lock(&_critSect);
-    _recError = 0;
-}
-
 // ============================================================================
 //                                 Private Methods
 // ============================================================================
diff --git a/modules/audio_device/linux/audio_device_alsa_linux.h b/modules/audio_device/linux/audio_device_alsa_linux.h
index 96a15eb..05871f0 100644
--- a/modules/audio_device/linux/audio_device_alsa_linux.h
+++ b/modules/audio_device/linux/audio_device_alsa_linux.h
@@ -125,15 +125,6 @@
     int32_t PlayoutDelay(uint16_t& delayMS) const override;
     int32_t RecordingDelay(uint16_t& delayMS) 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;
-
     void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
 
 private:
@@ -206,11 +197,6 @@
     snd_pcm_sframes_t _recordingDelay;
     snd_pcm_sframes_t _playoutDelay;
 
-    uint16_t _playWarning;
-    uint16_t _playError;
-    uint16_t _recWarning;
-    uint16_t _recError;
-
     char _oldKeyState[32];
 #if defined(USE_X11)
     Display* _XDisplay;
diff --git a/modules/audio_device/linux/audio_device_pulse_linux.cc b/modules/audio_device/linux/audio_device_pulse_linux.cc
index ecbe63b..9b16c69 100644
--- a/modules/audio_device/linux/audio_device_pulse_linux.cc
+++ b/modules/audio_device/linux/audio_device_pulse_linux.cc
@@ -54,10 +54,6 @@
       _sndCardPlayDelay(0),
       _sndCardRecDelay(0),
       _writeErrors(0),
-      _playWarning(0),
-      _playError(0),
-      _recWarning(0),
-      _recError(0),
       _deviceIndex(-1),
       _numPlayDevices(0),
       _numRecDevices(0),
@@ -160,11 +156,6 @@
     return InitStatus::OTHER_ERROR;
   }
 
-  _playWarning = 0;
-  _playError = 0;
-  _recWarning = 0;
-  _recError = 0;
-
   // Get X display handle for typing detection
   _XDisplay = XOpenDisplay(NULL);
   if (!_XDisplay) {
@@ -1292,46 +1283,6 @@
   return (_playing);
 }
 
-bool AudioDeviceLinuxPulse::PlayoutWarning() const {
-  rtc::CritScope lock(&_critSect);
-  return (_playWarning > 0);
-}
-
-bool AudioDeviceLinuxPulse::PlayoutError() const {
-  rtc::CritScope lock(&_critSect);
-  return (_playError > 0);
-}
-
-bool AudioDeviceLinuxPulse::RecordingWarning() const {
-  rtc::CritScope lock(&_critSect);
-  return (_recWarning > 0);
-}
-
-bool AudioDeviceLinuxPulse::RecordingError() const {
-  rtc::CritScope lock(&_critSect);
-  return (_recError > 0);
-}
-
-void AudioDeviceLinuxPulse::ClearPlayoutWarning() {
-  rtc::CritScope lock(&_critSect);
-  _playWarning = 0;
-}
-
-void AudioDeviceLinuxPulse::ClearPlayoutError() {
-  rtc::CritScope lock(&_critSect);
-  _playError = 0;
-}
-
-void AudioDeviceLinuxPulse::ClearRecordingWarning() {
-  rtc::CritScope lock(&_critSect);
-  _recWarning = 0;
-}
-
-void AudioDeviceLinuxPulse::ClearRecordingError() {
-  rtc::CritScope lock(&_critSect);
-  _recError = 0;
-}
-
 // ============================================================================
 //                                 Private Methods
 // ============================================================================
@@ -2191,12 +2142,7 @@
               NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
         _writeErrors++;
         if (_writeErrors > 10) {
-          if (_playError == 1) {
-            LOG(LS_WARNING) << "pending playout error exists";
-          }
-          // Triggers callback from module process thread.
-          _playError = 1;
-          LOG(LS_ERROR) << "kPlayoutError message posted: _writeErrors="
+          LOG(LS_ERROR) << "Playout error: _writeErrors="
                         << _writeErrors
                         << ", error=" << LATE(pa_context_errno)(_paContext);
           _writeErrors = 0;
@@ -2240,12 +2186,7 @@
                                 NULL, (int64_t)0, PA_SEEK_RELATIVE) != PA_OK) {
         _writeErrors++;
         if (_writeErrors > 10) {
-          if (_playError == 1) {
-            LOG(LS_WARNING) << "pending playout error exists";
-          }
-          // Triggers callback from module process thread.
-          _playError = 1;
-          LOG(LS_ERROR) << "kPlayoutError message posted: _writeErrors="
+          LOG(LS_ERROR) << "Playout error: _writeErrors="
                         << _writeErrors
                         << ", error=" << LATE(pa_context_errno)(_paContext);
           _writeErrors = 0;
@@ -2358,8 +2299,7 @@
       size_t sampleDataSize;
 
       if (LATE(pa_stream_peek)(_recStream, &sampleData, &sampleDataSize) != 0) {
-        _recError = 1;  // triggers callback from module process thread
-        LOG(LS_ERROR) << "RECORD_ERROR message posted, error = "
+        LOG(LS_ERROR) << "RECORD_ERROR, error = "
                       << LATE(pa_context_errno)(_paContext);
         break;
       }
diff --git a/modules/audio_device/linux/audio_device_pulse_linux.h b/modules/audio_device/linux/audio_device_pulse_linux.h
index 2a83b5c..6fd5717 100644
--- a/modules/audio_device/linux/audio_device_pulse_linux.h
+++ b/modules/audio_device/linux/audio_device_pulse_linux.h
@@ -187,15 +187,6 @@
     int32_t PlayoutDelay(uint16_t& delayMS) const override;
     int32_t RecordingDelay(uint16_t& delayMS) 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;
-
    void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
 
 private:
@@ -306,10 +297,6 @@
  uint32_t _sndCardRecDelay;
 
  int32_t _writeErrors;
- uint16_t _playWarning;
- uint16_t _playError;
- uint16_t _recWarning;
- uint16_t _recError;
 
  uint16_t _deviceIndex;
  int16_t _numPlayDevices;
diff --git a/modules/audio_device/mac/audio_device_mac.cc b/modules/audio_device/mac/audio_device_mac.cc
index d139ee1..fdeaaf1 100644
--- a/modules/audio_device/mac/audio_device_mac.cc
+++ b/modules/audio_device/mac/audio_device_mac.cc
@@ -144,10 +144,6 @@
       _captureDelayUs(0),
       _renderDelayUs(0),
       _renderDelayOffsetSamples(0),
-      _playWarning(0),
-      _playError(0),
-      _recWarning(0),
-      _recError(0),
       _paCaptureBuffer(NULL),
       _paRenderBuffer(NULL),
       _captureBufSizeSamples(0),
@@ -340,11 +336,6 @@
     }
   }
 
-  _playWarning = 0;
-  _playError = 0;
-  _recWarning = 0;
-  _recError = 0;
-
   get_mic_volume_counter_ms_ = 0;
 
   _initialized = true;
@@ -1573,38 +1564,6 @@
   return (_playing);
 }
 
-bool AudioDeviceMac::PlayoutWarning() const {
-  return (_playWarning > 0);
-}
-
-bool AudioDeviceMac::PlayoutError() const {
-  return (_playError > 0);
-}
-
-bool AudioDeviceMac::RecordingWarning() const {
-  return (_recWarning > 0);
-}
-
-bool AudioDeviceMac::RecordingError() const {
-  return (_recError > 0);
-}
-
-void AudioDeviceMac::ClearPlayoutWarning() {
-  _playWarning = 0;
-}
-
-void AudioDeviceMac::ClearPlayoutError() {
-  _playError = 0;
-}
-
-void AudioDeviceMac::ClearRecordingWarning() {
-  _recWarning = 0;
-}
-
-void AudioDeviceMac::ClearRecordingError() {
-  _recError = 0;
-}
-
 // ============================================================================
 //                                 Private Methods
 // ============================================================================
@@ -2017,10 +1976,6 @@
       LOG(LS_WARNING) << "Capture device is not alive (probably removed)";
       AtomicSet32(&_captureDeviceIsAlive, 0);
       _mixerManager.CloseMicrophone();
-      if (_recError == 1) {
-        LOG(LS_WARNING) << "pending recording error exists";
-      }
-      _recError = 1;  // triggers callback from module process thread
     } else if (err != noErr) {
       logCAMsg(rtc::LS_ERROR,
                "Error in AudioDeviceGetProperty()", (const char*)&err);
@@ -2040,10 +1995,6 @@
       LOG(LS_WARNING) << "Render device is not alive (probably removed)";
       AtomicSet32(&_renderDeviceIsAlive, 0);
       _mixerManager.CloseSpeaker();
-      if (_playError == 1) {
-        LOG(LS_WARNING) << "pending playout error exists";
-      }
-      _playError = 1;  // triggers callback from module process thread
     } else if (err != noErr) {
       logCAMsg(rtc::LS_ERROR,
                "Error in AudioDeviceGetProperty()", (const char*)&err);
diff --git a/modules/audio_device/mac/audio_device_mac.h b/modules/audio_device/mac/audio_device_mac.h
index db8cfea..c72b741 100644
--- a/modules/audio_device/mac/audio_device_mac.h
+++ b/modules/audio_device/mac/audio_device_mac.h
@@ -153,15 +153,6 @@
   virtual int32_t PlayoutDelay(uint16_t& delayMS) const;
   virtual int32_t RecordingDelay(uint16_t& delayMS) const;
 
-  virtual bool PlayoutWarning() const;
-  virtual bool PlayoutError() const;
-  virtual bool RecordingWarning() const;
-  virtual bool RecordingError() const;
-  virtual void ClearPlayoutWarning();
-  virtual void ClearPlayoutError();
-  virtual void ClearRecordingWarning();
-  virtual void ClearRecordingError();
-
   virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer);
 
  private:
@@ -333,11 +324,6 @@
 
   int32_t _renderDelayOffsetSamples;
 
-  uint16_t _playWarning;
-  uint16_t _playError;
-  uint16_t _recWarning;
-  uint16_t _recError;
-
   PaUtilRingBuffer* _paCaptureBuffer;
   PaUtilRingBuffer* _paRenderBuffer;
 
diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc
index aaf31fc..05f8e64 100644
--- a/modules/audio_device/win/audio_device_core_win.cc
+++ b/modules/audio_device/win/audio_device_core_win.cc
@@ -464,10 +464,6 @@
       _speakerIsInitialized(false),
       _microphoneIsInitialized(false),
       _AGC(false),
-      _playWarning(0),
-      _playError(0),
-      _recWarning(0),
-      _recError(0),
       _playBufDelay(80),
       _usingInputDeviceIndex(false),
       _usingOutputDeviceIndex(false),
@@ -685,11 +681,6 @@
     return InitStatus::OK;
   }
 
-  _playWarning = 0;
-  _playError = 0;
-  _recWarning = 0;
-  _recError = 0;
-
   // Enumerate all audio rendering and capturing endpoint devices.
   // Note that, some of these will not be able to select by the user.
   // The complete collection is for internal use only.
@@ -3061,78 +3052,6 @@
     return (_playing);
 }
 
-// ----------------------------------------------------------------------------
-//  PlayoutWarning
-// ----------------------------------------------------------------------------
-
-bool AudioDeviceWindowsCore::PlayoutWarning() const
-{
-    return ( _playWarning > 0);
-}
-
-// ----------------------------------------------------------------------------
-//  PlayoutError
-// ----------------------------------------------------------------------------
-
-bool AudioDeviceWindowsCore::PlayoutError() const
-{
-    return ( _playError > 0);
-}
-
-// ----------------------------------------------------------------------------
-//  RecordingWarning
-// ----------------------------------------------------------------------------
-
-bool AudioDeviceWindowsCore::RecordingWarning() const
-{
-    return ( _recWarning > 0);
-}
-
-// ----------------------------------------------------------------------------
-//  RecordingError
-// ----------------------------------------------------------------------------
-
-bool AudioDeviceWindowsCore::RecordingError() const
-{
-    return ( _recError > 0);
-}
-
-// ----------------------------------------------------------------------------
-//  ClearPlayoutWarning
-// ----------------------------------------------------------------------------
-
-void AudioDeviceWindowsCore::ClearPlayoutWarning()
-{
-    _playWarning = 0;
-}
-
-// ----------------------------------------------------------------------------
-//  ClearPlayoutError
-// ----------------------------------------------------------------------------
-
-void AudioDeviceWindowsCore::ClearPlayoutError()
-{
-    _playError = 0;
-}
-
-// ----------------------------------------------------------------------------
-//  ClearRecordingWarning
-// ----------------------------------------------------------------------------
-
-void AudioDeviceWindowsCore::ClearRecordingWarning()
-{
-    _recWarning = 0;
-}
-
-// ----------------------------------------------------------------------------
-//  ClearRecordingError
-// ----------------------------------------------------------------------------
-
-void AudioDeviceWindowsCore::ClearRecordingError()
-{
-    _recError = 0;
-}
-
 // ============================================================================
 //                                 Private Methods
 // ============================================================================
@@ -3522,11 +3441,8 @@
                 _TraceCOMError(hr);
             }
         }
-        // Trigger callback from module process thread
-        _playError = 1;
         LOG(LS_ERROR)
-            << "kPlayoutError message posted: rendering thread has ended"
-            << " pre-maturely";
+            << "Playout error: rendering thread has ended pre-maturely";
     }
     else
     {
@@ -3709,10 +3625,8 @@
 
     if (FAILED(hr))
     {
-        // Trigger callback from module process thread
-        _recError = 1;
-        LOG(LS_ERROR) << "kRecordingError message posted: capturing thread has"
-                      << " ended prematurely";
+        LOG(LS_ERROR)
+            << "Recording error: capturing thread has ended prematurely";
     }
     else
     {
@@ -4012,11 +3926,8 @@
             }
         }
 
-        // Trigger callback from module process thread
-        _recError = 1;
         LOG(LS_ERROR)
-            << "kRecordingError message posted: capturing thread has ended"
-            << " pre-maturely";
+            << "Recording error: capturing thread has ended pre-maturely";
     }
     else
     {
diff --git a/modules/audio_device/win/audio_device_core_win.h b/modules/audio_device/win/audio_device_core_win.h
index d4bf473..6d94ace 100644
--- a/modules/audio_device/win/audio_device_core_win.h
+++ b/modules/audio_device/win/audio_device_core_win.h
@@ -178,16 +178,6 @@
     virtual int32_t EnableBuiltInAEC(bool enable);
 
 public:
-    virtual bool PlayoutWarning() const;
-    virtual bool PlayoutError() const;
-    virtual bool RecordingWarning() const;
-    virtual bool RecordingError() const;
-    virtual void ClearPlayoutWarning();
-    virtual void ClearPlayoutError();
-    virtual void ClearRecordingWarning();
-    virtual void ClearRecordingError();
-
-public:
     virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer);
 
 private:
@@ -332,11 +322,6 @@
 
     bool                                    _AGC;
 
-    uint16_t                          _playWarning;
-    uint16_t                          _playError;
-    uint16_t                          _recWarning;
-    uint16_t                          _recError;
-
     uint16_t                          _playBufDelay;
 
     uint16_t                          _newMicLevel;
diff --git a/modules/include/module.h b/modules/include/module.h
index becffb9..fc2a1b5 100644
--- a/modules/include/module.h
+++ b/modules/include/module.h
@@ -58,24 +58,6 @@
  protected:
   virtual ~Module() {}
 };
-
-// Reference counted version of the Module interface.
-class RefCountedModule : public Module {
- public:
-  // Increase the reference count by one.
-  // Returns the incremented reference count.
-  virtual int32_t AddRef() const = 0;
-
-  // Decrease the reference count by one.
-  // Returns the decreased reference count.
-  // Returns 0 if the last reference was just released.
-  // When the reference count reaches 0 the object will self-destruct.
-  virtual int32_t Release() const = 0;
-
- protected:
-  ~RefCountedModule() override = default;
-};
-
 }  // namespace webrtc
 
 #endif  // MODULES_INCLUDE_MODULE_H_
diff --git a/pc/test/fakeaudiocapturemodule.cc b/pc/test/fakeaudiocapturemodule.cc
index ffee283..ea734ed 100644
--- a/pc/test/fakeaudiocapturemodule.cc
+++ b/pc/test/fakeaudiocapturemodule.cc
@@ -21,10 +21,6 @@
 // Even simpler buffers would likely just contain audio sample values of 0.
 static const int kHighSampleValue = 10000;
 
-// Same value as src/modules/audio_device/main/source/audio_device_config.h in
-// https://code.google.com/p/webrtc/
-static const int kAdmMaxIdleTimeProcess = 1000;
-
 // Constants here are derived by running VoE using a real ADM.
 // The constants correspond to 10ms of mono audio at 44kHz.
 static const int kTimePerFrameMs = 10;
@@ -40,8 +36,7 @@
 };
 
 FakeAudioCaptureModule::FakeAudioCaptureModule()
-    : last_process_time_ms_(0),
-      audio_callback_(nullptr),
+    : audio_callback_(nullptr),
       recording_(false),
       playing_(false),
       play_is_initialized_(false),
@@ -72,23 +67,6 @@
   return frames_received_;
 }
 
-int64_t FakeAudioCaptureModule::TimeUntilNextProcess() {
-  const int64_t current_time = rtc::TimeMillis();
-  if (current_time < last_process_time_ms_) {
-    // TODO: wraparound could be handled more gracefully.
-    return 0;
-  }
-  const int64_t elapsed_time = current_time - last_process_time_ms_;
-  if (kAdmMaxIdleTimeProcess < elapsed_time) {
-    return 0;
-  }
-  return kAdmMaxIdleTimeProcess - elapsed_time;
-}
-
-void FakeAudioCaptureModule::Process() {
-  last_process_time_ms_ = rtc::TimeMillis();
-}
-
 int32_t FakeAudioCaptureModule::ActiveAudioLayer(
     AudioLayer* /*audio_layer*/) const {
   RTC_NOTREACHED();
@@ -100,13 +78,6 @@
   return webrtc::AudioDeviceModule::kAdmErrNone;
 }
 
-int32_t FakeAudioCaptureModule::RegisterEventObserver(
-    webrtc::AudioDeviceObserver* /*event_callback*/) {
-  // Only used to report warnings and errors. This fake implementation won't
-  // generate any so discard this callback.
-  return 0;
-}
-
 int32_t FakeAudioCaptureModule::RegisterAudioCallback(
     webrtc::AudioTransport* audio_callback) {
   rtc::CritScope cs(&crit_callback_);
@@ -505,7 +476,6 @@
   // sent to it. Note that the audio processing pipeline will likely distort the
   // original signal.
   SetSendBuffer(kHighSampleValue);
-  last_process_time_ms_ = rtc::TimeMillis();
   return true;
 }
 
diff --git a/pc/test/fakeaudiocapturemodule.h b/pc/test/fakeaudiocapturemodule.h
index b73b642..fd2290b 100644
--- a/pc/test/fakeaudiocapturemodule.h
+++ b/pc/test/fakeaudiocapturemodule.h
@@ -52,18 +52,9 @@
   // pulled frame was generated/pushed from a FakeAudioCaptureModule.
   int frames_received() const;
 
-  // Following functions are inherited from webrtc::AudioDeviceModule.
-  // Only functions called by PeerConnection are implemented, the rest do
-  // nothing and return success. If a function is not expected to be called by
-  // PeerConnection an assertion is triggered if it is in fact called.
-  int64_t TimeUntilNextProcess() override;
-  void Process() override;
-
   int32_t ActiveAudioLayer(AudioLayer* audio_layer) const override;
 
   ErrorCode LastError() const override;
-  int32_t RegisterEventObserver(
-      webrtc::AudioDeviceObserver* event_callback) override;
 
   // Note: Calling this method from a callback may result in deadlock.
   int32_t RegisterAudioCallback(
@@ -210,10 +201,6 @@
   // Pushes frames to the registered webrtc::AudioTransport.
   void SendFrameP();
 
-  // The time in milliseconds when Process() was last called or 0 if no call
-  // has been made.
-  int64_t last_process_time_ms_;
-
   // Callback for playout and recording.
   webrtc::AudioTransport* audio_callback_;
 
diff --git a/pc/test/fakeaudiocapturemodule_unittest.cc b/pc/test/fakeaudiocapturemodule_unittest.cc
index 312c4e8..0e7574f 100644
--- a/pc/test/fakeaudiocapturemodule_unittest.cc
+++ b/pc/test/fakeaudiocapturemodule_unittest.cc
@@ -133,14 +133,6 @@
   size_t rec_buffer_bytes_;
 };
 
-TEST_F(FakeAdmTest, TestProcess) {
-  // Next process call must be some time in the future (or now).
-  EXPECT_LE(0, fake_audio_capture_module_->TimeUntilNextProcess());
-  // Process call updates TimeUntilNextProcess() but there are no guarantees on
-  // timing so just check that Process can be called successfully.
-  fake_audio_capture_module_->Process();
-}
-
 TEST_F(FakeAdmTest, PlayoutTest) {
   EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this));
 
diff --git a/test/mock_voice_engine.h b/test/mock_voice_engine.h
index 2567be4..67bc993 100644
--- a/test/mock_voice_engine.h
+++ b/test/mock_voice_engine.h
@@ -63,8 +63,6 @@
           return proxy;
         }));
 
-    ON_CALL(mock_audio_device_, TimeUntilNextProcess())
-        .WillByDefault(testing::Return(1000));
     ON_CALL(*this, audio_device_module())
         .WillByDefault(testing::Return(&mock_audio_device_));
     ON_CALL(*this, audio_transport())
diff --git a/voice_engine/voe_base_impl.cc b/voice_engine/voe_base_impl.cc
index b4c2b7a..b14bf95 100644
--- a/voice_engine/voe_base_impl.cc
+++ b/voice_engine/voe_base_impl.cc
@@ -41,22 +41,6 @@
   TerminateInternal();
 }
 
-void VoEBaseImpl::OnErrorIsReported(const ErrorCode error) {
-  if (error == AudioDeviceObserver::kRecordingError) {
-    LOG_F(LS_ERROR) << "VE_RUNTIME_REC_ERROR";
-  } else if (error == AudioDeviceObserver::kPlayoutError) {
-    LOG_F(LS_ERROR) << "VE_RUNTIME_PLAY_ERROR";
-  }
-}
-
-void VoEBaseImpl::OnWarningIsReported(const WarningCode warning) {
-  if (warning == AudioDeviceObserver::kRecordingWarning) {
-    LOG_F(LS_WARNING) << "VE_RUNTIME_REC_WARNING";
-  } else if (warning == AudioDeviceObserver::kPlayoutWarning) {
-    LOG_F(LS_WARNING) << "VE_RUNTIME_PLAY_WARNING";
-  }
-}
-
 int32_t VoEBaseImpl::RecordedDataIsAvailable(
     const void* audio_data,
     const size_t number_of_frames,
@@ -191,23 +175,11 @@
         << "An external ADM implementation will be used in VoiceEngine";
   }
 
-  // Register the ADM to the process thread, which will drive the error
-  // callback mechanism
-  if (shared_->process_thread()) {
-    shared_->process_thread()->RegisterModule(shared_->audio_device(),
-                                              RTC_FROM_HERE);
-  }
-
   bool available = false;
 
   // --------------------
   // Reinitialize the ADM
 
-  // Register the AudioObserver implementation
-  if (shared_->audio_device()->RegisterEventObserver(this) != 0) {
-    LOG(LS_ERROR) << "Init() failed to register event observer for the ADM";
-  }
-
   // Register the AudioTransport implementation
   if (shared_->audio_device()->RegisterAudioCallback(this) != 0) {
     LOG(LS_ERROR) << "Init() failed to register audio callback for the ADM";
@@ -489,9 +461,6 @@
   shared_->channel_manager().DestroyAllChannels();
 
   if (shared_->process_thread()) {
-    if (shared_->audio_device()) {
-      shared_->process_thread()->DeRegisterModule(shared_->audio_device());
-    }
     shared_->process_thread()->Stop();
   }
 
@@ -502,10 +471,6 @@
     if (shared_->audio_device()->StopRecording() != 0) {
       LOG(LS_ERROR) << "TerminateInternal() failed to stop recording";
     }
-    if (shared_->audio_device()->RegisterEventObserver(nullptr) != 0) {
-      LOG(LS_ERROR) << "TerminateInternal() failed to de-register event "
-                       "observer for the ADM";
-    }
     if (shared_->audio_device()->RegisterAudioCallback(nullptr) != 0) {
       LOG(LS_ERROR) << "TerminateInternal() failed to de-register audio "
                        "callback for the ADM";
diff --git a/voice_engine/voe_base_impl.h b/voice_engine/voe_base_impl.h
index d03a199..a3c4c1f 100644
--- a/voice_engine/voe_base_impl.h
+++ b/voice_engine/voe_base_impl.h
@@ -22,8 +22,7 @@
 class ProcessThread;
 
 class VoEBaseImpl : public VoEBase,
-                    public AudioTransport,
-                    public AudioDeviceObserver {
+                    public AudioTransport {
  public:
   int Init(
       AudioDeviceModule* external_adm,
@@ -81,10 +80,6 @@
                                      int64_t* elapsed_time_ms,
                                      int64_t* ntp_time_ms) override;
 
-  // AudioDeviceObserver
-  void OnErrorIsReported(const ErrorCode error) override;
-  void OnWarningIsReported(const WarningCode warning) override;
-
  protected:
   VoEBaseImpl(voe::SharedData* shared);
   ~VoEBaseImpl() override;