Fix panic for broken RTP with AAC #697

This commit is contained in:
Alex X
2023-11-13 21:56:35 +03:00
parent 6d85b36f47
commit af72548a43
+5 -1
View File
@@ -28,9 +28,13 @@ func RTPDepay(handler core.HandlerFunc) core.HandlerFunc {
headers := packet.Payload[2 : 2+headersSize]
units := packet.Payload[2+headersSize:]
for len(headers) > 0 {
for len(headers) >= 2 {
unitSize := binary.BigEndian.Uint16(headers) >> 3
if len(units) < int(unitSize) {
return
}
unit := units[:unitSize]
headers = headers[2:]