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

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

Issue 1405413004: Implement suspend() and resume() for OfflineAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/modules/webaudio/OfflineAudioDestinationNode.h
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h
index 736810419fec638606130531b0f0b04ff8aef2c2..52b0e5258bd9d1eee7ceda49413c5c8ad43120fa 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h
@@ -27,6 +27,7 @@
#include "modules/webaudio/AudioBuffer.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 +36,7 @@ namespace blink {
class AbstractAudioContext;
class AudioBus;
+class OfflineAudioContext;
class OfflineAudioDestinationHandler final : public AudioDestinationHandler {
public:
@@ -46,20 +48,35 @@ public:
void initialize() override;
void uninitialize() override;
+ OfflineAudioContext* context() const final;
+
// AudioDestinationHandler
void startRendering() override;
void stopRendering() override;
float sampleRate() const override { return m_renderTarget->sampleRate(); }
+ size_t renderQuantumLength() const;
+
+ WebThread* offlineRenderThread();
+
private:
OfflineAudioDestinationHandler(AudioNode&, AudioBuffer* renderTarget);
- void offlineRender();
- void offlineRenderInternal();
- // For completion callback on main thread.
+ // Destination's internal methods for start/pause/continue/finish rendering.
Raymond Toy 2015/10/16 23:32:37 Maybe document what these do. Hard to tell from t
hongchan 2015/10/19 20:08:12 Done.
+ void startOfflineRendering();
+ void suspendOfflineRendering();
+ void doOfflineRendering();
+ void finishOfflineRendering();
+
+ // Suspend/completion callbacks for the main thread.
+ void notifySuspend();
void notifyComplete();
+ // The offline version of render() method. virtual/override were not used
+ // for this method to ensure the optimum performance.
+ void offlineRender(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFrames);
+
// This AudioHandler renders into this AudioBuffer.
// This Persistent doesn't make a reference cycle including the owner
// OfflineAudioDestinationNode.
@@ -69,7 +86,13 @@ private:
// Rendering thread.
OwnPtr<WebThread> m_renderThread;
- bool m_startedRendering;
Raymond Toy 2015/10/16 23:32:37 Document what this is for. (You already mentioned
hongchan 2015/10/20 22:03:06 Done.
+
+ size_t m_framesProcessed;
+ size_t m_framesToProcess;
+
+ bool m_isRenderingStarted;
+
+ bool m_shouldSuspend;
};
class OfflineAudioDestinationNode final : public AudioDestinationNode {

Powered by Google App Engine
This is Rietveld 408576698