Documentation ¶
Index ¶
- Constants
- Variables
- func MatchRTCP(buf []byte) bool
- func MatchRTP(buf []byte) bool
- func MatchRTPOrRTCP(b []byte) bool
- func RandUint32() uint32
- type BufferFactory
- type DataTransport
- type DataTransportParams
- type MatchFunc
- type MediaStream
- func (t *MediaStream) Close() error
- func (t *MediaStream) GetOrCreateBuffer(packetType packetio.BufferPacketType, ssrc webrtc.SSRC) *packetio.Buffer
- func (t *MediaStream) RemoveBuffer(packetType packetio.BufferPacketType, ssrc webrtc.SSRC)
- func (t *MediaStream) WriteRTCP(p []rtcp.Packet) error
- func (t *MediaStream) Writer() io.Writer
- type MediaStreamParams
- type MetadataTransport
- func (t *MetadataTransport) AddTrack(track transport.Track) (transport.TrackLocal, transport.RTCPReader, error)
- func (t *MetadataTransport) Close() error
- func (t *MetadataTransport) LocalTracks() []transport.TrackWithMID
- func (t *MetadataTransport) RemoteTracksChannel() <-chan transport.TrackRemoteWithRTCPReader
- func (t *MetadataTransport) RemoveTrack(trackID identifiers.TrackID) error
- type MetadataTransportParams
- type Params
- type ServerTrack
- type Transport
Constants ¶
const ( // TODO reduce this. ReceiveMTU uint16 = 8192 )
Variables ¶
var ( ErrNoData = errors.Errorf("cannot handle empty buffer") ErrUnknownPacket = errors.Errorf("unknown packet") )
Functions ¶
func MatchRTPOrRTCP ¶
MatchRTPOrRTCP is a MatchFunc that accepts packets with the first byte in [128..191] as defied in RFC7983
Types ¶
type BufferFactory ¶
type BufferFactory func(packetType packetio.BufferPacketType, ssrc uint32) *packetio.Buffer
type DataTransport ¶
type DataTransport struct {
// contains filtered or unexported fields
}
func NewDataTransport ¶
func NewDataTransport(params DataTransportParams) *DataTransport
func (*DataTransport) Close ¶
func (t *DataTransport) Close() error
func (*DataTransport) MessagesChannel ¶
func (t *DataTransport) MessagesChannel() <-chan webrtc.DataChannelMessage
func (*DataTransport) Send ¶
func (t *DataTransport) Send(message webrtc.DataChannelMessage) <-chan error
func (*DataTransport) SendText ¶
func (t *DataTransport) SendText(message string) error
type DataTransportParams ¶
type DataTransportParams struct { Log logger.Logger Conn io.ReadWriteCloser }
type MatchFunc ¶
MatchFunc allows custom logic for mapping packets to an Endpoint
func MatchRange ¶
MatchRange is a MatchFunc that accepts packets with the first byte in [lower..upper]
type MediaStream ¶
type MediaStream struct {
// contains filtered or unexported fields
}
func NewMediaStream ¶
func NewMediaStream(params MediaStreamParams) *MediaStream
func (*MediaStream) Close ¶
func (t *MediaStream) Close() error
func (*MediaStream) GetOrCreateBuffer ¶
func (t *MediaStream) GetOrCreateBuffer( packetType packetio.BufferPacketType, ssrc webrtc.SSRC, ) *packetio.Buffer
func (*MediaStream) RemoveBuffer ¶
func (t *MediaStream) RemoveBuffer( packetType packetio.BufferPacketType, ssrc webrtc.SSRC, )
func (*MediaStream) Writer ¶
func (t *MediaStream) Writer() io.Writer
type MediaStreamParams ¶
type MediaStreamParams struct { Log logger.Logger Conn io.ReadWriteCloser // BufferFactory is optional. BufferFactory BufferFactory // Interceptor is optional. Interceptor interceptor.Interceptor }
type MetadataTransport ¶
type MetadataTransport struct {
// contains filtered or unexported fields
}
func NewMetadataTransport ¶
func NewMetadataTransport(params MetadataTransportParams) *MetadataTransport
func (*MetadataTransport) AddTrack ¶
func (t *MetadataTransport) AddTrack(track transport.Track) (transport.TrackLocal, transport.RTCPReader, error)
func (*MetadataTransport) Close ¶
func (t *MetadataTransport) Close() error
func (*MetadataTransport) LocalTracks ¶
func (t *MetadataTransport) LocalTracks() []transport.TrackWithMID
func (*MetadataTransport) RemoteTracksChannel ¶
func (t *MetadataTransport) RemoteTracksChannel() <-chan transport.TrackRemoteWithRTCPReader
func (*MetadataTransport) RemoveTrack ¶
func (t *MetadataTransport) RemoveTrack(trackID identifiers.TrackID) error
type MetadataTransportParams ¶
type MetadataTransportParams struct { Log logger.Logger Conn io.ReadWriteCloser MediaStream *MediaStream ClientID identifiers.ClientID Interceptor interceptor.Interceptor CodecRegistry *codecs.Registry }
type Params ¶
type Params struct { Log logger.Logger MediaConn io.ReadWriteCloser DataConn io.ReadWriteCloser MetadataConn io.ReadWriteCloser CodecRegistry *codecs.Registry InterceptorRegistry *interceptor.Registry }
type ServerTrack ¶
type ServerTrack struct { transport.SimpleTrack // contains filtered or unexported fields }
func (*ServerTrack) Sub ¶
func (s *ServerTrack) Sub() error
func (*ServerTrack) Unsub ¶
func (s *ServerTrack) Unsub() error
type Transport ¶
type Transport struct { *MetadataTransport *MediaStream *DataTransport // contains filtered or unexported fields }
Transport is used for server to server communication. The underlying transport protocol is SCTP, and the following data is transferred:
- Ordered Metadata stream on ID 0. This stream will contain track, as well as application level metadata.
- Unordered Media (RTP and RTCP) streams will use odd numbered stream IDs, starting from 1.
- Ordered DataChannel messages on even stream IDs, starting from 2.
A single Media stream transports all RTP and RTCP packets for a single room, and a single DataChannel stream will transport all datachannel messages for a single room.
A single SCTP connection can be used to transport packets from multiple rooms. Each room will take exactly one Media stream and one DataChannel stream. Following the rules above, the stream IDs for a specific room will always be N and N+1, but the metadata for all rooms will be sent on stream 0.
Track metadata is JSON encoded.
TODO subject to change
func (*Transport) ClientID ¶
func (t *Transport) ClientID() identifiers.ClientID