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

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

Issue 2478283003: Use kRenderQuantumFrames in more places (Closed)
Patch Set: Created 4 years, 1 month 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.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
index 619c37873b44475730ab727e6fadad7c59c79690..f018446ffd6ab3628d8297878431b82fe017b475 100644
--- a/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OfflineAudioDestinationNode.cpp
@@ -31,6 +31,7 @@
#include "modules/webaudio/BaseAudioContext.h"
#include "modules/webaudio/OfflineAudioContext.h"
#include "platform/audio/AudioBus.h"
+#include "platform/audio/AudioUtilities.h"
#include "platform/audio/DenormalDisabler.h"
#include "platform/audio/HRTFDatabaseLoader.h"
#include "public/platform/Platform.h"
@@ -39,8 +40,6 @@
namespace blink {
-const size_t OfflineAudioDestinationHandler::renderQuantumSize = 128;
-
OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(
AudioNode& node,
AudioBuffer* renderTarget)
@@ -52,8 +51,8 @@ OfflineAudioDestinationHandler::OfflineAudioDestinationHandler(
m_framesToProcess(0),
m_isRenderingStarted(false),
m_shouldSuspend(false) {
- m_renderBus =
- AudioBus::create(renderTarget->numberOfChannels(), renderQuantumSize);
+ m_renderBus = AudioBus::create(renderTarget->numberOfChannels(),
+ AudioUtilities::kRenderQuantumFrames);
m_framesToProcess = m_renderTarget->length();
// Node-specific defaults.
@@ -157,7 +156,8 @@ void OfflineAudioDestinationHandler::startOfflineRendering() {
if (!channelsMatch)
return;
- bool isRenderBusAllocated = m_renderBus->length() >= renderQuantumSize;
+ bool isRenderBusAllocated =
+ m_renderBus->length() >= AudioUtilities::kRenderQuantumFrames;
DCHECK(isRenderBusAllocated);
if (!isRenderBusAllocated)
return;
@@ -181,14 +181,15 @@ void OfflineAudioDestinationHandler::doOfflineRendering() {
// Suspend the rendering and update m_shouldSuspend if a scheduled
// suspend found at the current sample frame. Otherwise render one
// quantum and return false.
- m_shouldSuspend =
- renderIfNotSuspended(0, m_renderBus.get(), renderQuantumSize);
+ m_shouldSuspend = renderIfNotSuspended(
+ 0, m_renderBus.get(), AudioUtilities::kRenderQuantumFrames);
if (m_shouldSuspend)
return;
size_t framesAvailableToCopy =
- std::min(m_framesToProcess, renderQuantumSize);
+ std::min(m_framesToProcess,
+ static_cast<size_t>(AudioUtilities::kRenderQuantumFrames));
for (unsigned channelIndex = 0; channelIndex < numberOfChannels;
++channelIndex) {

Powered by Google App Engine
This is Rietveld 408576698