b=949683 optimize zero-gain in GainNode r=padenot

--HG--
extra : transplant_source : %97Js%1B%23%13%AEb%7F%9E%B5%C4%BEx%84xV%C1%F7%5B
This commit is contained in:
Karl Tomlinson 2014-01-07 12:53:48 +13:00
Родитель 544419ae88
Коммит 3d7d128e05
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -70,8 +70,13 @@ public:
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
} else if (mGain.HasSimpleValue()) {
// Optimize the case where we only have a single value set as the volume
*aOutput = aInput;
aOutput->mVolume *= mGain.GetValue();
float gain = mGain.GetValue();
if (gain == 0.0f) {
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
} else {
*aOutput = aInput;
aOutput->mVolume *= gain;
}
} else {
// First, compute a vector of gains for each track tick based on the
// timeline at hand, and then for each channel, multiply the values