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