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

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

Issue 2777903005: Add WebThread in AudioDestination to support AudioWorkletThread (Closed)
Patch Set: Refactoring WIP (please ignore) 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..493a319503462498676016b943f6bf2ed05eee26 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
@@ -76,7 +77,13 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
virtual void Start();
virtual void Stop();
+ void RequestRenderOnWebThread(size_t numberOfFrames,
+ double delay,
+ double delayTimestamp,
+ size_t priorFramesSkipped);
o1ka 2017/04/13 08:36:53 Should these params also be renamed with a new sty
hongchan 2017/04/14 16:31:48 Done.
+
size_t CallbackBufferSize() const { return callback_buffer_size_; }
+
bool IsPlaying() { return is_playing_; }
double SampleRate() const { return web_audio_device_->SampleRate(); }
@@ -85,7 +92,7 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
// hardware.
int FramesPerBuffer() const { return web_audio_device_->FramesPerBuffer(); }
- // The information from the actual audio hardware. (via Platform::current)
+ // The information from the actual audio hardware. (via Platform::Current())
static float HardwareSampleRate();
static unsigned long MaxChannelCount();
@@ -95,27 +102,24 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback {
size_t callback_buffer_size_;
bool is_playing_;
- // The render callback function of WebAudio engine. (i.e. DestinationNode)
- AudioIOCallback& callback_;
+ // WebThread for WebAudio rendering.
+ std::unique_ptr<WebThread> rendering_thread_;
// To pass the data from FIFO to the audio device callback.
RefPtr<AudioBus> output_bus_;
- // To push the rendered result from WebAudio graph into the FIFO.
- RefPtr<AudioBus> render_bus_;
-
// Resolves the buffer size mismatch between the WebAudio engine and
// the callback function from the actual audio device.
std::unique_ptr<PushPullFIFO> fifo_;
- size_t frames_elapsed_;
- AudioIOPosition output_position_;
- base::TimeTicks output_position_received_timestamp_;
-
// Check if the buffer size chosen by the WebAudioDevice is too large.
bool CheckBufferSize();
size_t HardwareBufferSize();
+
+ bool IsRenderingThread();
+
+ size_t frames_elapsed_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698