| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "content/renderer/media/audio_device_factory.h" | 15 #include "content/renderer/media/audio_device_factory.h" |
| 16 #include "content/renderer/render_frame_impl.h" | 16 #include "content/renderer/render_frame_impl.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
| 18 #include "media/base/audio_timestamp_helper.h" |
| 18 #include "media/base/silent_sink_suspender.h" | 19 #include "media/base/silent_sink_suspender.h" |
| 19 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 20 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 20 #include "third_party/WebKit/public/web/WebView.h" | 21 #include "third_party/WebKit/public/web/WebView.h" |
| 21 | 22 |
| 22 using blink::WebAudioDevice; | 23 using blink::WebAudioDevice; |
| 23 using blink::WebLocalFrame; | 24 using blink::WebLocalFrame; |
| 24 using blink::WebVector; | 25 using blink::WebVector; |
| 25 using blink::WebView; | 26 using blink::WebView; |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 #if defined(OS_ANDROID) | 95 #if defined(OS_ANDROID) |
| 95 webaudio_suspender_.reset(); | 96 webaudio_suspender_.reset(); |
| 96 #endif | 97 #endif |
| 97 } | 98 } |
| 98 | 99 |
| 99 double RendererWebAudioDeviceImpl::sampleRate() { | 100 double RendererWebAudioDeviceImpl::sampleRate() { |
| 100 return params_.sample_rate(); | 101 return params_.sample_rate(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 int RendererWebAudioDeviceImpl::Render(media::AudioBus* dest, | 104 int RendererWebAudioDeviceImpl::Render(base::TimeDelta delay, |
| 104 uint32_t frames_delayed, | 105 base::TimeTicks delay_timestamp, |
| 105 uint32_t frames_skipped) { | 106 int prior_frames_skipped, |
| 107 media::AudioBus* dest) { |
| 106 // Wrap the output pointers using WebVector. | 108 // Wrap the output pointers using WebVector. |
| 107 WebVector<float*> web_audio_dest_data(static_cast<size_t>(dest->channels())); | 109 WebVector<float*> web_audio_dest_data(static_cast<size_t>(dest->channels())); |
| 108 for (int i = 0; i < dest->channels(); ++i) | 110 for (int i = 0; i < dest->channels(); ++i) |
| 109 web_audio_dest_data[i] = dest->channel(i); | 111 web_audio_dest_data[i] = dest->channel(i); |
| 110 | 112 |
| 111 // TODO(xians): Remove the following |web_audio_source_data| after | 113 // TODO(xians): Remove the following |web_audio_source_data| after |
| 112 // changing the blink interface. | 114 // changing the blink interface. |
| 113 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); | 115 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); |
| 114 client_callback_->render(web_audio_source_data, web_audio_dest_data, | 116 client_callback_->render(web_audio_source_data, web_audio_dest_data, |
| 115 dest->frames()); | 117 dest->frames()); |
| 116 return dest->frames(); | 118 return dest->frames(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 void RendererWebAudioDeviceImpl::OnRenderError() { | 121 void RendererWebAudioDeviceImpl::OnRenderError() { |
| 120 // TODO(crogers): implement error handling. | 122 // TODO(crogers): implement error handling. |
| 121 } | 123 } |
| 122 | 124 |
| 123 } // namespace content | 125 } // namespace content |
| OLD | NEW |