Documentation ¶
Index ¶
- Variables
- type BitrateEstimator
- func (r *BitrateEstimator) Avg() float32
- func (r *BitrateEstimator) Empty() bool
- func (r *BitrateEstimator) Feed(clientID identifiers.ClientID, estimatedBitrate float32)
- func (r *BitrateEstimator) Max() float32
- func (r *BitrateEstimator) Min() float32
- func (r *BitrateEstimator) RemoveClientBitrate(clientID identifiers.ClientID)
- type PubSub
- func (p *PubSub) BitrateEstimator(trackID identifiers.TrackID) (*BitrateEstimator, bool)
- func (p *PubSub) Close()
- func (p *PubSub) Pub(pubClientID identifiers.ClientID, reader Reader)
- func (p *PubSub) Sub(pubClientID identifiers.ClientID, trackID identifiers.TrackID, ...) (transport.RTCPReader, error)
- func (p *PubSub) SubscribeToEvents(clientID identifiers.ClientID) (<-chan PubTrackEvent, error)
- func (p *PubSub) Subscribers(pubClientID identifiers.ClientID, trackID identifiers.TrackID) []identifiers.ClientID
- func (p *PubSub) Terminate(clientID identifiers.ClientID)
- func (p *PubSub) TrackPropsByTrackID(trackID identifiers.TrackID) (TrackProps, bool)
- func (p *PubSub) Tracks() []PubTrack
- func (p *PubSub) Unpub(pubClientID identifiers.ClientID, trackID identifiers.TrackID)
- func (p *PubSub) Unsub(pubClientID identifiers.ClientID, trackID identifiers.TrackID, ...) error
- func (p *PubSub) UnsubscribeFromEvents(clientID identifiers.ClientID) error
- type PubTrack
- type PubTrackEvent
- type Reader
- type TrackProps
- type TrackReader
- func (t *TrackReader) RID() string
- func (t *TrackReader) SSRC() webrtc.SSRC
- func (t *TrackReader) Sub(subClientID identifiers.ClientID, trackLocal transport.TrackLocal) error
- func (t *TrackReader) Subs() []identifiers.ClientID
- func (t *TrackReader) Track() transport.Track
- func (t *TrackReader) Unsub(subClientID identifiers.ClientID) error
- type Transport
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BitrateEstimator ¶
type BitrateEstimator struct {
// contains filtered or unexported fields
}
BitrateEstimator estimates minimum, maximum and average bitrate. It is not safe for concurrent use.
func NewBitrateEstimator ¶
func NewBitrateEstimator() *BitrateEstimator
NewBitrateEstimator creates a new instance of BitrateEstimator.
func (*BitrateEstimator) Avg ¶
func (r *BitrateEstimator) Avg() float32
Avg returns the average bitrate.
func (*BitrateEstimator) Empty ¶
func (r *BitrateEstimator) Empty() bool
Empty returns true when there are no estimations, false otherwise.
func (*BitrateEstimator) Feed ¶
func (r *BitrateEstimator) Feed(clientID identifiers.ClientID, estimatedBitrate float32)
Feed records the estimated bitrate for client.
func (*BitrateEstimator) Max ¶
func (r *BitrateEstimator) Max() float32
Max returns thet maximum bitrate.
func (*BitrateEstimator) Min ¶
func (r *BitrateEstimator) Min() float32
Min returns the minimal bitrate.
func (*BitrateEstimator) RemoveClientBitrate ¶
func (r *BitrateEstimator) RemoveClientBitrate(clientID identifiers.ClientID)
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub keeps a record of all published tracks and subscriptions to them. The user of this implementation must implement locking if it will be used by multiple goroutines.
func (*PubSub) BitrateEstimator ¶
func (p *PubSub) BitrateEstimator(trackID identifiers.TrackID) (*BitrateEstimator, bool)
BitrateEstimator returns the instance of BitrateEstimatro for a track.
func (*PubSub) Close ¶
func (p *PubSub) Close()
Close closes the subscription channel. The caller must ensure that no other methods are called after close has been called.
func (*PubSub) Pub ¶
func (p *PubSub) Pub(pubClientID identifiers.ClientID, reader Reader)
Pub publishes a track.
func (*PubSub) Sub ¶
func (p *PubSub) Sub(pubClientID identifiers.ClientID, trackID identifiers.TrackID, transport Transport) (transport.RTCPReader, error)
Sub subscribes to a published track.
func (*PubSub) SubscribeToEvents ¶
func (p *PubSub) SubscribeToEvents(clientID identifiers.ClientID) (<-chan PubTrackEvent, error)
SubscribeToEvents creates a new subscription to track events.
func (*PubSub) Subscribers ¶
func (p *PubSub) Subscribers(pubClientID identifiers.ClientID, trackID identifiers.TrackID) []identifiers.ClientID
Subscribers returns all subscribed subClientIDs to a specific clientID/track pair.
func (*PubSub) Terminate ¶
func (p *PubSub) Terminate(clientID identifiers.ClientID)
Terminate unpublishes al tracks from from a particular client, as well as removes any subscriptions it has.
func (*PubSub) TrackPropsByTrackID ¶
func (p *PubSub) TrackPropsByTrackID(trackID identifiers.TrackID) (TrackProps, bool)
ClientIDByTrackID returns the clientID from a published unique trackID.
func (*PubSub) Unpub ¶
func (p *PubSub) Unpub(pubClientID identifiers.ClientID, trackID identifiers.TrackID)
Unpub unpublishes a track as well as unsubs all subscribers.
func (*PubSub) Unsub ¶
func (p *PubSub) Unsub(pubClientID identifiers.ClientID, trackID identifiers.TrackID, subClientID identifiers.ClientID) error
Unsub unsubscribes from a published track.
func (*PubSub) UnsubscribeFromEvents ¶
func (p *PubSub) UnsubscribeFromEvents(clientID identifiers.ClientID) error
UnsubscribeFromEvents removes an existing subscription from track events.
type PubTrack ¶
type PubTrack struct { // ClientID is the remote client ID that we got the track from. In most // cases, when a track was received from another WebRTCTransport connected to // the same server, it will be the same as PeerID. If the track was received // from another server (using servertransport), it will be the ID of the // remote server. ClientID identifiers.ClientID `json:"clientId"` // PeerID is the ID of the remote peer that published the track. In other // words it's the ID of the origin of this track. PeerID identifiers.PeerID `json:"peerId"` // TrackID contains unique track identifier, consisting of track ID and // StreamID. TrackID identifiers.TrackID `json:"trackId"` // Kind is the track kind (audio or video). Kind transport.TrackKind `json:"kind"` }
PubTrack will be emitted as an event after a track is published or unpublished.
type PubTrackEvent ¶
type PubTrackEvent struct { PubTrack PubTrack `json:"pubTrack"` Type transport.TrackEventType `json:"type"` }
type Reader ¶
type Reader interface { Track() transport.Track Sub(subClientID identifiers.ClientID, trackLocal transport.TrackLocal) error Unsub(subClientID identifiers.ClientID) error Subs() []identifiers.ClientID SSRC() webrtc.SSRC RID() string }
type TrackProps ¶
type TrackProps struct { ClientID identifiers.ClientID SSRC webrtc.SSRC RID string }
type TrackReader ¶
type TrackReader struct {
// contains filtered or unexported fields
}
func NewTrackReader ¶
func NewTrackReader(trackRemote transport.TrackRemote, onClose func()) *TrackReader
func (*TrackReader) RID ¶
func (t *TrackReader) RID() string
func (*TrackReader) SSRC ¶
func (t *TrackReader) SSRC() webrtc.SSRC
func (*TrackReader) Sub ¶
func (t *TrackReader) Sub(subClientID identifiers.ClientID, trackLocal transport.TrackLocal) error
func (*TrackReader) Subs ¶
func (t *TrackReader) Subs() []identifiers.ClientID
func (*TrackReader) Track ¶
func (t *TrackReader) Track() transport.Track
func (*TrackReader) Unsub ¶
func (t *TrackReader) Unsub(subClientID identifiers.ClientID) error
type Transport ¶
type Transport interface { ClientID() identifiers.ClientID AddTrack(track transport.Track) (transport.TrackLocal, transport.RTCPReader, error) RemoveTrack(trackID identifiers.TrackID) error }
Transport only defines a subset of methods from transport.Transport to make mocking in testing easier.