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

Unified Diff: Source/modules/webaudio/ScriptProcessorNode.cpp

Issue 210973002: Supporting a playbackTime attribute on AudioprocessingEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some naming of valiable on test case. Created 6 years, 9 months 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
Index: Source/modules/webaudio/ScriptProcessorNode.cpp
diff --git a/Source/modules/webaudio/ScriptProcessorNode.cpp b/Source/modules/webaudio/ScriptProcessorNode.cpp
index 79c446c96f432d7f6cfed6d71feae697b7e15993..3aba767a1e7b96176e71f17b8425d6852b63eddf 100644
--- a/Source/modules/webaudio/ScriptProcessorNode.cpp
+++ b/Source/modules/webaudio/ScriptProcessorNode.cpp
@@ -265,8 +265,12 @@ void ScriptProcessorNode::fireProcessEvent()
// Let the audio thread know we've gotten to the point where it's OK for it to make another request.
m_isRequestOutstanding = false;
+ // Calculate a playbackTime with the buffersize which needs to be processed each time onaudioprocess is called.
+ // The outputBuffer being passed to JS will be played after exhuasting previous outputBuffer by double-buffering.
+ double playbackTime = (context()->currentSampleFrame() + m_bufferSize) / context()->sampleRate();
Raymond Toy 2014/03/28 18:14:14 Cast context()->sampleRate() to double because it'
KhNo 2014/03/29 00:24:46 I missed it. Thank you.
+
// Call the JavaScript event handler which will do the audio processing.
- dispatchEvent(AudioProcessingEvent::create(inputBuffer, outputBuffer));
+ dispatchEvent(AudioProcessingEvent::create(inputBuffer, outputBuffer, playbackTime));
}
}

Powered by Google App Engine
This is Rietveld 408576698