From 75c9659e05363f2e29e01757dc66f14f3f20f318 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sun, 7 Mar 2021 14:17:32 +0000 Subject: [PATCH 1/2] Fix unreachable code & assign id to each profile. --- Emby.Dlna/Profiles/DefaultProfile.cs | 3 +++ Jellyfin.Api/Helpers/StreamingHelpers.cs | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index d4af72b626..8eaf12ba9a 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -1,5 +1,7 @@ #pragma warning disable CS1591 +using System; +using System.Globalization; using System.Linq; using MediaBrowser.Model.Dlna; @@ -10,6 +12,7 @@ namespace Emby.Dlna.Profiles { public DefaultProfile() { + Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); Name = "Generic Device"; ProtocolInfo = "http-get:*:video/mpeg:*,http-get:*:video/mp4:*,http-get:*:video/vnd.dlna.mpeg-tts:*,http-get:*:video/avi:*,http-get:*:video/x-matroska:*,http-get:*:video/x-ms-wmv:*,http-get:*:video/wtv:*,http-get:*:audio/mpeg:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/wav:*,http-get:*:audio/L16:*,http-get:*:image/jpeg:*,http-get:*:image/png:*,http-get:*:image/gif:*,http-get:*:image/tiff:*"; diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index d20a02cf5d..6bc5524cba 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -508,17 +508,18 @@ namespace Jellyfin.Api.Helpers private static void ApplyDeviceProfileSettings(StreamState state, IDlnaManager dlnaManager, IDeviceManager deviceManager, HttpRequest request, string? deviceProfileId, bool? @static) { - var headers = request.Headers; - if (!string.IsNullOrWhiteSpace(deviceProfileId)) { - state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId); - } - else if (!string.IsNullOrWhiteSpace(deviceProfileId)) - { - var caps = deviceManager.GetCapabilities(deviceProfileId); + if (state.DeviceProfile == null) + { + state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId); + } - state.DeviceProfile = caps == null ? dlnaManager.GetProfile(headers) : caps.DeviceProfile; + if (state.DeviceProfile == null) + { + var caps = deviceManager.GetCapabilities(deviceProfileId); + state.DeviceProfile = caps == null ? dlnaManager.GetProfile(request.Headers) : caps.DeviceProfile; + } } var profile = state.DeviceProfile; From 84da57cd4811d3bda6b3341c0a8a3b45b3aa72de Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Wed, 10 Mar 2021 09:07:11 +0000 Subject: [PATCH 2/2] Update StreamingHelpers.cs Updated condition --- Jellyfin.Api/Helpers/StreamingHelpers.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index 6bc5524cba..e2306aa272 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -510,10 +510,7 @@ namespace Jellyfin.Api.Helpers { if (!string.IsNullOrWhiteSpace(deviceProfileId)) { - if (state.DeviceProfile == null) - { - state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId); - } + state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId); if (state.DeviceProfile == null) {