bug 1474222 uninline ConvolverNodeEngine::ProcessBlock() r=padenot

MozReview-Commit-ID: tbuG2AQJoC

--HG--
extra : rebase_source : fd6aeca490b3a9ed1fb116abd25e8d0199802cca
This commit is contained in:
Karl Tomlinson 2018-07-16 19:22:15 +12:00
Родитель 398c9582ea
Коммит e0496cfa3b
1 изменённых файлов: 57 добавлений и 50 удалений

Просмотреть файл

@ -88,56 +88,7 @@ public:
GraphTime aFrom, GraphTime aFrom,
const AudioBlock& aInput, const AudioBlock& aInput,
AudioBlock* aOutput, AudioBlock* aOutput,
bool* aFinished) override bool* aFinished) override;
{
if (!mReverb) {
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}
AudioBlock input = aInput;
if (aInput.IsNull()) {
if (mLeftOverData > 0) {
mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
input.AllocateChannels(1);
WriteZeroesToAudioBlock(&input, 0, WEBAUDIO_BLOCK_SIZE);
} else {
if (mLeftOverData != INT32_MIN) {
mLeftOverData = INT32_MIN;
aStream->ScheduleCheckForInactive();
RefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
aStream->Graph()->DispatchToMainThreadAfterStreamStateUpdate(
refchanged.forget());
}
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}
} else {
if (aInput.mVolume != 1.0f) {
// Pre-multiply the input's volume
uint32_t numChannels = aInput.ChannelCount();
input.AllocateChannels(numChannels);
for (uint32_t i = 0; i < numChannels; ++i) {
const float* src = static_cast<const float*>(aInput.mChannelData[i]);
float* dest = input.ChannelFloatsForWrite(i);
AudioBlockCopyChannelWithScale(src, aInput.mVolume, dest);
}
}
if (mLeftOverData <= 0) {
RefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
aStream->Graph()->DispatchToMainThreadAfterStreamStateUpdate(
refchanged.forget());
}
mLeftOverData = mReverb->impulseResponseLength();
MOZ_ASSERT(mLeftOverData > 0);
}
aOutput->AllocateChannels(2);
mReverb->process(&input, aOutput);
}
bool IsActive() const override bool IsActive() const override
{ {
@ -168,6 +119,62 @@ private:
bool mNormalize; bool mNormalize;
}; };
void
ConvolverNodeEngine::ProcessBlock(AudioNodeStream* aStream,
GraphTime aFrom,
const AudioBlock& aInput,
AudioBlock* aOutput,
bool* aFinished)
{
if (!mReverb) {
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}
AudioBlock input = aInput;
if (aInput.IsNull()) {
if (mLeftOverData > 0) {
mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
input.AllocateChannels(1);
WriteZeroesToAudioBlock(&input, 0, WEBAUDIO_BLOCK_SIZE);
} else {
if (mLeftOverData != INT32_MIN) {
mLeftOverData = INT32_MIN;
aStream->ScheduleCheckForInactive();
RefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
aStream->Graph()->
DispatchToMainThreadAfterStreamStateUpdate(refchanged.forget());
}
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
return;
}
} else {
if (aInput.mVolume != 1.0f) {
// Pre-multiply the input's volume
uint32_t numChannels = aInput.ChannelCount();
input.AllocateChannels(numChannels);
for (uint32_t i = 0; i < numChannels; ++i) {
const float* src = static_cast<const float*>(aInput.mChannelData[i]);
float* dest = input.ChannelFloatsForWrite(i);
AudioBlockCopyChannelWithScale(src, aInput.mVolume, dest);
}
}
if (mLeftOverData <= 0) {
RefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
aStream->Graph()->
DispatchToMainThreadAfterStreamStateUpdate(refchanged.forget());
}
mLeftOverData = mReverb->impulseResponseLength();
MOZ_ASSERT(mLeftOverData > 0);
}
aOutput->AllocateChannels(2);
mReverb->process(&input, aOutput);
}
ConvolverNode::ConvolverNode(AudioContext* aContext) ConvolverNode::ConvolverNode(AudioContext* aContext)
: AudioNode(aContext, : AudioNode(aContext,
2, 2,