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/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/media/audio_device_factory.h" | 8 #include "content/renderer/media/audio_device_factory.h" |
9 | 9 |
10 using content::AudioDeviceFactory; | 10 using content::AudioDeviceFactory; |
11 using WebKit::WebAudioDevice; | 11 using WebKit::WebAudioDevice; |
12 using WebKit::WebVector; | 12 using WebKit::WebVector; |
13 | 13 |
14 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( | 14 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( |
| 15 int render_view_id, |
15 const media::AudioParameters& params, | 16 const media::AudioParameters& params, |
16 WebAudioDevice::RenderCallback* callback) | 17 WebAudioDevice::RenderCallback* callback) |
17 : is_running_(false), | 18 : is_running_(false), |
18 client_callback_(callback) { | 19 client_callback_(callback) { |
19 audio_device_ = AudioDeviceFactory::NewOutputDevice(); | 20 audio_device_ = AudioDeviceFactory::NewOutputDevice(render_view_id); |
20 audio_device_->Initialize(params, this); | 21 audio_device_->Initialize(params, this); |
21 } | 22 } |
22 | 23 |
23 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { | 24 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { |
24 stop(); | 25 stop(); |
25 } | 26 } |
26 | 27 |
27 void RendererWebAudioDeviceImpl::start() { | 28 void RendererWebAudioDeviceImpl::start() { |
28 if (!is_running_) { | 29 if (!is_running_) { |
29 audio_device_->Start(); | 30 audio_device_->Start(); |
(...skipping 24 matching lines...) Expand all Loading... |
54 web_audio_data[i] = audio_data[i]; | 55 web_audio_data[i] = audio_data[i]; |
55 | 56 |
56 client_callback_->render(web_audio_data, number_of_frames); | 57 client_callback_->render(web_audio_data, number_of_frames); |
57 } | 58 } |
58 return number_of_frames; | 59 return number_of_frames; |
59 } | 60 } |
60 | 61 |
61 void RendererWebAudioDeviceImpl::OnRenderError() { | 62 void RendererWebAudioDeviceImpl::OnRenderError() { |
62 // TODO(crogers): implement error handling. | 63 // TODO(crogers): implement error handling. |
63 } | 64 } |
OLD | NEW |