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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioDestination.h

Issue 2853923002: Improve thread creation in plaform/audio/AudioDestination (Closed)
Patch Set: Created 3 years, 8 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/platform/audio/AudioDestination.h
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.h b/third_party/WebKit/Source/platform/audio/AudioDestination.h
index 64797f225cfe21ea6e33bd4cbc787e338fb64ed7..b1dd817cff6188d32b2c936b832d50f361428ade 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDestination.h
+++ b/third_party/WebKit/Source/platform/audio/AudioDestination.h
@@ -85,14 +85,16 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
virtual void Start();
virtual void Stop();
- size_t CallbackBufferSize() const { return callback_buffer_size_; }
- bool IsPlaying() { return is_playing_; }
+ // Getters must be accessed from the main thread.
+ size_t CallbackBufferSize() const;
+ bool IsPlaying();
+ // TODO(hongchan): this should not be by the rendering thread.
haraken 2017/05/02 05:02:07 be called
hongchan 2017/05/02 16:49:41 Done.
double SampleRate() const { return web_audio_device_->SampleRate(); }
// Returns the audio buffer size in frames used by the underlying audio
// hardware.
- int FramesPerBuffer() const { return web_audio_device_->FramesPerBuffer(); }
+ int FramesPerBuffer() const;
// The information from the actual audio hardware. (via Platform::current)
static float HardwareSampleRate();
@@ -106,12 +108,13 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
bool IsRenderingThread();
+ // Accessed by the main thread.
std::unique_ptr<WebAudioDevice> web_audio_device_;
const unsigned number_of_output_channels_;
size_t callback_buffer_size_;
bool is_playing_;
- // Rendering thread for WebAudio graph.
+ // Accessed by the device thread. Rendering thread for WebAudio graph.
haraken 2017/05/02 05:02:07 The rendering_thread_ is accessed by the main thre
hongchan 2017/05/02 16:49:41 Its life cycle is governed by the main thread, but
haraken 2017/05/03 09:18:01 Makes sense. We could probably unify terms between
std::unique_ptr<WebThread> rendering_thread_;
// Accessed by both threads: resolves the buffer size mismatch between the

Powered by Google App Engine
This is Rietveld 408576698