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

Unified Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 161553002: Revert regression in AudioBufferSourceNode.start() with no buffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/AudioBufferSourceNode.cpp
diff --git a/Source/modules/webaudio/AudioBufferSourceNode.cpp b/Source/modules/webaudio/AudioBufferSourceNode.cpp
index 56edf982556a642e6179a9aa5acc0cd092a97ef5..d72fabc7c2c057fdff18705eed63664eddc75ad8 100644
--- a/Source/modules/webaudio/AudioBufferSourceNode.cpp
+++ b/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -376,28 +376,18 @@ unsigned AudioBufferSourceNode::numberOfChannels()
return output(0)->numberOfChannels();
}
-void AudioBufferSourceNode::start(ExceptionState& exceptionState)
-{
- startPlaying(false, 0, 0, buffer() ? buffer()->duration() : 0, exceptionState);
-}
-
void AudioBufferSourceNode::start(double when, ExceptionState& exceptionState)
{
- startPlaying(false, when, 0, buffer() ? buffer()->duration() : 0, exceptionState);
+ AudioScheduledSourceNode::start(when, exceptionState);
}
void AudioBufferSourceNode::start(double when, double grainOffset, ExceptionState& exceptionState)
{
- startPlaying(true, when, grainOffset, buffer() ? buffer()->duration() : 0, exceptionState);
+ start(when, grainOffset, buffer() ? buffer()->duration() : 0, exceptionState);
}
void AudioBufferSourceNode::start(double when, double grainOffset, double grainDuration, ExceptionState& exceptionState)
{
- startPlaying(true, when, grainOffset, grainDuration, exceptionState);
-}
-
-void AudioBufferSourceNode::startPlaying(bool isGrain, double when, double grainOffset, double grainDuration, ExceptionState& exceptionState)
-{
ASSERT(isMainThread());
if (m_playbackState != UNSCHEDULED_STATE) {
@@ -410,22 +400,20 @@ void AudioBufferSourceNode::startPlaying(bool isGrain, double when, double grain
if (!buffer())
return;
- if (isGrain) {
- // Do sanity checking of grain parameters versus buffer size.
- double bufferDuration = buffer()->duration();
+ // Do sanity checking of grain parameters versus buffer size.
+ double bufferDuration = buffer()->duration();
- grainOffset = max(0.0, grainOffset);
- grainOffset = min(bufferDuration, grainOffset);
- m_grainOffset = grainOffset;
+ grainOffset = max(0.0, grainOffset);
+ grainOffset = min(bufferDuration, grainOffset);
+ m_grainOffset = grainOffset;
- double maxDuration = bufferDuration - grainOffset;
+ double maxDuration = bufferDuration - grainOffset;
- grainDuration = max(0.0, grainDuration);
- grainDuration = min(maxDuration, grainDuration);
- m_grainDuration = grainDuration;
- }
+ grainDuration = max(0.0, grainDuration);
+ grainDuration = min(maxDuration, grainDuration);
+ m_grainDuration = grainDuration;
- m_isGrain = isGrain;
+ m_isGrain = true;
m_startTime = when;
// We call timeToSampleFrame here since at playbackRate == 1 we don't want to go through linear interpolation
@@ -442,7 +430,7 @@ void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double
// Handle unspecified duration where 0 means the rest of the buffer.
if (!grainDuration && buffer())
grainDuration = buffer()->duration();
- startPlaying(true, when, grainOffset, grainDuration, exceptionState);
+ start(when, grainOffset, grainDuration, exceptionState);
}
double AudioBufferSourceNode::totalPitchRate()
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioScheduledSourceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698