Documentation
¶
Index ¶
- Constants
- func GetInt(m map[string]interface{}, k string) (int, error)
- func GetUpperString(m map[string]interface{}, k string) string
- func InitWebRTC(iceServers []webrtc.ICEServer, icePortStart, icePortEnd uint16) error
- func KvOK(m map[string]interface{}, k, v string) bool
- type RTPTransport
- func (r *RTPTransport) Close()
- func (r *RTPTransport) GetBandwidth() int
- func (r *RTPTransport) GetRTCPChan() chan rtcp.Packet
- func (r *RTPTransport) ID() string
- func (r *RTPTransport) ReadRTP() (*rtp.Packet, error)
- func (r *RTPTransport) RemoteAddr() net.Addr
- func (r *RTPTransport) SSRCPT() map[uint32]uint8
- func (r *RTPTransport) Type() int
- func (r *RTPTransport) WriteErrReset()
- func (r *RTPTransport) WriteErrTotal() int
- func (r *RTPTransport) WriteRTCP(pkt rtcp.Packet) error
- func (r *RTPTransport) WriteRTP(rtp *rtp.Packet) error
- func (r *RTPTransport) WriteRawRTCP(data []byte) (int, error)
- type Transport
- type WebRTCTransport
- func (w *WebRTCTransport) AddCandidate(candidate string) error
- func (w *WebRTCTransport) AddTrack(ssrc uint32, pt uint8, streamID string, trackID string) (*webrtc.Track, error)
- func (w *WebRTCTransport) Answer(offer webrtc.SessionDescription, options map[string]interface{}) (webrtc.SessionDescription, error)
- func (w *WebRTCTransport) Close()
- func (w *WebRTCTransport) GetBandwidth() int
- func (w *WebRTCTransport) GetCandidateChan() chan *webrtc.ICECandidate
- func (w *WebRTCTransport) GetInTracks() map[uint32]*webrtc.Track
- func (w *WebRTCTransport) GetOutTracks() map[uint32]*webrtc.Track
- func (w *WebRTCTransport) GetRTCPChan() chan rtcp.Packet
- func (w *WebRTCTransport) ID() string
- func (w *WebRTCTransport) Offer() (webrtc.SessionDescription, error)
- func (w *WebRTCTransport) ReadRTP() (*rtp.Packet, error)
- func (w *WebRTCTransport) SetRemoteSDP(sdp webrtc.SessionDescription) error
- func (w *WebRTCTransport) Type() int
- func (w *WebRTCTransport) WriteErrReset()
- func (w *WebRTCTransport) WriteErrTotal() int
- func (w *WebRTCTransport) WriteRTCP(pkt rtcp.Packet) error
- func (w *WebRTCTransport) WriteRTP(pkt *rtp.Packet) error
Constants ¶
const ( TypeWebRTCTransport = iota TypeRTPTransport TypeUnkown = -1 )
type of transport
const (
IOSH264Fmtp = "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"
)
Variables ¶
This section is empty.
Functions ¶
func GetUpperString ¶
GetUpperString get upper string by key
func InitWebRTC ¶
InitWebRTC init WebRTCTransport setting
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) 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) 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) 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) 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) 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) WriteErrReset ¶
func (w *WebRTCTransport) WriteErrReset()
WriteErrReset reset write error
func (*WebRTCTransport) WriteErrTotal ¶
func (w *WebRTCTransport) WriteErrTotal() int
WriteErrTotal return write error