mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 881959 - Clamp the DelayNode.delayTime to 128/AudioContext.sampleRate when in a cycle. r=ehsan
--HG-- extra : rebase_source : 5282e468fbe411a455f65bc0d22b16163db4bd7a
This commit is contained in:
parent
a4656230f2
commit
65b02e466e
@ -943,6 +943,9 @@ 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.
|
||||
|
||||
|
@ -128,18 +128,28 @@ 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()) {
|
||||
double delayFrames = mDelay.GetValue() * sampleRate;
|
||||
mProcessor.Process(delayFrames, inputChannels, outputChannels,
|
||||
// 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,
|
||||
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) {
|
||||
computedDelay[counter] =
|
||||
mDelay.GetValueAtTime(tick, counter) * sampleRate;
|
||||
float delayAtTick = mDelay.GetValueAtTime(tick, counter) * sampleRate;
|
||||
float delayAtTickClamped = inCycle ? std::max(static_cast<float>(WEBAUDIO_BLOCK_SIZE), delayAtTick) :
|
||||
delayAtTick;
|
||||
computedDelay[counter] = delayAtTickClamped;
|
||||
}
|
||||
mProcessor.Process(computedDelay, inputChannels, outputChannels,
|
||||
numChannels, WEBAUDIO_BLOCK_SIZE);
|
||||
|
Loading…
Reference in New Issue
Block a user