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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.h

Issue 2929283002: Avoid AudioBufferSourceHandler data race. (Closed)
Patch Set: rename accessor 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool is_grain_; 161 bool is_grain_;
162 double grain_offset_; // in seconds 162 double grain_offset_; // in seconds
163 double grain_duration_; // in seconds 163 double grain_duration_; // in seconds
164 // True if grainDuration is given explicitly (via 3 arg start method). 164 // True if grainDuration is given explicitly (via 3 arg start method).
165 bool is_duration_given_; 165 bool is_duration_given_;
166 166
167 // Compute playback rate (k-rate) by incorporating the sample rate 167 // Compute playback rate (k-rate) by incorporating the sample rate
168 // conversion factor, and the value of playbackRate and detune AudioParams. 168 // conversion factor, and the value of playbackRate and detune AudioParams.
169 double ComputePlaybackRate(); 169 double ComputePlaybackRate();
170 170
171 double GetMinPlaybackRate();
172
171 // The minimum playbackRate value ever used for this source. 173 // The minimum playbackRate value ever used for this source.
172 double min_playback_rate_; 174 double min_playback_rate_;
175
176 // |min_playback_rate_| may be updated by the audio thread
177 // while the main thread checks if the node is in a stoppable
178 // state, hence access needs to be atomic.
179 //
180 // TODO: when the codebase adopts std::atomic<>, use it for
181 // |min_playback_rate_|.
182 Mutex min_playback_rate_mutex_;
173 }; 183 };
174 184
175 class AudioBufferSourceNode final : public AudioScheduledSourceNode { 185 class AudioBufferSourceNode final : public AudioScheduledSourceNode {
176 DEFINE_WRAPPERTYPEINFO(); 186 DEFINE_WRAPPERTYPEINFO();
177 187
178 public: 188 public:
179 static AudioBufferSourceNode* Create(BaseAudioContext&, ExceptionState&); 189 static AudioBufferSourceNode* Create(BaseAudioContext&, ExceptionState&);
180 static AudioBufferSourceNode* Create(BaseAudioContext*, 190 static AudioBufferSourceNode* Create(BaseAudioContext*,
181 AudioBufferSourceOptions&, 191 AudioBufferSourceOptions&,
182 ExceptionState&); 192 ExceptionState&);
(...skipping 22 matching lines...) Expand all
205 private: 215 private:
206 AudioBufferSourceNode(BaseAudioContext&); 216 AudioBufferSourceNode(BaseAudioContext&);
207 217
208 Member<AudioParam> playback_rate_; 218 Member<AudioParam> playback_rate_;
209 Member<AudioParam> detune_; 219 Member<AudioParam> detune_;
210 }; 220 };
211 221
212 } // namespace blink 222 } // namespace blink
213 223
214 #endif // AudioBufferSourceNode_h 224 #endif // AudioBufferSourceNode_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698