Enable renderer side mixing behind a flag.

Lands the final bits required to turn on renderer side mixing behind
a flag!  Switching <audio> over to the PCM_LOW_LATENCY track to boot.
Specifically the flag is --enable-renderer-side-mixing.

The big picture: RenderThreadImpl owns an AudioRendererMixerManager
which RenderAudioSourceProvider uses to create AudioRenderMixerInput,
which extensions of AudioRendererSink.  When ARMM creates ARMI it
passes in callbacks which allow ARMI to retrieve an AudioRendererMixer
from ARMM once ARMI::Initialize() has been called.

When ARMM gets a request for an ARM from ARMI::Initialize() it will
first check if one exists and if so, hand out a reference.  If not, it
will create a new ARM instance (which it owns) and initialize it with
the proper hardware output AudioParameters and an AudioDevice based
AudioRenderSink.

ARM will immediately call Initialize() and Start() on AudioDevice which
will then begin requesting data via RenderCallback from ARM.

If the hardware sampling rate is not equal to the input sampling rate,
ARM will instantiate a MultiChannelResampler instance to resample the
audio as required for use by a PCM_LOW_LATENCY AudioDevice.

After ARMI::Initialize() nothing really happens until RASP() eventually
calls ARMI::Start() which will then register the ARMI instance with ARM.
At which point ARM will start mixing it into the output stream it's
providing to AudioDevice.

Everything works as far as I can tell, but an optimization pass and more
careful testing is necessary on Windows before the feature comes out from
behind the flag.

BUG=133637
TEST=New unit tests. Manual testing.

Review URL: https://chromiumcodereview.appspot.com/10636036

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146935 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 8857120..d3048d78 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -53,6 +53,7 @@
 }
 
 namespace content {
+class AudioRendererMixerManager;
 class BrowserPluginChannelManager;
 class BrowserPluginRegistry;
 class MediaStreamCenter;
@@ -223,6 +224,11 @@
   // threaded compositing is enabled.
   base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> GetGpuVDAContext3D();
 
+  // AudioRendererMixerManager instance which manages renderer side mixer
+  // instances shared based on configured audio parameters.  Lazily created on
+  // first call.
+  content::AudioRendererMixerManager* GetAudioRendererMixerManager();
+
  private:
   virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
 
@@ -303,6 +309,8 @@
 
   scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_;
 
+  scoped_ptr<content::AudioRendererMixerManager> audio_renderer_mixer_manager_;
+
   DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
 };