transport

package
v0.0.0-...-64b69da Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeWebRTCTransport = iota
	TypeRTPTransport

	TypeUnkown = -1
)

type of transport

View Source
const (
	IOSH264Fmtp = "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"
)

Variables

This section is empty.

Functions

func GetInt

func GetInt(m map[string]interface{}, k string) (int, error)

GetInt get uint64 value by key

func GetUpperString

func GetUpperString(m map[string]interface{}, k string) string

GetUpperString get upper string by key

func InitWebRTC

func InitWebRTC(ices []string, icePortStart, icePortEnd uint16) error

InitWebRTC init WebRTCTransport setting

func KvOK

func KvOK(m map[string]interface{}, k, v string) bool

KvOK check flag and value is "true"

Types

type RTPTransport

type RTPTransport struct {
	// contains filtered or unexported fields
}

RTPTransport ..

func NewOutRTPTransport

func NewOutRTPTransport(id, addr string) *RTPTransport

NewOutRTPTransport new a outgoing RTPTransport

func NewOutRTPTransportWithKCP

func NewOutRTPTransportWithKCP(id, addr string, kcpKey, kcpSalt string) *RTPTransport

NewOutRTPTransportWithKCP new a outgoing RTPTransport by kcp

func NewRTPTransport

func NewRTPTransport(conn net.Conn) *RTPTransport

NewRTPTransport create a RTPTransport by net.Conn

func (*RTPTransport) Close

func (r *RTPTransport) Close()

Close release all

func (*RTPTransport) GetBandwidth

func (r *RTPTransport) GetBandwidth() int

GetBandwidth get bindwitdh setting

func (*RTPTransport) GetRTCPChan

func (r *RTPTransport) GetRTCPChan() chan rtcp.Packet

GetRTCPChan return a rtcp channel

func (*RTPTransport) ID

func (r *RTPTransport) ID() string

ID return id

func (*RTPTransport) ReadRTP

func (r *RTPTransport) ReadRTP() (*rtp.Packet, error)

ReadRTP read rtp from transport

func (*RTPTransport) RemoteAddr

func (r *RTPTransport) RemoteAddr() net.Addr

RemoteAddr return remote addr

func (*RTPTransport) SSRCPT

func (r *RTPTransport) SSRCPT() map[uint32]uint8

SSRCPT playload type and ssrc

func (*RTPTransport) Type

func (r *RTPTransport) Type() int

Type return type of transport

func (*RTPTransport) WriteErrReset

func (r *RTPTransport) WriteErrReset()

WriteErrReset reset write error

func (*RTPTransport) WriteErrTotal

func (r *RTPTransport) WriteErrTotal() int

WriteErrTotal return write error

func (*RTPTransport) WriteRTCP

func (r *RTPTransport) WriteRTCP(pkt rtcp.Packet) error

WriteRTCP write rtcp

func (*RTPTransport) WriteRTP

func (r *RTPTransport) WriteRTP(rtp *rtp.Packet) error

WriteRTP send rtp packet

func (*RTPTransport) WriteRawRTCP

func (r *RTPTransport) WriteRawRTCP(data []byte) (int, error)

WriteRawRTCP write rtcp data

type Transport

type Transport interface {
	ID() string
	Type() int
	ReadRTP() (*rtp.Packet, error)
	WriteRTP(*rtp.Packet) error
	WriteRTCP(rtcp.Packet) error
	GetRTCPChan() chan rtcp.Packet
	Close()
	WriteErrTotal() int
	WriteErrReset()
	GetBandwidth() int
}

Transport is a interface

type WebRTCTransport

type WebRTCTransport struct {
	// contains filtered or unexported fields
}

WebRTCTransport contains pc incoming and outgoing tracks

func NewWebRTCTransport

func NewWebRTCTransport(id string, options map[string]interface{}) *WebRTCTransport

NewWebRTCTransport create a WebRTCTransport options:

"video" = webrtc.H264[default] webrtc.VP8  webrtc.VP9
"audio" = webrtc.Opus[default] webrtc.PCMA webrtc.PCMU webrtc.G722
"transport-cc"  = "true" or "false"[default]
"data-channel"  = "true" or "false"[default]

func (*WebRTCTransport) AddCandidate

func (w *WebRTCTransport) AddCandidate(candidate string) error

AddCandidate add candidate to pc

func (*WebRTCTransport) AddTrack

func (w *WebRTCTransport) AddTrack(ssrc uint32, pt uint8, streamID string, trackID string) (*webrtc.Track, error)

AddTrack add track to pc

func (*WebRTCTransport) Answer

func (w *WebRTCTransport) Answer(offer webrtc.SessionDescription, options map[string]interface{}) (webrtc.SessionDescription, error)

Answer answer to pub or sub

func (*WebRTCTransport) Close

func (w *WebRTCTransport) Close()

Close all

func (*WebRTCTransport) GetBandwidth

func (w *WebRTCTransport) GetBandwidth() int

GetBandwidth return bandwidth

func (*WebRTCTransport) GetCandidateChan

func (w *WebRTCTransport) GetCandidateChan() chan *webrtc.ICECandidate

GetCandidateChan return a candidate channel

func (*WebRTCTransport) GetInTracks

func (w *WebRTCTransport) GetInTracks() map[uint32]*webrtc.Track

GetInTracks return incoming tracks

func (*WebRTCTransport) GetOutTracks

func (w *WebRTCTransport) GetOutTracks() map[uint32]*webrtc.Track

GetOutTracks return incoming tracks

func (*WebRTCTransport) GetRTCPChan

func (w *WebRTCTransport) GetRTCPChan() chan rtcp.Packet

GetRTCPChan return a rtcp channel

func (*WebRTCTransport) ID

func (w *WebRTCTransport) ID() string

ID return id

func (*WebRTCTransport) Offer

func (w *WebRTCTransport) Offer() (webrtc.SessionDescription, error)

Offer return a offer

func (*WebRTCTransport) ReadRTP

func (w *WebRTCTransport) ReadRTP() (*rtp.Packet, error)

ReadRTP read rtp packet

func (*WebRTCTransport) SetRemoteSDP

func (w *WebRTCTransport) SetRemoteSDP(sdp webrtc.SessionDescription) error

SetRemoteSDP after Offer()

func (*WebRTCTransport) Type

func (w *WebRTCTransport) Type() int

Type return type of transport

func (*WebRTCTransport) WriteErrReset

func (w *WebRTCTransport) WriteErrReset()

WriteErrReset reset write error

func (*WebRTCTransport) WriteErrTotal

func (w *WebRTCTransport) WriteErrTotal() int

WriteErrTotal return write error

func (*WebRTCTransport) WriteRTCP

func (w *WebRTCTransport) WriteRTCP(pkt rtcp.Packet) error

WriteRTCP write rtcp packet to pc

func (*WebRTCTransport) WriteRTP

func (w *WebRTCTransport) WriteRTP(pkt *rtp.Packet) error

WriteRTP send rtp packet to outgoing tracks

Jump to

Keyboard shortcuts

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