Skip to content

Commit 869ec70

Browse files
committed
Fixes
1 parent 97dc965 commit 869ec70

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

chrome/player/FastStreamClient.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ export class FastStreamClient extends EventEmitter {
17361736
}
17371737
this.resetFailed();
17381738
this.updateQualityLevels();
1739+
this.audioConfigManager.updateChannelCount();
17391740
}
17401741
}
17411742

chrome/player/ui/audio/AudioChannelMixer.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ export class AudioChannelMixer extends AbstractAudioModule {
625625
els.dynButton.classList.toggle('configured', isEqActive || isCompActive);
626626
}
627627

628+
updateChannelCount() {
629+
this.updateNodes();
630+
if ( this.masterNodes.compressor) this.masterNodes.compressor.updateChannelCount();
631+
}
632+
628633
async updateNodes() {
629634
if (!this.audioContext) return;
630635

chrome/player/ui/audio/AudioCompressor.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ export class AudioCompressor extends AbstractAudioModule {
7373
this.updateCompressor();
7474
}
7575

76+
updateChannelCount() {
77+
const count = this.numberOfChannelsGetter ? this.numberOfChannelsGetter().catch((e) => 0) : 2;
78+
if (count && this.compressorNode) {
79+
if (count > 2 && (!this.splitterNode || this.splitterNode.numberOfOutputs !== Math.min(count, 6))) {
80+
this.destroyCompressorNodes();
81+
this.createCompressorNodes();
82+
} else if (count <= 2 && this.splitterNode) {
83+
this.destroyCompressorNodes();
84+
this.createCompressorNodes();
85+
}
86+
}
87+
}
88+
7689
async updateCompressor() {
7790
if (!this.compressorConfig) return;
7891

chrome/player/ui/audio/AudioConfigManager.mjs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class AudioConfigManager extends AbstractAudioModule {
452452
super.setupNodes(audioContext);
453453

454454
try {
455-
this.discardChannelCount();
455+
this.updateChannelCount();
456456
this.audioUpscaler.setupNodes(this.audioContext);
457457
this.audioChannelMixer.setupNodes(this.audioContext);
458458
this.audioCrosstalk.setupNodes(this.audioContext);
@@ -463,20 +463,23 @@ export class AudioConfigManager extends AbstractAudioModule {
463463
this.audioChannelMixer.getOutputNode().connect(this.audioCrosstalk.getInputNode());
464464
this.audioCrosstalk.getOutputNode().connect(this.finalGain.getInputNode());
465465
this.finalGain.getOutputNode().connect(this.getOutputNode());
466-
467-
this.getChannelCount().then((count) => {
468-
if (count === 1) {
469-
this.audioUpscaler.enable();
470-
} else {
471-
this.audioUpscaler.disable();
472-
}
473-
}).catch((e) => {
474-
});
475466
} catch (e) {
476467
AlertPolyfill.errorSendToDeveloper(e);
477468
}
478469
}
479470

471+
updateChannelCount() {
472+
this.discardChannelCount();
473+
this.getChannelCount().then((count) => {
474+
if (count === 1) {
475+
this.audioUpscaler.enable();
476+
} else {
477+
this.audioUpscaler.disable();
478+
}
479+
this.audioChannelMixer.updateChannelCount();
480+
}).catch((e) => {
481+
});
482+
}
480483

481484
async getChannelCount() {
482485
if (!this.audioContext) {

0 commit comments

Comments
 (0)