| 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 const media::AudioParameters& params, | 15 const media::AudioParameters& params, |
| 16 WebAudioDevice::RenderCallback* callback) | 16 WebAudioDevice::RenderCallback* callback) |
| 17 : is_running_(false), | 17 : is_running_(false), |
| 18 client_callback_(callback) { | 18 client_callback_(callback) { |
| 19 audio_device_ = AudioDeviceFactory::Create(); | 19 audio_device_ = AudioDeviceFactory::NewOutputDevice(); |
| 20 audio_device_->Initialize(params, this); | 20 audio_device_->Initialize(params, this); |
| 21 } | 21 } |
| 22 | 22 |
| 23 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { | 23 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { |
| 24 stop(); | 24 stop(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void RendererWebAudioDeviceImpl::start() { | 27 void RendererWebAudioDeviceImpl::start() { |
| 28 if (!is_running_) { | 28 if (!is_running_) { |
| 29 audio_device_->Start(); | 29 audio_device_->Start(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 web_audio_data[i] = audio_data[i]; | 54 web_audio_data[i] = audio_data[i]; |
| 55 | 55 |
| 56 client_callback_->render(web_audio_data, number_of_frames); | 56 client_callback_->render(web_audio_data, number_of_frames); |
| 57 } | 57 } |
| 58 return number_of_frames; | 58 return number_of_frames; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void RendererWebAudioDeviceImpl::OnRenderError() { | 61 void RendererWebAudioDeviceImpl::OnRenderError() { |
| 62 // TODO(crogers): implement error handling. | 62 // TODO(crogers): implement error handling. |
| 63 } | 63 } |
| OLD | NEW |