Bug 875529 - Correctly reserve some extra junk at the end of the down-mixing buffer; r=roc

CUSTOM_CHANNEL_LAYOUTS is 6, and we use the index 6 to denote channels that
must be ignored, therefore we need an array of 7 values here.
This commit is contained in:
Ehsan Akhgari 2013-05-23 23:29:25 -04:00
parent 5102ce7d5f
commit 9cb95ec93a

View File

@ -179,8 +179,8 @@ AudioChannelsDownMix(const nsTArray<const void*>& aChannelArray,
for (uint32_t s = 0; s < aDuration; ++s) { for (uint32_t s = 0; s < aDuration; ++s) {
// Reserve an extra junk channel at the end for the cases where we // Reserve an extra junk channel at the end for the cases where we
// want an input channel to contribute to nothing // want an input channel to contribute to nothing
float outputChannels[CUSTOM_CHANNEL_LAYOUTS]; float outputChannels[CUSTOM_CHANNEL_LAYOUTS + 1];
memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS - 1)); memset(outputChannels, 0, sizeof(float)*(CUSTOM_CHANNEL_LAYOUTS));
for (uint32_t c = 0; c < inputChannelCount; ++c) { for (uint32_t c = 0; c < inputChannelCount; ++c) {
outputChannels[m.mInputDestination[c]] += outputChannels[m.mInputDestination[c]] +=
m.mInputCoefficient[c]*(static_cast<const float*>(inputChannels[c]))[s]; m.mInputCoefficient[c]*(static_cast<const float*>(inputChannels[c]))[s];