mirror of https://github.com/jellyfin/jellyfin.git
fix: av1 codecs string (#11280)
Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
parent
00499fa27b
commit
0af101cbf7
|
@ -192,7 +192,7 @@ public static class HlsCodecStringHelpers
|
||||||
/// <returns>The AV1 codec string.</returns>
|
/// <returns>The AV1 codec string.</returns>
|
||||||
public static string GetAv1String(string? profile, int level, bool tierFlag, int bitDepth)
|
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]
|
// FORMAT: [codecTag].[profile].[level][tier].[bitDepth]
|
||||||
StringBuilder result = new StringBuilder("av01", 13);
|
StringBuilder result = new StringBuilder("av01", 13);
|
||||||
|
|
||||||
|
@ -214,8 +214,7 @@ public static class HlsCodecStringHelpers
|
||||||
result.Append(".0");
|
result.Append(".0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level <= 0
|
if (level is <= 0 or > 31)
|
||||||
|| level > 31)
|
|
||||||
{
|
{
|
||||||
// Default to the maximum defined level 6.3
|
// Default to the maximum defined level 6.3
|
||||||
level = 19;
|
level = 19;
|
||||||
|
@ -230,7 +229,8 @@ public static class HlsCodecStringHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Append('.')
|
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');
|
.Append(tierFlag ? 'H' : 'M');
|
||||||
|
|
||||||
string bitDepthD2 = bitDepth.ToString("D2", CultureInfo.InvariantCulture);
|
string bitDepthD2 = bitDepth.ToString("D2", CultureInfo.InvariantCulture);
|
||||||
|
|
Loading…
Reference in New Issue