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

Unified Diff: Source/modules/webaudio/OfflineAudioDestinationNode.h

Issue 1140723003: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Promise Resolution Created 5 years, 7 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: Source/modules/webaudio/OfflineAudioDestinationNode.h
diff --git a/Source/modules/webaudio/OfflineAudioDestinationNode.h b/Source/modules/webaudio/OfflineAudioDestinationNode.h
index ca70d96aa1f5974f2f96f337040ff40479475c2d..1d91d73c564ccb58b7869444393407956e2dac54 100644
--- a/Source/modules/webaudio/OfflineAudioDestinationNode.h
+++ b/Source/modules/webaudio/OfflineAudioDestinationNode.h
@@ -26,7 +26,9 @@
#define OfflineAudioDestinationNode_h
#include "modules/webaudio/AudioBuffer.h"
+#include "modules/webaudio/AudioContext.h"
#include "modules/webaudio/AudioDestinationNode.h"
+#include "modules/webaudio/OfflineAudioContext.h"
#include "public/platform/WebThread.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
@@ -35,6 +37,7 @@ namespace blink {
class AudioBus;
class AudioContext;
+class OfflineAudioContext;
class OfflineAudioDestinationHandler final : public AudioDestinationHandler {
public:
@@ -54,22 +57,30 @@ public:
private:
OfflineAudioDestinationHandler(AudioNode&, AudioBuffer* renderTarget);
- void offlineRender();
- void offlineRenderInternal();
- // For completion callback on main thread.
+ // For start/suspend/resume rendering.
+ void initiateOfflineRendering();
+ void renderNextQuantum();
+ void finishOfflineRendering();
+
+ // For callback on main thread.
+ void notifySuspend();
void notifyComplete();
- // This AudioHandler renders into this AudioBuffer.
- // This Persistent doesn't make a reference cycle including the owner
- // OfflineAudioDestinationNode.
+ // This AudioHandler renders into this AudioBuffer. This Persistent doesn't
+ // make a reference cycle including the owner OfflineAudioDestinationNode.
Persistent<AudioBuffer> m_renderTarget;
+
// Temporary AudioBus for each render quantum.
RefPtr<AudioBus> m_renderBus;
// Rendering thread.
OwnPtr<WebThread> m_renderThread;
- bool m_startedRendering;
+
+ bool m_isRenderingStarted;
+
+ unsigned m_framesProcessed;
+ size_t m_framesToProcess;
};
class OfflineAudioDestinationNode final : public AudioDestinationNode {

Powered by Google App Engine
This is Rietveld 408576698