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