From df3e66e5b2d1c2f59c914c2b476012c0aa4610c3 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 7 Apr 2019 14:50:48 +0930 Subject: [PATCH] protocol/rtp: removed redundant version checks from helper funcs in parse.go --- protocol/rtp/parse.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/protocol/rtp/parse.go b/protocol/rtp/parse.go index 92c75b0a..ede12ece 100644 --- a/protocol/rtp/parse.go +++ b/protocol/rtp/parse.go @@ -51,12 +51,6 @@ func Payload(d []byte) ([]byte, error) { // extHeaderLen returns the extension header length. The RTP packet must have // a compatible version, and must have an extension field, otherwise we panic. func extHeaderLen(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } - if !hasExt(d) { - panic("RTP packet does not have extension") - } extIdx := optionalFieldIdx + 4*csrcCount(d) return int(binary.BigEndian.Uint16(d[extIdx+2 : extIdx+4])) } @@ -64,9 +58,6 @@ func extHeaderLen(d []byte) int { // hasExt returns true if an extension is present in the RTP packet. The version // must be compatible otherwise we panic. func hasExt(d []byte) bool { - if version(d) != rtpVer { - panic(badVer) - } if (d[0] & 0x10 >> 4) == 1 { return true } @@ -76,9 +67,6 @@ func hasExt(d []byte) bool { // csrcCount returns the number of CSRC fields. If the version is not compatible // we panic. func csrcCount(d []byte) int { - if version(d) != rtpVer { - panic(badVer) - } return int(d[0] & 0x0f) }