Merge pull request #6043 from peterspenler/feature/chromecast-aac-handling

Reorder requested audio channels checks
This commit is contained in:
Claus Vium 2021-05-24 19:24:40 +02:00 committed by GitHub
commit ffe2770388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -146,6 +146,7 @@
- [nielsvanvelzen](https://github.com/nielsvanvelzen) - [nielsvanvelzen](https://github.com/nielsvanvelzen)
- [skyfrk](https://github.com/skyfrk) - [skyfrk](https://github.com/skyfrk)
- [ianjazz246](https://github.com/ianjazz246) - [ianjazz246](https://github.com/ianjazz246)
- [peterspenler](https://github.com/peterspenler)
# Emby Contributors # Emby Contributors

View File

@ -274,6 +274,16 @@ namespace MediaBrowser.Controller.MediaEncoding
public int? GetRequestedAudioChannels(string codec) public int? GetRequestedAudioChannels(string codec)
{ {
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "audiochannels");
if (!string.IsNullOrEmpty(value)
&& int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
}
if (BaseRequest.MaxAudioChannels.HasValue) if (BaseRequest.MaxAudioChannels.HasValue)
{ {
return BaseRequest.MaxAudioChannels; return BaseRequest.MaxAudioChannels;
@ -289,16 +299,6 @@ namespace MediaBrowser.Controller.MediaEncoding
return BaseRequest.TranscodingMaxAudioChannels; return BaseRequest.TranscodingMaxAudioChannels;
} }
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "audiochannels");
if (!string.IsNullOrEmpty(value)
&& int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
}
return null; return null;
} }