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