Skip to content

Commit

Permalink
Add RTCP Messages
Browse files Browse the repository at this point in the history
*Avoid a type switch in srtp.go
*Add support for transport layer nack and
    slice loss indication messages
*Add String() functions for several RTCP
    packets to aid in debugging
*Add support for transparent profile
    extensions to ReceiverReport messages

Relates to #119
  • Loading branch information
wdouglass committed Dec 4, 2018
1 parent 756160f commit 19cf46f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rtp

import (
"encoding/binary"
"fmt"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -47,6 +48,21 @@ const (
csrcLength = 4
)

// String helps with debugging by printing packet information in a readable way
func (p Packet) String() string {
out := "RTP PACKET:\n"

out += fmt.Sprintf("\tVersion: %v\n", p.Version)
out += fmt.Sprintf("\tMarker: %v\n", p.Marker)
out += fmt.Sprintf("\tPayload Type: %d\n", p.PayloadType)
out += fmt.Sprintf("\tSequence Number: %d\n", p.SequenceNumber)
out += fmt.Sprintf("\tTimestamp: %d\n", p.Timestamp)
out += fmt.Sprintf("\tSSRC: %d (%x)\n", p.SSRC, p.SSRC)
out += fmt.Sprintf("\tPayload Length: %d\n", len(p.Payload))

return out
}

// Unmarshal parses the passed byte slice and stores the result in the Packet this method is called upon
func (p *Packet) Unmarshal(rawPacket []byte) error {
if len(rawPacket) < headerLength {
Expand Down

0 comments on commit 19cf46f

Please sign in to comment.