Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: content/renderer/media/render_audiosourceprovider.cc

Issue 10636036: Enable renderer side mixing behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove new mixer address != old mixer address test. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/render_audiosourceprovider.h" 5 #include "content/renderer/media/render_audiosourceprovider.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/common/content_switches.h"
9 #include "content/renderer/media/audio_device_factory.h" 11 #include "content/renderer/media/audio_device_factory.h"
12 #include "content/renderer/media/audio_renderer_mixer_manager.h"
13 #include "content/renderer/render_thread_impl.h"
14 #include "media/base/audio_renderer_mixer_input.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide rClient.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide rClient.h"
11 16
12 using content::AudioDeviceFactory; 17 using content::AudioDeviceFactory;
18 using content::AudioRendererMixerManager;
13 using std::vector; 19 using std::vector;
14 using WebKit::WebVector; 20 using WebKit::WebVector;
15 21
16 RenderAudioSourceProvider::RenderAudioSourceProvider() 22 RenderAudioSourceProvider::RenderAudioSourceProvider()
17 : is_initialized_(false), 23 : is_initialized_(false),
18 channels_(0), 24 channels_(0),
19 sample_rate_(0), 25 sample_rate_(0),
20 is_running_(false), 26 is_running_(false),
21 renderer_(NULL), 27 renderer_(NULL),
22 client_(NULL) { 28 client_(NULL) {
23 // We create the AudioDevice here using the factory. But we don't yet know 29 // We create an AudioRendererSink here, but we don't yet know the audio format
24 // the audio format (sample-rate, etc.) at this point. Later, when 30 // (sample-rate, etc.) at this point. Later, when Initialize() is called, we
25 // Initialize() is called, we have the audio format information and call 31 // have the audio format information and call AudioRendererSink::Initialize()
26 // the AudioDevice::Initialize() method to fully initialize it. 32 // to fully initialize it.
27 default_sink_ = AudioDeviceFactory::Create(); 33 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
34 if (cmd_line->HasSwitch(switches::kEnableRendererSideMixing)) {
35 default_sink_ = RenderThreadImpl::current()->
36 GetAudioRendererMixerManager()->CreateInput();
37 } else {
38 default_sink_ = AudioDeviceFactory::Create();
39 }
28 } 40 }
29 41
30 void RenderAudioSourceProvider::setClient( 42 void RenderAudioSourceProvider::setClient(
31 WebKit::WebAudioSourceProviderClient* client) { 43 WebKit::WebAudioSourceProviderClient* client) {
32 // Synchronize with other uses of client_ and default_sink_. 44 // Synchronize with other uses of client_ and default_sink_.
33 base::AutoLock auto_lock(sink_lock_); 45 base::AutoLock auto_lock(sink_lock_);
34 46
35 if (client && client != client_) { 47 if (client && client != client_) {
36 // Detach the audio renderer from normal playback. 48 // Detach the audio renderer from normal playback.
37 default_sink_->Stop(); 49 default_sink_->Stop();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 143
132 if (client_) { 144 if (client_) {
133 // Inform WebKit about the audio stream format. 145 // Inform WebKit about the audio stream format.
134 client_->setFormat(channels_, sample_rate_); 146 client_->setFormat(channels_, sample_rate_);
135 } 147 }
136 148
137 is_initialized_ = true; 149 is_initialized_ = true;
138 } 150 }
139 151
140 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} 152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_mixer_manager_unittest.cc ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698