Documentation
¶
Index ¶
- Constants
- func CodecTransformMap() map[string][]uint8
- 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 IsVideo(pt uint8) bool
- func KvOK(m map[string]interface{}, k, v string) bool
- func PaylaodTransformMap() map[uint8][]uint8
- type RTCOptions
- 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) SetShutdownChan(ch chan string)
- 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) AddSendTrack(ssrc uint32, pt uint8, streamID string, trackID string) (*webrtc.Track, error)
- func (w *WebRTCTransport) Answer(offer webrtc.SessionDescription, options RTCOptions) (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) SetShutdownChan(ch chan string)
- 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" FireFoxH264Fmtp97 = "profile-level-id=42e01f;level-asymmetry-allowed=1" )
Variables ¶
This section is empty.
Functions ¶
func CodecTransformMap ¶ added in v0.4.1
func GetUpperString ¶
GetUpperString get upper string by key
func InitWebRTC ¶
InitWebRTC init WebRTCTransport setting
func PaylaodTransformMap ¶ added in v0.4.1
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) 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) SetShutdownChan ¶ added in v0.3.10
func (r *RTPTransport) SetShutdownChan(ch chan string)
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) 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) SetShutdownChan ¶ added in v0.3.10
func (w *WebRTCTransport) SetShutdownChan(ch chan string)
SetShutdownChan sets notify channel on transport shutdown
func (*WebRTCTransport) WriteErrReset ¶
func (w *WebRTCTransport) WriteErrReset()
WriteErrReset reset write error
func (*WebRTCTransport) WriteErrTotal ¶
func (w *WebRTCTransport) WriteErrTotal() int
WriteErrTotal return write error