aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
diff options
context:
space:
mode:
authorJan Müller <github@lonebyte.de>2023-08-01 17:11:32 +0200
committerJan Müller <github@lonebyte.de>2023-08-01 17:11:32 +0200
commite9f23c61c937b230b1d3bd7865a083aeb3d51657 (patch)
tree80ee7c13cd6f3c49632eceb150c4c6cd35718dda /Jellyfin.Api/Helpers/DynamicHlsHelper.cs
parentd3c7af0d5c3709e18eac71fdb0279e985b6a9113 (diff)
Fix the fLaC/flac HLS issue also for audio-only
I moved the first application of the workaround out of the if block so that it also applies to audio-only streams. The workaround was extended likewise. We should first and foremost adhere to the specifications and apply workarounds afterwards for software that doesn't follow them. So I turned around the workaround to first output the fLaC variant and then the alternative flac variant. Fixes: #10066
Diffstat (limited to 'Jellyfin.Api/Helpers/DynamicHlsHelper.cs')
-rw-r--r--Jellyfin.Api/Helpers/DynamicHlsHelper.cs21
1 files changed, 12 insertions, 9 deletions
diff --git a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
index 63667e7e6..dfcccddfc 100644
--- a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
+++ b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
@@ -198,15 +198,15 @@ public class DynamicHlsHelper
var basicPlaylist = AppendPlaylist(builder, state, playlistUrl, totalBitrate, subtitleGroup);
- if (state.VideoStream is not null && state.VideoRequest is not null)
+ // Provide a workaround for the case issue between flac and fLaC.
+ var flacWaPlaylist = ApplyFlacCaseWorkaround(state, basicPlaylist.ToString());
+ if (!string.IsNullOrEmpty(flacWaPlaylist))
{
- // Provide a workaround for the case issue between flac and fLaC.
- var flacWaPlaylist = ApplyFlacCaseWorkaround(state, basicPlaylist.ToString());
- if (!string.IsNullOrEmpty(flacWaPlaylist))
- {
- builder.Append(flacWaPlaylist);
- }
+ builder.Append(flacWaPlaylist);
+ }
+ if (state.VideoStream is not null && state.VideoRequest is not null)
+ {
var encodingOptions = _serverConfigurationManager.GetEncodingOptions();
// Provide SDR HEVC entrance for backward compatibility.
@@ -775,8 +775,11 @@ public class DynamicHlsHelper
return string.Empty;
}
- var newPlaylist = srcPlaylist.Replace(",flac\"", ",fLaC\"", StringComparison.Ordinal);
+ var newPlaylist = srcPlaylist;
+
+ newPlaylist = newPlaylist.Replace(",fLaC\"", ",flac\"", StringComparison.Ordinal);
+ newPlaylist = newPlaylist.Replace("\"fLaC\"", "\"flac\"", StringComparison.Ordinal);
- return newPlaylist.Contains(",fLaC\"", StringComparison.Ordinal) ? newPlaylist : string.Empty;
+ return string.Equals(srcPlaylist, newPlaylist, StringComparison.Ordinal) ? string.Empty : newPlaylist;
}
}