mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Fix default audio selection ignoring type
This commit is contained in:
parent
052a59ac3e
commit
5d66c84f2d
2 changed files with 10 additions and 2 deletions
|
@ -13,11 +13,11 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
public static int? GetDefaultAudioStreamIndex(IReadOnlyList<MediaStream> streams, IReadOnlyList<string> preferredLanguages, bool preferDefaultTrack)
|
||||
{
|
||||
var sortedStreams = GetSortedStreams(streams, MediaStreamType.Audio, preferredLanguages);
|
||||
var sortedStreams = GetSortedStreams(streams, MediaStreamType.Audio, preferredLanguages).ToList();
|
||||
|
||||
if (preferDefaultTrack)
|
||||
{
|
||||
var defaultStream = streams.FirstOrDefault(i => i.IsDefault);
|
||||
var defaultStream = sortedStreams.FirstOrDefault(i => i.IsDefault);
|
||||
|
||||
if (defaultStream != null)
|
||||
{
|
||||
|
|
|
@ -27,15 +27,23 @@ public class MediaStreamSelectorTests
|
|||
{
|
||||
var streams = new MediaStream[]
|
||||
{
|
||||
new()
|
||||
{
|
||||
Index = 0,
|
||||
Type = MediaStreamType.Video,
|
||||
IsDefault = true
|
||||
},
|
||||
new()
|
||||
{
|
||||
Index = 1,
|
||||
Type = MediaStreamType.Audio,
|
||||
Language = "fre",
|
||||
IsDefault = true
|
||||
},
|
||||
new()
|
||||
{
|
||||
Index = 2,
|
||||
Type = MediaStreamType.Audio,
|
||||
Language = "eng",
|
||||
IsDefault = false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue