Skip to content

Commit 74358b3

Browse files
committed
Optimize
1 parent 6776ae4 commit 74358b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chrome/player/ui/audio/OutputConvolver.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ export class OutputConvolver extends AbstractAudioModule {
145145
return;
146146
}
147147

148-
const isEnabled = this.config.enabled && this.config.channels.some((ch, i) => ch.enabled && this.convolverChannels[i] && this.convolverChannels[i].impulseBuffer);
149-
const needsGain = isEnabled && this.config.downmix && this.audioContext.destination.channelCount < channelCount;
150148
const finalChannelCount = (this.config.downmix && this.audioContext.destination.channelCount < channelCount) ? this.audioContext.destination.channelCount : channelCount;
149+
const activeChannels = AudioUtils.getActiveChannelsForChannelCount(finalChannelCount);
150+
const isEnabled = this.config.enabled && this.config.channels.some((ch, i) => ch.enabled && this.convolverChannels[i] && this.convolverChannels[i].impulseBuffer && activeChannels.includes(i));
151+
const needsGain = isEnabled && this.config.downmix && this.audioContext.destination.channelCount < channelCount;
151152
const needsDeleteSplitter = !isEnabled || (this.splitterNode && this.splitterNode.numberOfOutputs !== finalChannelCount);
152153

153-
const activeChannels = AudioUtils.getActiveChannelsForChannelCount(finalChannelCount);
154154
this.convolverChannels.forEach((ch, i) => {
155155
if (activeChannels.includes(i)) {
156156
ch.label.classList.remove('disabled');

0 commit comments

Comments
 (0)