Chromium Code Reviews| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 103 |
| 104 int RendererWebAudioDeviceImpl::Render(base::TimeDelta delay, | 104 int RendererWebAudioDeviceImpl::Render(base::TimeDelta delay, |
| 105 base::TimeTicks delay_timestamp, | 105 base::TimeTicks delay_timestamp, |
| 106 int prior_frames_skipped, | 106 int prior_frames_skipped, |
| 107 media::AudioBus* dest) { | 107 media::AudioBus* dest) { |
| 108 // Wrap the output pointers using WebVector. | 108 // Wrap the output pointers using WebVector. |
| 109 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())); |
| 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 // Substruct the bus duration to get hardware delay. | |
| 114 delay -= media::AudioTimestampHelper::FramesToTime(dest->frames(), | |
|
miu
2016/11/04 21:29:40
Is this correct? I thought |delay| already did not
Mikhail
2016/11/07 18:28:03
that comes from https://codereview.chromium.org/24
miu
2016/11/07 23:49:40
Right, but isn't the output position correct witho
Mikhail
2016/11/28 15:15:59
You are right, this will be an estimation of the n
miu
2016/11/29 20:51:04
Seems right. I went through and re-read the spec a
| |
| 115 params_.sample_rate()); | |
| 116 | |
| 113 // TODO(xians): Remove the following |web_audio_source_data| after | 117 // TODO(xians): Remove the following |web_audio_source_data| after |
| 114 // changing the blink interface. | 118 // changing the blink interface. |
| 115 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); | 119 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); |
| 116 client_callback_->render(web_audio_source_data, web_audio_dest_data, | 120 client_callback_->render(web_audio_source_data, web_audio_dest_data, |
| 117 dest->frames()); | 121 dest->frames(), delay.InSecondsF(), |
| 122 (delay_timestamp - base::TimeTicks()).InSecondsF(), | |
| 123 prior_frames_skipped); | |
| 124 | |
| 118 return dest->frames(); | 125 return dest->frames(); |
| 119 } | 126 } |
| 120 | 127 |
| 121 void RendererWebAudioDeviceImpl::OnRenderError() { | 128 void RendererWebAudioDeviceImpl::OnRenderError() { |
| 122 // TODO(crogers): implement error handling. | 129 // TODO(crogers): implement error handling. |
| 123 } | 130 } |
| 124 | 131 |
| 125 } // namespace content | 132 } // namespace content |
| OLD | NEW |