rtp

package
v0.0.0-...-051c27d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RtpVersion is used to verify compliance with current specification of the RTP protocol.
	RtpVersion = 2 << 6
	// HeaderSize defines the size of the fixed part of the packet, up to and inclding SSRC.
	HeaderSize = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

type Packet struct {
	VPXCC byte     // Version, Padding, Extension, Contributing Source Count
	MPT   byte     // Marker, Payload Type
	SN    uint16   // Sequense Number
	TS    uint32   // Timestamp
	SSRC  uint32   // Synchronization Source Identifier
	CSRC  []uint32 // Contributing Source Identifiers
	XH    uint16   // Extension Header (profile dependent)
	XL    uint16   // Extension Length (in `uint`s not inclusing this header)
	XD    []byte   // Extension Data
	PL    []byte   // Payload
}

Packet encapsulates RTP packet structure.

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |V=2|P|X| CC |M| PT | sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | timestamp | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | synchronization source (SSRC) identifier | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | contributing source (CSRC) identifiers | | .... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func Unpack

func Unpack(buf []byte) (*Packet, error)

Unpack validates a packed RTP packet and converts it into a sparse structure.

func (Packet) CC

func (p Packet) CC() byte

CC returns Contributing Source Count of the packet.

func (Packet) M

func (p Packet) M() bool

M returns Marker value of the packet.

func (Packet) P

func (p Packet) P() bool

P returns Padding flag value of the packet.

func (Packet) PT

func (p Packet) PT() byte

PT returns Payload Type of the packet.

func (*Packet) Pack

func (p *Packet) Pack() []byte

Pack converts sparse RTP packet into a slice of bytes for network.

func (Packet) X

func (p Packet) X() bool

X returns Extension flag value of the packet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL