Allow an external audio processing module to be used in WebRTC

[This CL is a rebase of an original CL by solenberg@:
https://codereview.webrtc.org/2948763002/ which in turn was a
rebase of an original CL by peah@:
https://chromium-review.googlesource.com/c/527032/]

Allow an external audio processing module to be used in WebRTC

This CL adds support for optionally using an externally created audio
processing module in a peerconnection. The ownership is shared
between the peerconnection and the external creator of the module.

As part of this the internal ownership of the audio processing module
is moved from VoiceEngine to WebRtcVoiceEngine.

BUG=webrtc:7775

Review-Url: https://codereview.webrtc.org/2961723004
Cr-Commit-Position: refs/heads/master@{#18837}
diff --git a/webrtc/modules/audio_processing/audio_processing_unittest.cc b/webrtc/modules/audio_processing/audio_processing_unittest.cc
index 11ce917..59fbb91 100644
--- a/webrtc/modules/audio_processing/audio_processing_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc
@@ -7,7 +7,6 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
-
 #include <math.h>
 #include <stdio.h>
 
@@ -2805,7 +2804,7 @@
   // the config, and that the default initial level is maintained after the
   // config has been applied.
   std::unique_ptr<AudioProcessingImpl> apm(
-      new AudioProcessingImpl(webrtc::Config()));
+      new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
   AudioProcessing::Config config;
   EXPECT_FALSE(apm->config_.level_controller.enabled);
   // TODO(peah): Add test for the existence of the level controller object once
@@ -2835,7 +2834,7 @@
   // Verify that the initial level can be specified and is retained after the
   // config has been applied.
   std::unique_ptr<AudioProcessingImpl> apm(
-      new AudioProcessingImpl(webrtc::Config()));
+      new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
   AudioProcessing::Config config;
   config.level_controller.initial_peak_level_dbfs = -50.f;
   apm->ApplyConfig(config);
@@ -2857,7 +2856,7 @@
   // Verify that the config is properly reset when the specified initial peak
   // level is too low.
   std::unique_ptr<AudioProcessingImpl> apm(
-      new AudioProcessingImpl(webrtc::Config()));
+      new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
   AudioProcessing::Config config;
   config.level_controller.enabled = true;
   config.level_controller.initial_peak_level_dbfs = -101.f;
@@ -2875,7 +2874,7 @@
 
   // Verify that the config is properly reset when the specified initial peak
   // level is too high.
-  apm.reset(new AudioProcessingImpl(webrtc::Config()));
+  apm.reset(new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
   config = AudioProcessing::Config();
   config.level_controller.enabled = true;
   config.level_controller.initial_peak_level_dbfs = 1.f;