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) }