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

Unified Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp

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
Index: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
index d026540c47d147dc2e16d6f87e422ed128560208..ce29dc4ff142a0e5253712a313984fdfbffbc6ad 100644
--- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
@@ -102,7 +102,8 @@ BaseAudioContext::BaseAudioContext(Document* document)
m_periodicWaveSine(nullptr),
m_periodicWaveSquare(nullptr),
m_periodicWaveSawtooth(nullptr),
- m_periodicWaveTriangle(nullptr) {
+ m_periodicWaveTriangle(nullptr),
+ m_outputPosition() {
// If mediaPlaybackRequiresUserGesture is enabled, cross origin iframes will
// require user gesture for the AudioContext to produce sound.
if (document->settings() &&
@@ -134,7 +135,8 @@ BaseAudioContext::BaseAudioContext(Document* document,
m_periodicWaveSine(nullptr),
m_periodicWaveSquare(nullptr),
m_periodicWaveSawtooth(nullptr),
- m_periodicWaveTriangle(nullptr) {}
+ m_periodicWaveTriangle(nullptr),
+ m_outputPosition() {}
BaseAudioContext::~BaseAudioContext() {
deferredTaskHandler().contextWillBeDestroyed();
@@ -705,7 +707,8 @@ void BaseAudioContext::handleStoppableSourceNodes() {
}
}
-void BaseAudioContext::handlePreRenderTasks() {
+void BaseAudioContext::handlePreRenderTasks(
+ const AudioIOPosition& outputPosition) {
DCHECK(isAudioThread());
// At the beginning of every render quantum, try to update the internal
@@ -723,6 +726,9 @@ void BaseAudioContext::handlePreRenderTasks() {
// Update the dirty state of the listener.
listener()->updateState();
+ // Update output timestamp.
+ m_outputPosition = outputPosition;
+
unlock();
}
}
@@ -816,6 +822,12 @@ bool BaseAudioContext::isAllowedToStart() const {
return false;
}
+AudioIOPosition BaseAudioContext::outputPosition() {
+ DCHECK(isMainThread());
+ AutoLocker locker(this);
+ return m_outputPosition;
+}
+
void BaseAudioContext::rejectPendingResolvers() {
DCHECK(isMainThread());

Powered by Google App Engine
This is Rietveld 408576698