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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h

Issue 2929283002: Avoid AudioBufferSourceHandler data race. (Closed)
Patch Set: minimize lock taking Created 3 years, 6 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: third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
index 0c6df89f691751eb2c2da141ee8766d886751a6e..e83db4a2b7fa251e6a6342fcc6031bcaaf62da7f 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h
@@ -168,8 +168,18 @@ class AudioBufferSourceHandler final : public AudioScheduledSourceHandler {
// conversion factor, and the value of playbackRate and detune AudioParams.
double ComputePlaybackRate();
+ double MinPlaybackRate();
hongchan 2017/06/12 14:09:18 GetMinPlaybackRate() might be better.
+
// The minimum playbackRate value ever used for this source.
double min_playback_rate_;
+
+ // |min_playback_rate_| may be updated by the audio thread
+ // while the main thread checks if the node is in a stoppable
+ // state, hence access needs to be atomic.
+ //
+ // TODO: when the codebase adopts std::atomic<>, use it for
+ // |min_playback_rate_|.
+ Mutex min_playback_rate_mutex_;
};
class AudioBufferSourceNode final : public AudioScheduledSourceNode {

Powered by Google App Engine
This is Rietveld 408576698