transport

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 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"
	FireFoxH264Fmtp97 = "profile-level-id=42e01f;level-asymmetry-allowed=1"
)

Variables

This section is empty.

Functions

func CodecTransformMap added in v0.4.1

func CodecTransformMap() map[string][]uint8

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(iceServers []webrtc.ICEServer, icePortStart, icePortEnd uint16) error

InitWebRTC init WebRTCTransport setting

func IsVideo added in v0.4.2

func IsVideo(pt uint8) bool

IsVideo check playload is video, now support chrome and firefox

func KvOK

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

KvOK check flag and value is "true"

func PaylaodTransformMap added in v0.4.1

func PaylaodTransformMap() map[uint8][]uint8

Types

type RTCOptions added in v0.4.1

type RTCOptions struct {
	Publish     bool
	Subscribe   bool
	DataChannel bool
	TransportCC bool
	Codec       string
	Codecs      []uint8
	Bandwidth   int
	Ssrcpt      map[uint32]uint8
}

RTCOptions options to open new transport

type RTPTransport

type RTPTransport struct {
	IDChan chan string
	// 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) SetShutdownChan added in v0.3.10

func (r *RTPTransport) SetShutdownChan(ch chan string)

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
	SetShutdownChan(chan string)
}

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 RTCOptions) *WebRTCTransport

NewWebRTCTransport create a WebRTCTransport

func (*WebRTCTransport) AddCandidate

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

AddCandidate add candidate to pc

func (*WebRTCTransport) AddSendTrack added in v0.3.5

func (w *WebRTCTransport) AddSendTrack(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 RTCOptions) (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) SetShutdownChan added in v0.3.10

func (w *WebRTCTransport) SetShutdownChan(ch chan string)

SetShutdownChan sets notify channel on transport shutdown

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