Merge pull request #65 from osery/osery/ingore-rtcp

Skip RTCP packets when these are multiplexed on the same port.
This commit is contained in:
Andrey Semochkin 2022-08-04 21:09:44 +03:00 committed by GitHub
commit 030575e585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,11 @@ const (
)
const (
RTPHeaderSize = 12
RTPHeaderSize = 12
RTCPSenderReport = 200
RTCPReceiverReport = 201
)
const (
DESCRIBE = "DESCRIBE"
OPTIONS = "OPTIONS"
@ -558,6 +561,11 @@ func (client *RTSPClient) RTPDemuxer(payloadRAW *[]byte) ([]*av.Packet, bool) {
SequenceNumber := int(binary.BigEndian.Uint16(content[6:8]))
timestamp := int64(binary.BigEndian.Uint32(content[8:16]))
if isRTCPPacket(content) {
client.Println("skipping RTCP packet")
return nil, false
}
offset := RTPHeaderSize
end := len(content)
@ -950,3 +958,8 @@ func binSize(val int) []byte {
binary.BigEndian.PutUint32(buf, uint32(val))
return buf
}
func isRTCPPacket(content []byte) bool {
rtcpPacketType := content[5]
return rtcpPacketType == RTCPSenderReport || rtcpPacketType == RTCPReceiverReport
}