go-rtp: bitbucket.org/liamstask/go-rtp/rtp Index | Files

package rtp

import "bitbucket.org/liamstask/go-rtp/rtp"


Package Files

handler.go interval.go packetRtcp.go packetRtp.go session.go source.go transport.go transportUdp.go


const (
    RtcpSenderReport   = 200
    RtcpReceiverReport = 201
    RtcpSdes           = 202
    RtcpBye            = 203

RTCP packet types

const (
    SdesEnd       = iota // end of SDES list, null octet
    SdesCname            // canonical name
    SdesName             // user name
    SdesEmail            // user's electronic mail address
    SdesPhone            // user's phone number
    SdesLoc              // geographic user location
    SdesTool             // name of application or tool
    SdesNote             // notice about the source
    SdesPriv             // private extensions
    SdesH323Caddr        // H.323 callable address


SDES chunk types

const (
    Audio = 1 << 0
    Video = 1 << 1


var PayloadTypes = map[uint8]*PayloadType{
    0:  {Audio, 8000, 1, "PCMU"},
    3:  {Audio, 8000, 1, "GSM"},
    4:  {Audio, 8000, 1, "G723"},
    5:  {Audio, 8000, 1, "DVI4"},
    6:  {Audio, 16000, 1, "DVI4"},
    7:  {Audio, 8000, 1, "LPC"},
    8:  {Audio, 8000, 1, "PCMA"},
    9:  {Audio, 8000, 1, "G722"},
    10: {Audio, 44100, 2, "L16"},
    11: {Audio, 44100, 1, "L16"},
    12: {Audio, 8000, 1, "QCELP"},
    13: {Audio, 8000, 1, "CN"},
    14: {Audio, 90000, 0, "MPA"},
    15: {Audio, 8000, 1, "G728"},
    16: {Audio, 11025, 1, "DVI4"},
    17: {Audio, 22050, 1, "DVI4"},
    18: {Audio, 8000, 1, "G729"},
    25: {Video, 90000, 0, "CelB"},
    26: {Video, 90000, 0, "JPEG"},
    28: {Video, 90000, 0, "nv"},
    31: {Video, 90000, 0, "H261"},
    32: {Video, 90000, 0, "MPV"},
    33: {Audio | Video, 90000, 0, "MP2T"},
    34: {Video, 90000, 0, "H263"},

type ByePacket Uses

type ByePacket struct {
    Header *RtcpFixedHeader
    Srcs   []uint32
    Reason string

type CtrlEvent Uses

type CtrlEvent struct {
    EventType int    // Either a Stream event or a Rtcp* packet type event, e.g. RtcpSR, RtcpRR, RtcpSdes, RtcpBye
    Ssrc      uint32 // the input stream's SSRC
    Index     uint32 // and its index
    Reason    string // Resaon string if it was available, empty otherwise

type CtrlEventHandler Uses

type CtrlEventHandler interface {

type CtrlEventHandlerFunc Uses

type CtrlEventHandlerFunc func(*CtrlEvent)

func (CtrlEventHandlerFunc) HandleCtrlEvent Uses

func (f CtrlEventHandlerFunc) HandleCtrlEvent(e *CtrlEvent)

type PayloadType Uses

type PayloadType struct {
    Media      int // audio or video
    SampleRate int
    Channels   int
    Name       string

type ReceiverReport Uses

type ReceiverReport struct {
    Header  *RtcpFixedHeader
    SyncSrc uint8

type ReceptionReport Uses

type ReceptionReport struct {
    Ssrc             uint32
    FracLost         uint8
    PacketsLost      uint32
    HighSeqNum       uint32
    Jitter           uint32
    LastSRTimestamp  uint32
    DelaySinceLastSR uint32

sub-struct within a SenderReport

type RtcpFixedHeader Uses

type RtcpFixedHeader struct {
    Version    uint8
    Padding    bool
    RCount     uint8
    PacketType uint8
    Length     int // in bytes

each RTCP packet begins with a fixed header

type RtcpHandler Uses

type RtcpHandler interface {

type RtcpHandlerFunc Uses

type RtcpHandlerFunc func(*RtcpPacket)

func (RtcpHandlerFunc) HandleRtcp Uses

func (f RtcpHandlerFunc) HandleRtcp(p *RtcpPacket)

type RtcpPacket Uses

type RtcpPacket struct {
    // contains filtered or unexported fields

func (*RtcpPacket) ByePacket Uses

func (p *RtcpPacket) ByePacket(h *RtcpFixedHeader, pos int) *ByePacket

Extract a BYE packet starting at pos

func (*RtcpPacket) Header Uses

func (p *RtcpPacket) Header(pos int) *RtcpFixedHeader

Extract the fixed size header from this packet starting at pos

func (*RtcpPacket) SdesPacket Uses

func (p *RtcpPacket) SdesPacket(h *RtcpFixedHeader, pos int) *SdesPacket

Extract an SDES packet starting at pos

func (*RtcpPacket) SenderReport Uses

func (p *RtcpPacket) SenderReport(h *RtcpFixedHeader, pos int) *SenderReport

Extract a sender report from this packet starting at pos.

type RtpHandler Uses

type RtpHandler interface {

type RtpHandlerFunc Uses

type RtpHandlerFunc func(*RtpPacket)

func (RtpHandlerFunc) HandleRtp Uses

func (f RtpHandlerFunc) HandleRtp(p *RtpPacket)

type RtpHeader Uses

type RtpHeader struct {
    Version     uint8
    Padding     bool
    Extension   bool
    CsrcCount   uint8 // 0 - 15
    Marker      bool
    PayloadType uint8
    SeqNum      uint16 // init'd randomly to avoid plaintext attacks
    Timestamp   uint32
    SyncSrc     uint32
    CsrcList    []uint32 // len == CsrcCount

Fixed size header for all RTP packets

func (*RtpHeader) IsValid Uses

func (h *RtpHeader) IsValid() bool

type RtpPacket Uses

type RtpPacket struct {
    // contains filtered or unexported fields

func (*RtpPacket) Header Uses

func (p *RtpPacket) Header() (*RtpHeader, error)

Extract the fixed size header from the beginning of this packet

type SdesChunk Uses

type SdesChunk struct {
    Ssrc  uint32
    Items []SdesItem

type SdesItem Uses

type SdesItem struct {
    Type uint8
    Text string

type SdesPacket Uses

type SdesPacket struct {
    Header *RtcpFixedHeader
    Chunks []SdesChunk

type SenderReport Uses

type SenderReport struct {
    Header  *RtcpFixedHeader
    SyncSrc uint32

    // sender info
    NtpTimestamp uint64
    RtpTimestamp uint32
    PacketCount  uint32
    OctetCount   uint32

    ReceptionReports []ReceptionReport

type Session Uses

type Session struct {
    RtpHandler       RtpHandler
    RtcpHandler      RtcpHandler
    CtrlEventHandler CtrlEventHandler
    Transport        Transport

    sync.RWMutex // locks access to state below
    // contains filtered or unexported fields

func NewSession Uses

func NewSession(t Transport) *Session

func (*Session) HandleRtcp Uses

func (s *Session) HandleRtcp(p *RtcpPacket)

a new RTCP packet has arrived from our transport.

any RTCP packet can be compound, which means individual packets can be stacked back to back in the same transport layer packet.

func (*Session) HandleRtp Uses

func (s *Session) HandleRtp(p *RtpPacket)

a new RTP packet has arrived from our transport

func (*Session) Start Uses

func (s *Session) Start() error

type Source Uses

type Source struct {
    // contains filtered or unexported fields

type Transport Uses

type Transport interface {
    ListenAndServe() error

Transport sends and receives data on the wire

type TransportHandler Uses

type TransportHandler interface {

Transport reports new data to its TransportHandler

type TransportUDP Uses

type TransportUDP struct {
    Handler  TransportHandler
    RtpAddr  string
    RtcpAddr string

func NewTransportUDP Uses

func NewTransportUDP(rtp, rtcp string) *TransportUDP

func (*TransportUDP) ListenAndServe Uses

func (t *TransportUDP) ListenAndServe() error

listen for both incoming rtp and rtcp data

func (*TransportUDP) SetHandler Uses

func (t *TransportUDP) SetHandler(h TransportHandler)

Package rtp imports 8 packages (graph) and is imported by 1 packages. Updated 2016-07-23. Refresh now. Tools for package owners.