aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgnattu <gnattu@users.noreply.github.com>2024-04-02 21:03:58 +0800
committerGitHub <noreply@github.com>2024-04-02 07:03:58 -0600
commit0af101cbf71abcf51de53645ea3e3ce257debdcd (patch)
tree0ba43cab446bb88412ada85eb37e577760e04e31
parent00499fa27bb61e2ac0e2e932f8406d27b020a08a (diff)
fix: av1 codecs string (#11280)
Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
-rw-r--r--Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs b/Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs
index 5eec1b0ca..ec67b4c1b 100644
--- a/Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs
+++ b/Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs
@@ -192,7 +192,7 @@ public static class HlsCodecStringHelpers
/// <returns>The AV1 codec string.</returns>
public static string GetAv1String(string? profile, int level, bool tierFlag, int bitDepth)
{
- // https://aomedia.org/av1/specification/annex-a/
+ // https://aomediacodec.github.io/av1-isobmff/#codecsparam
// FORMAT: [codecTag].[profile].[level][tier].[bitDepth]
StringBuilder result = new StringBuilder("av01", 13);
@@ -214,8 +214,7 @@ public static class HlsCodecStringHelpers
result.Append(".0");
}
- if (level <= 0
- || level > 31)
+ if (level is <= 0 or > 31)
{
// Default to the maximum defined level 6.3
level = 19;
@@ -230,7 +229,8 @@ public static class HlsCodecStringHelpers
}
result.Append('.')
- .Append(level)
+ // Needed to pad it double digits; otherwise, browsers will reject the stream.
+ .AppendFormat(CultureInfo.InvariantCulture, "{0:D2}", level)
.Append(tierFlag ? 'H' : 'M');
string bitDepthD2 = bitDepth.ToString("D2", CultureInfo.InvariantCulture);