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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/renderer_webaudiodevice_impl.cc
diff --git a/content/renderer/media/renderer_webaudiodevice_impl.cc b/content/renderer/media/renderer_webaudiodevice_impl.cc
index 4924cc68fc2afddce8aa90a0347f34edf74d9e89..867da2eea2b99f7a2e49ed875b405d6c7d1b787d 100644
--- a/content/renderer/media/renderer_webaudiodevice_impl.cc
+++ b/content/renderer/media/renderer_webaudiodevice_impl.cc
@@ -110,11 +110,21 @@ int RendererWebAudioDeviceImpl::Render(base::TimeDelta delay,
for (int i = 0; i < dest->channels(); ++i)
web_audio_dest_data[i] = dest->channel(i);
+ if (!delay.is_zero()) { // Zero values are send at the first call.
+ // Substruct the bus duration to get hardware delay.
+ delay -= media::AudioTimestampHelper::FramesToTime(dest->frames(),
+ params_.sample_rate());
+ }
+ DCHECK_GE(delay, base::TimeDelta());
+
// TODO(xians): Remove the following |web_audio_source_data| after
// changing the blink interface.
WebVector<float*> web_audio_source_data(static_cast<size_t>(0));
client_callback_->render(web_audio_source_data, web_audio_dest_data,
- dest->frames());
+ dest->frames(), delay.InSecondsF(),
+ (delay_timestamp - base::TimeTicks()).InSecondsF(),
+ prior_frames_skipped);
+
return dest->frames();
}
« 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