| OLD | NEW |
| 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/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 client_(NULL) { | 28 client_(NULL) { |
| 29 // We create an AudioRendererSink here, but we don't yet know the audio format | 29 // We create an AudioRendererSink here, but we don't yet know the audio format |
| 30 // (sample-rate, etc.) at this point. Later, when Initialize() is called, we | 30 // (sample-rate, etc.) at this point. Later, when Initialize() is called, we |
| 31 // have the audio format information and call AudioRendererSink::Initialize() | 31 // have the audio format information and call AudioRendererSink::Initialize() |
| 32 // to fully initialize it. | 32 // to fully initialize it. |
| 33 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 33 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 34 if (cmd_line->HasSwitch(switches::kEnableRendererSideMixing)) { | 34 if (cmd_line->HasSwitch(switches::kEnableRendererSideMixing)) { |
| 35 default_sink_ = RenderThreadImpl::current()-> | 35 default_sink_ = RenderThreadImpl::current()-> |
| 36 GetAudioRendererMixerManager()->CreateInput(); | 36 GetAudioRendererMixerManager()->CreateInput(); |
| 37 } else { | 37 } else { |
| 38 default_sink_ = AudioDeviceFactory::Create(); | 38 default_sink_ = AudioDeviceFactory::NewOutputDevice(); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 void RenderAudioSourceProvider::setClient( | 42 void RenderAudioSourceProvider::setClient( |
| 43 WebKit::WebAudioSourceProviderClient* client) { | 43 WebKit::WebAudioSourceProviderClient* client) { |
| 44 // Synchronize with other uses of client_ and default_sink_. | 44 // Synchronize with other uses of client_ and default_sink_. |
| 45 base::AutoLock auto_lock(sink_lock_); | 45 base::AutoLock auto_lock(sink_lock_); |
| 46 | 46 |
| 47 if (client && client != client_) { | 47 if (client && client != client_) { |
| 48 // Detach the audio renderer from normal playback. | 48 // Detach the audio renderer from normal playback. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 if (client_) { | 144 if (client_) { |
| 145 // Inform WebKit about the audio stream format. | 145 // Inform WebKit about the audio stream format. |
| 146 client_->setFormat(channels_, sample_rate_); | 146 client_->setFormat(channels_, sample_rate_); |
| 147 } | 147 } |
| 148 | 148 |
| 149 is_initialized_ = true; | 149 is_initialized_ = true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} | 152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} |
| OLD | NEW |