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/renderer_webaudiodevice_impl.h" | 5 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/renderer/media/audio_device_factory.h" | 9 #include "content/renderer/media/audio_device_factory.h" |
10 #include "media/base/media_switches.h" | 10 #include "media/base/media_switches.h" |
11 | 11 |
12 using content::AudioDeviceFactory; | 12 using content::AudioDeviceFactory; |
13 using WebKit::WebAudioDevice; | 13 using WebKit::WebAudioDevice; |
14 using WebKit::WebVector; | 14 using WebKit::WebVector; |
15 | 15 |
16 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( | 16 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( |
| 17 int render_view_id, |
17 const media::AudioParameters& params, | 18 const media::AudioParameters& params, |
18 WebAudioDevice::RenderCallback* callback) | 19 WebAudioDevice::RenderCallback* callback) |
19 : is_running_(false), | 20 : is_running_(false), |
20 client_callback_(callback) { | 21 client_callback_(callback) { |
21 audio_device_ = AudioDeviceFactory::NewOutputDevice(); | 22 audio_device_ = AudioDeviceFactory::NewOutputDevice(render_view_id); |
22 | 23 |
23 // TODO(crogers): remove once we properly handle input device selection. | 24 // TODO(crogers): remove once we properly handle input device selection. |
24 // https://code.google.com/p/chromium/issues/detail?id=147327 | 25 // https://code.google.com/p/chromium/issues/detail?id=147327 |
25 if (CommandLine::ForCurrentProcess()->HasSwitch( | 26 if (CommandLine::ForCurrentProcess()->HasSwitch( |
26 switches::kEnableWebAudioInput)) { | 27 switches::kEnableWebAudioInput)) { |
27 // TODO(crogers): support more than hard-coded stereo: | 28 // TODO(crogers): support more than hard-coded stereo: |
28 // https://code.google.com/p/chromium/issues/detail?id=147326 | 29 // https://code.google.com/p/chromium/issues/detail?id=147326 |
29 audio_device_->InitializeIO(params, 2, this); | 30 audio_device_->InitializeIO(params, 2, this); |
30 } else { | 31 } else { |
31 audio_device_->Initialize(params, this); | 32 audio_device_->Initialize(params, this); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 client_callback_->render(web_audio_input_data, | 83 client_callback_->render(web_audio_input_data, |
83 web_audio_data, | 84 web_audio_data, |
84 dest->frames()); | 85 dest->frames()); |
85 } | 86 } |
86 } | 87 } |
87 | 88 |
88 void RendererWebAudioDeviceImpl::OnRenderError() { | 89 void RendererWebAudioDeviceImpl::OnRenderError() { |
89 // TODO(crogers): implement error handling. | 90 // TODO(crogers): implement error handling. |
90 } | 91 } |
OLD | NEW |