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

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

Issue 2777903005: Add WebThread in AudioDestination to support AudioWorkletThread (Closed)
Patch Set: Refactoring AudioDestination for thread safety 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 6bf30f33af2608473c36eb0b59c957efea71d48b..b0ce0a99eac20c8e409a55eb199887e6e01c0388 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDestination.h
+++ b/third_party/WebKit/Source/platform/audio/AudioDestination.h
@@ -43,6 +43,7 @@ namespace blink {
class PushPullFIFO;
class SecurityOrigin;
class WebAudioLatencyHint;
+class WebThread;
// The AudioDestination class is an audio sink interface between the media
// renderer and the Blink's WebAudio module. It has a FIFO to adapt the
@@ -73,6 +74,22 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
double delay_timestamp,
size_t prior_frames_skipped) override;
+ // FIFO calls back this function when more data is needed to fulfill the
+ // request from AudioDeviceThread.
+ void RequestRender(double delay,
+ double delay_timestamp,
+ size_t prior_frames_skipped,
+ size_t frames_requested,
+ size_t frames_to_render);
+
+ // The actual render request to the WebAudio destination node. This triggers
+ // the WebAudio rendering pipe line on the web thread.
+ void RequestRenderOnWebThread(size_t frames_requested,
+ size_t frames_to_render,
+ double delay,
+ double delay_timestamp,
+ size_t prior_frames_skipped);
+
virtual void Start();
virtual void Stop();
@@ -108,6 +125,9 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
// the callback function from the actual audio device.
std::unique_ptr<PushPullFIFO> fifo_;
+ // WebThread for WebAudio rendering.
+ std::unique_ptr<WebThread> rendering_thread_;
+
size_t frames_elapsed_;
AudioIOPosition output_position_;
base::TimeTicks output_position_received_timestamp_;
@@ -116,6 +136,8 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
bool CheckBufferSize();
size_t HardwareBufferSize();
+
+ bool IsRenderingThread();
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698