Optimize calculation of external audio stream index in MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

Co-authored-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
Jonas Resch 2021-12-03 19:19:22 +01:00 committed by GitHub
parent 120828d8d0
commit 99a48554a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2007,7 +2007,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (state.AudioStream.IsExternal) if (state.AudioStream.IsExternal)
{ {
int externalAudioMapIndex = state.SubtitleStream != null && state.SubtitleStream.IsExternal ? 2 : 1; int externalAudioMapIndex = state.SubtitleStream != null && state.SubtitleStream.IsExternal ? 2 : 1;
int externalAudioStream = state.MediaSource.MediaStreams.Where(i => i.Path == state.AudioStream.Path).ToList().IndexOf(state.AudioStream); int externalAudioStream = state.MediaSource.MediaStreams.FindIndex(i => i.Path == state.AudioStream.Path);
args += string.Format( args += string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,