| 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 using WebKit::WebAudioDevice; | 7 using WebKit::WebAudioDevice; |
| 8 using WebKit::WebVector; | 8 using WebKit::WebVector; |
| 9 | 9 |
| 10 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl(size_t buffer_size, | 10 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( |
| 11 int channels, double sample_rate, WebAudioDevice::RenderCallback* callback) | 11 const AudioParameters& params, WebAudioDevice::RenderCallback* callback) |
| 12 : is_running_(false), | 12 : is_running_(false), |
| 13 client_callback_(callback) { | 13 client_callback_(callback) { |
| 14 audio_device_ = new AudioDevice(buffer_size, channels, sample_rate, this); | 14 audio_device_ = new AudioDevice(params, this); |
| 15 } | 15 } |
| 16 | 16 |
| 17 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { | 17 RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() { |
| 18 stop(); | 18 stop(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void RendererWebAudioDeviceImpl::start() { | 21 void RendererWebAudioDeviceImpl::start() { |
| 22 if (!is_running_) { | 22 if (!is_running_) { |
| 23 audio_device_->Start(); | 23 audio_device_->Start(); |
| 24 is_running_ = true; | 24 is_running_ = true; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 48 web_audio_data[i] = audio_data[i]; | 48 web_audio_data[i] = audio_data[i]; |
| 49 | 49 |
| 50 client_callback_->render(web_audio_data, number_of_frames); | 50 client_callback_->render(web_audio_data, number_of_frames); |
| 51 } | 51 } |
| 52 return number_of_frames; | 52 return number_of_frames; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void RendererWebAudioDeviceImpl::OnRenderError() { | 55 void RendererWebAudioDeviceImpl::OnRenderError() { |
| 56 // TODO(crogers): implement error handling. | 56 // TODO(crogers): implement error handling. |
| 57 } | 57 } |
| OLD | NEW |