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

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

Issue 2959693002: Simplify OfflineAudioDestinationNode::DoOfflineRendering(). (Closed)
Patch Set: rebased upto r482341 Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
index eafe4053bb6948bfc5a9ca808171a694ae5ea92b..4e911155cc3f071c7b096884c1b96b59d5571f26 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -48,8 +48,7 @@ OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(
render_target_(render_target),
frames_processed_(0),
frames_to_process_(0),
- is_rendering_started_(false),
- should_suspend_(false) {
+ is_rendering_started_(false) {
render_bus_ = AudioBus::Create(render_target->numberOfChannels(),
AudioUtilities::kRenderQuantumFrames);
frames_to_process_ = render_target_->length();
@@ -197,20 +196,14 @@ void OfflineAudioDestinationHandler::DoOfflineRendering() {
destinations.push_back(render_target_->getChannelData(i).View()->Data());
}
- // Reset the suspend flag.
- should_suspend_ = false;
-
// If there is more to process and there is no suspension at the moment,
// do continue to render quanta. Then calling OfflineAudioContext.resume()
// will pick up the render loop again from where it was suspended.
- while (frames_to_process_ > 0 && !should_suspend_) {
- // Suspend the rendering and update m_shouldSuspend if a scheduled
- // suspend found at the current sample frame. Otherwise render one
- // quantum and return false.
- should_suspend_ = RenderIfNotSuspended(
- 0, render_bus_.Get(), AudioUtilities::kRenderQuantumFrames);
-
- if (should_suspend_)
+ while (frames_to_process_ > 0) {
+ // Suspend the rendering if a scheduled suspend found at the current
+ // sample frame. Otherwise render one quantum.
+ if (RenderIfNotSuspended(0, render_bus_.Get(),
+ AudioUtilities::kRenderQuantumFrames))
return;
size_t frames_available_to_copy =
@@ -230,9 +223,8 @@ void OfflineAudioDestinationHandler::DoOfflineRendering() {
frames_to_process_ -= frames_available_to_copy;
}
- // Finish up the rendering loop if there is no more to process.
- if (!frames_to_process_)
- FinishOfflineRendering();
+ DCHECK_EQ(frames_to_process_, 0u);
+ FinishOfflineRendering();
}
void OfflineAudioDestinationHandler::SuspendOfflineRendering() {
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698