Backport pull request #4267 from jellyfin/release-10.8.z

Fix AudioContext limit exceeded

Original-merge: ea79d2651a

Merged-by: Bill Thornton <thornbill@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Dmitry Lyzo 2023-01-22 14:08:03 -05:00 committed by Joshua M. Boniface
parent abed235b50
commit 7c9464d0c3

View File

@ -283,16 +283,24 @@ import browser from './browser';
return bitrate;
}
let maxChannelCount = null;
function getSpeakerCount() {
if (maxChannelCount != null) {
return maxChannelCount;
}
maxChannelCount = -1;
const AudioContext = window.AudioContext || window.webkitAudioContext || false; /* eslint-disable-line compat/compat */
if (AudioContext) {
const audioCtx = new AudioContext();
return audioCtx.destination.maxChannelCount;
maxChannelCount = audioCtx.destination.maxChannelCount;
}
return -1;
return maxChannelCount;
}
function getPhysicalAudioChannels(options, videoTestElement) {