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

Unified Diff: Source/modules/webaudio/AudioContext.h

Issue 773273002: Update the current frame count in a safe place (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Modify test to allow 1 block delay. Created 6 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 | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioContext.h
diff --git a/Source/modules/webaudio/AudioContext.h b/Source/modules/webaudio/AudioContext.h
index e777ae25ad341e72afb12f58fc64b71581aeaece..14848d3dc68b2ac94767d5fcb5af8346cd5f88dc 100644
--- a/Source/modules/webaudio/AudioContext.h
+++ b/Source/modules/webaudio/AudioContext.h
@@ -106,7 +106,12 @@ public:
virtual bool hasPendingActivity() const override;
AudioDestinationNode* destination() { return m_destinationNode.get(); }
+ // currentSampleFrame() returns the current sample frame. It should only be called from the
+ // audio thread.
size_t currentSampleFrame() const { return m_destinationNode->currentSampleFrame(); }
+ // cachedSampleFrame() is like currentSampleFrame() but must be called from the main thread to
+ // get the sample frame. It might be slightly behind curentSampleFrame() due to locking.
+ size_t cachedSampleFrame() const;
double currentTime() const { return m_destinationNode->currentTime(); }
float sampleRate() const { return m_destinationNode->sampleRate(); }
String state() const;
@@ -397,6 +402,9 @@ private:
GC_PLUGIN_IGNORE("http://crbug.com/404527")
HashSet<AudioNode*> m_deferredCountModeChange;
+ // Follows the destination's currentSampleFrame, but might be slightly behind due to locking.
+ size_t m_cachedSampleFrame;
+
// This is considering 32 is large enough for multiple channels audio.
// It is somewhat arbitrary and could be increased if necessary.
enum { MaxNumberOfChannels = 32 };
« no previous file with comments | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698