Fix default audio selection ignoring type
This commit is contained in:
parent
e89d1a3be5
commit
644e774040
|
@ -13,11 +13,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
public static int? GetDefaultAudioStreamIndex(IReadOnlyList<MediaStream> streams, IReadOnlyList<string> preferredLanguages, bool preferDefaultTrack)
|
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)
|
if (preferDefaultTrack)
|
||||||
{
|
{
|
||||||
var defaultStream = streams.FirstOrDefault(i => i.IsDefault);
|
var defaultStream = sortedStreams.FirstOrDefault(i => i.IsDefault);
|
||||||
|
|
||||||
if (defaultStream != null)
|
if (defaultStream != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,15 +27,23 @@ public class MediaStreamSelectorTests
|
||||||
{
|
{
|
||||||
var streams = new MediaStream[]
|
var streams = new MediaStream[]
|
||||||
{
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Index = 0,
|
||||||
|
Type = MediaStreamType.Video,
|
||||||
|
IsDefault = true
|
||||||
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Index = 1,
|
Index = 1,
|
||||||
|
Type = MediaStreamType.Audio,
|
||||||
Language = "fre",
|
Language = "fre",
|
||||||
IsDefault = true
|
IsDefault = true
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Index = 2,
|
Index = 2,
|
||||||
|
Type = MediaStreamType.Audio,
|
||||||
Language = "eng",
|
Language = "eng",
|
||||||
IsDefault = false
|
IsDefault = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user