Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.cc

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (!delay.is_zero()) { // Zero values are send at the first call.
114 // Substruct the bus duration to get hardware delay.
115 delay -= media::AudioTimestampHelper::FramesToTime(dest->frames(),
116 params_.sample_rate());
117 }
118 DCHECK_GE(delay, base::TimeDelta());
119
113 // TODO(xians): Remove the following |web_audio_source_data| after 120 // TODO(xians): Remove the following |web_audio_source_data| after
114 // changing the blink interface. 121 // changing the blink interface.
115 WebVector<float*> web_audio_source_data(static_cast<size_t>(0)); 122 WebVector<float*> web_audio_source_data(static_cast<size_t>(0));
116 client_callback_->render(web_audio_source_data, web_audio_dest_data, 123 client_callback_->render(web_audio_source_data, web_audio_dest_data,
117 dest->frames()); 124 dest->frames(), delay.InSecondsF(),
125 (delay_timestamp - base::TimeTicks()).InSecondsF(),
126 prior_frames_skipped);
127
118 return dest->frames(); 128 return dest->frames();
119 } 129 }
120 130
121 void RendererWebAudioDeviceImpl::OnRenderError() { 131 void RendererWebAudioDeviceImpl::OnRenderError() {
122 // TODO(crogers): implement error handling. 132 // TODO(crogers): implement error handling.
123 } 133 }
124 134
125 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698