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

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

Issue 1256053006: Protect AudioScheduledSoureNode::m_startTime and m_endTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 98824d94f3470554897b98e1bc44f6c61ec698ba..39c30655e0e75e4b3b1eb898ce65a9e3d6759637 100644
--- a/Source/modules/webaudio/AudioBufferSourceNode.cpp
+++ b/Source/modules/webaudio/AudioBufferSourceNode.cpp
@@ -414,7 +414,7 @@ void AudioBufferSourceHandler::clampGrainParameters(const AudioBuffer* buffer)
// grainDuration is larger than the buffer duration. The net effect is as if the user called
// stop(when + grainDuration).
m_grainDuration = clampTo(m_grainDuration, 0.0, std::numeric_limits<double>::infinity());
- m_endTime = m_startTime + m_grainDuration;
+ setEndTime(startTime() + m_grainDuration);
} else {
m_grainDuration = clampTo(m_grainDuration, 0.0, bufferDuration - m_grainOffset);
}
@@ -495,7 +495,7 @@ void AudioBufferSourceHandler::startSource(double when, double grainOffset, doub
// If |when| < currentTime, the source must start now according to the spec.
// So just set startTime to currentTime in this case to start the source now.
- m_startTime = std::max(when, context()->currentTime());
+ setStartTime(std::max(when, context()->currentTime()));
if (buffer())
clampGrainParameters(buffer());
@@ -581,7 +581,7 @@ void AudioBufferSourceHandler::handleStoppableSourceNode()
// ok.
double actualDuration = buffer()->duration() / m_minPlaybackRate;
- double stopTime = m_startTime + actualDuration;
+ double stopTime = startTime() + actualDuration;
// See crbug.com/478301. If a source node is started via start(), the source may not start
// at that time but one quantum (128 frames) later. But we compute the stop time based on
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioScheduledSourceNode.h » ('j') | Source/modules/webaudio/AudioScheduledSourceNode.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698