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 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 for (int i = 0; i < dest->channels(); ++i) | 110 for (int i = 0; i < dest->channels(); ++i) |
111 web_audio_dest_data[i] = dest->channel(i); | 111 web_audio_dest_data[i] = dest->channel(i); |
112 | 112 |
113 if (!delay.is_zero()) { // Zero values are send at the first call. | 113 if (!delay.is_zero()) { // Zero values are send at the first call. |
114 // Substruct the bus duration to get hardware delay. | 114 // Substruct the bus duration to get hardware delay. |
115 delay -= media::AudioTimestampHelper::FramesToTime(dest->frames(), | 115 delay -= media::AudioTimestampHelper::FramesToTime(dest->frames(), |
116 params_.sample_rate()); | 116 params_.sample_rate()); |
117 } | 117 } |
118 DCHECK_GE(delay, base::TimeDelta()); | 118 DCHECK_GE(delay, base::TimeDelta()); |
119 | 119 |
120 // TODO(xians): Remove the following |web_audio_source_data| after | 120 client_callback_->render( |
121 // changing the blink interface. | 121 web_audio_dest_data, dest->frames(), delay.InSecondsF(), |
122 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); | 122 (delay_timestamp - base::TimeTicks()).InSecondsF(), prior_frames_skipped); |
123 client_callback_->render(web_audio_source_data, web_audio_dest_data, | |
124 dest->frames(), delay.InSecondsF(), | |
125 (delay_timestamp - base::TimeTicks()).InSecondsF(), | |
126 prior_frames_skipped); | |
127 | 123 |
128 return dest->frames(); | 124 return dest->frames(); |
129 } | 125 } |
130 | 126 |
131 void RendererWebAudioDeviceImpl::OnRenderError() { | 127 void RendererWebAudioDeviceImpl::OnRenderError() { |
132 // TODO(crogers): implement error handling. | 128 // TODO(crogers): implement error handling. |
133 } | 129 } |
134 | 130 |
135 } // namespace content | 131 } // namespace content |
OLD | NEW |