From 32bf64028d5798e088302b54300a7034be3f4585 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sun, 20 Aug 2023 16:33:52 +0300 Subject: [PATCH] Fix ADTStoRTP parser --- pkg/aac/rtp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/aac/rtp.go b/pkg/aac/rtp.go index dd9de0e8..1df6e036 100644 --- a/pkg/aac/rtp.go +++ b/pkg/aac/rtp.go @@ -79,7 +79,7 @@ func RTPPay(handler core.HandlerFunc) core.HandlerFunc { func ADTStoRTP(src []byte) (dst []byte) { dst = make([]byte, 2) // header bytes - for i := 0; i < len(src); { + for i, n := 0, len(src)-ADTSHeaderSize; i < n; { auSize := ReadADTSSize(src[i:]) dst = append(dst, byte(auSize>>5), byte(auSize<<3)) // size in bits i += int(auSize)