Backed out changeset 2aa38a1a2b06 (bug 881959)

This commit is contained in:
Ed Morley 2013-09-17 17:14:42 +01:00
parent 1b19fad168
commit 14cbc2101a
2 changed files with 4 additions and 17 deletions

View File

@ -943,9 +943,6 @@ public:
*/
virtual void ForwardTrackEnabled(TrackID aOutputID, bool aEnabled) {};
bool InCycle() const { return mInCycle; }
protected:
// This state is all accessed only on the media graph thread.

View File

@ -128,28 +128,18 @@ public:
float* const* outputChannels = reinterpret_cast<float* const*>
(const_cast<void* const*>(aOutput->mChannelData.Elements()));
bool inCycle = aStream->AsProcessedStream()->InCycle();
double sampleRate = aStream->SampleRate();
if (mDelay.HasSimpleValue()) {
// If this DelayNode is in a cycle, make sure the delay value is at least
// one block.
float delayFrames = mDelay.GetValue() * sampleRate;
float delayFramesClamped = inCycle ? std::max(static_cast<float>(WEBAUDIO_BLOCK_SIZE), delayFrames) :
delayFrames;
mProcessor.Process(delayFramesClamped, inputChannels, outputChannels,
double delayFrames = mDelay.GetValue() * sampleRate;
mProcessor.Process(delayFrames, inputChannels, outputChannels,
numChannels, WEBAUDIO_BLOCK_SIZE);
} else {
// Compute the delay values for the duration of the input AudioChunk
// If this DelayNode is in a cycle, make sure the delay value is at least
// one block.
double computedDelay[WEBAUDIO_BLOCK_SIZE];
TrackTicks tick = aStream->GetCurrentPosition();
for (size_t counter = 0; counter < WEBAUDIO_BLOCK_SIZE; ++counter) {
float delayAtTick = mDelay.GetValueAtTime(tick, counter) * sampleRate;
float delayAtTickClamped = inCycle ? std::max(static_cast<float>(WEBAUDIO_BLOCK_SIZE), delayAtTick) :
delayAtTick;
computedDelay[counter] = delayAtTickClamped;
computedDelay[counter] =
mDelay.GetValueAtTime(tick, counter) * sampleRate;
}
mProcessor.Process(computedDelay, inputChannels, outputChannels,
numChannels, WEBAUDIO_BLOCK_SIZE);