1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #3722 from nyanmisaka/fix-audio-ch

(cherry picked from commit 0e0dd46c1b)
Signed-off-by: Bill Thornton <billt2006@gmail.com>
This commit is contained in:
Joshua M. Boniface 2022-06-26 20:53:47 -04:00 committed by Bill Thornton
parent 5312358f91
commit e455c70e36

View file

@ -312,7 +312,7 @@ import browser from './browser';
return -1;
}
function getPhysicalAudioChannels(options) {
function getPhysicalAudioChannels(options, videoTestElement) {
const allowedAudioChannels = parseInt(userSettings.allowedAudioChannels(), 10);
if (allowedAudioChannels > 0) {
@ -324,8 +324,14 @@ import browser from './browser';
}
const isSurroundSoundSupportedBrowser = browser.safari || browser.chrome || browser.edgeChromium || browser.firefox || browser.tv || browser.ps4 || browser.xboxOne;
const isAc3Eac3Supported = supportsAc3(videoTestElement) || supportsEac3(videoTestElement);
const speakerCount = getSpeakerCount();
// AC3/EAC3 hinted that device is able to play dolby surround sound.
if (isAc3Eac3Supported && isSurroundSoundSupportedBrowser) {
return speakerCount > 6 ? speakerCount : 6;
}
if (speakerCount > 2) {
if (isSurroundSoundSupportedBrowser) {
return speakerCount;
@ -348,12 +354,12 @@ import browser from './browser';
export default function (options) {
options = options || {};
const physicalAudioChannels = getPhysicalAudioChannels(options);
const bitrateSetting = getMaxBitrate();
const videoTestElement = document.createElement('video');
const physicalAudioChannels = getPhysicalAudioChannels(options, videoTestElement);
const canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, '');
const canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, '');
const webmAudioCodecs = ['vorbis'];