client: decode and encode RTP/RTCP packets

This commit is contained in:
aler9
2021-12-04 21:23:34 +01:00
committed by Alessandro Ros
parent 9a0eed07b3
commit b7df36d4ad
26 changed files with 422 additions and 332 deletions

View File

@@ -4,6 +4,8 @@ import (
"log"
"github.com/aler9/gortsplib"
"github.com/pion/rtcp"
"github.com/pion/rtp"
)
// This example shows how to
@@ -12,12 +14,12 @@ import (
func main() {
c := gortsplib.Client{
// called when a RTP packet arrives
OnPacketRTP: func(trackID int, payload []byte) {
log.Printf("RTP packet from track %d, size %d\n", trackID, len(payload))
OnPacketRTP: func(trackID int, pkt *rtp.Packet) {
log.Printf("RTP packet from track %d, payload type %d\n", trackID, pkt.Header.PayloadType)
},
// called when a RTCP packet arrives
OnPacketRTCP: func(trackID int, payload []byte) {
log.Printf("RTCP packet from track %d, size %d\n", trackID, len(payload))
OnPacketRTCP: func(trackID int, pkt rtcp.Packet) {
log.Printf("RTCP packet from track %d, type %T\n", trackID, pkt)
},
}