Fix supportsTranscoding not reflecting user permissions sometimes

This commit is contained in:
jakobkukla 2022-03-17 17:13:46 +01:00
parent ca517af0d9
commit 75475285da
2 changed files with 16 additions and 11 deletions

View File

@ -224,3 +224,4 @@
- [lbenini](https://github.com/lbenini)
- [gnuyent](https://github.com/gnuyent)
- [Matthew Jones](https://github.com/matthew-jones-uk)
- [Jakob Kukla](https://github.com/jakobkukla)

View File

@ -172,24 +172,16 @@ namespace Emby.Server.Implementations.Library
foreach (var source in dynamicMediaSources)
{
if (user != null)
{
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
}
// Validate that this is actually possible
if (source.SupportsDirectStream)
{
source.SupportsDirectStream = SupportsDirectStream(source.Path, source.Protocol);
}
list.Add(source);
}
if (user != null)
{
foreach (var source in list)
if (user != null)
{
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
@ -200,6 +192,8 @@ namespace Emby.Server.Implementations.Library
source.SupportsDirectStream = user.HasPermission(PermissionKind.EnablePlaybackRemuxing);
}
}
list.Add(source);
}
return SortMediaSources(list);
@ -338,6 +332,16 @@ namespace Emby.Server.Implementations.Library
foreach (var source in sources)
{
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
}
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding);
source.SupportsDirectStream = user.HasPermission(PermissionKind.EnablePlaybackRemuxing);
}
}
}