From fe5e16fdfab6e5f0a2ee31c65d857931885a8f47 Mon Sep 17 00:00:00 2001 From: sean tearney Date: Wed, 15 Sep 2021 12:03:03 +0800 Subject: [PATCH] NalUnit type has valid range 0-31 https://yumichan.net/video-processing/video-compression/introduction-to-h264-nal-unit/ --- RtspClientSharp/MediaParsers/H264Parser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RtspClientSharp/MediaParsers/H264Parser.cs b/RtspClientSharp/MediaParsers/H264Parser.cs index a217784..c90082e 100644 --- a/RtspClientSharp/MediaParsers/H264Parser.cs +++ b/RtspClientSharp/MediaParsers/H264Parser.cs @@ -120,7 +120,7 @@ private void ProcessNalUnit(ArraySegment byteSegment, bool hasStartMarker, int nalUnitType = byteSegment.Array[offset] & 0x1F; bool nri = ((byteSegment.Array[offset] >> 5) & 3) == 0; - if (!(nalUnitType > 0 && nalUnitType < 24)) + if (!(nalUnitType > -1 && nalUnitType < 32)) throw new H264ParserException($"Invalid nal unit type: {nalUnitType}"); if (nalUnitType == 7) @@ -286,4 +286,4 @@ private static FrameType GetFrameType(int sliceType) return FrameType.Unknown; } } -} \ No newline at end of file +}