Documentation ¶
Index ¶
- type HeartbeatConfig
- type ID
- type Participant
- type Pong
- type TrackStoppedMessage
- type Tracker
- func (t *Tracker) AddParticipant(participant *Participant)
- func (t *Tracker) AddPublishedTrack(participantID ID, remoteTrack *webrtc.TrackRemote, ...) error
- func (t *Tracker) ForEachParticipant(fn func(ID, *Participant))
- func (t *Tracker) ForEachPublishedTrackInfo(fn func(ID, webrtc_ext.TrackInfo))
- func (t *Tracker) GetParticipant(participantID ID) *Participant
- func (t *Tracker) HasParticipants() bool
- func (t *Tracker) RemoveParticipant(participantID ID) map[string]bool
- func (t *Tracker) RemovePublishedTrack(id track.TrackID)
- func (t *Tracker) Subscribe(participantID ID, trackID track.TrackID, desiredWidth, desiredHeight int) error
- func (t *Tracker) Unsubscribe(participantID ID, trackID track.TrackID)
- func (t *Tracker) UpdatePublishedTrackMetadata(id track.TrackID, metadata track.TrackMetadata)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeartbeatConfig ¶
type HeartbeatConfig struct { // How often to send pings. Interval time.Duration // After which time to consider the communication stalled. Timeout time.Duration // A closure that is called when ping is to be sent. // Returns `false` if an attempt to send a ping failed. SendPing func() bool // A closure that is called once `Timeout` is reached. OnTimeout func() }
HeartbeatConfig defines the configuration for a heartbeat.
func (*HeartbeatConfig) Start ¶
func (h *HeartbeatConfig) Start() chan<- Pong
Starts a goroutine that will send ping messages (using `SendPing`) every `interval` and wait for a response on `PongChannel` for `Timeout`. If no response is received within `Timeout`, `OnTimeout` is called. The goroutine stops once the channel is closed or upon handling the `OnTimeout`. The returned channel is what the caller should use to inform about the reception of a pong.
type ID ¶
Things that we assume as identifiers for the participants in the call. There could be no 2 participants in the room with identical IDs.
type Participant ¶
type Participant struct { ID ID Peer *peer.Peer[ID] RemoteSessionID id.SessionID Pong chan<- Pong Logger *logrus.Entry Telemetry *telemetry.Telemetry }
Participant represents a participant in the conference.
func (*Participant) AsMatrixRecipient ¶
func (p *Participant) AsMatrixRecipient() signaling.MatrixRecipient
func (*Participant) SendOverDataChannel ¶
func (p *Participant) SendOverDataChannel(ev event.Event) error
type TrackStoppedMessage ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracks participants and their corresponding tracks. These are grouped together as the field in this structure must be kept synchronized.
func NewParticipantTracker ¶
func NewParticipantTracker(conferenceEnded <-chan struct{}) (*Tracker, <-chan TrackStoppedMessage)
func (*Tracker) AddParticipant ¶
func (t *Tracker) AddParticipant(participant *Participant)
Adds a new participant in the list.
func (*Tracker) AddPublishedTrack ¶
func (t *Tracker) AddPublishedTrack( participantID ID, remoteTrack *webrtc.TrackRemote, metadata track.TrackMetadata, ) error
Adds a new track to the list of published tracks, i.e. by calling it we inform the tracker that there is new track that has been published and that we must take into account from now on.
func (*Tracker) ForEachParticipant ¶
func (t *Tracker) ForEachParticipant(fn func(ID, *Participant))
Iterates over participants and calls a closure on each of the participants.
func (*Tracker) ForEachPublishedTrackInfo ¶
func (t *Tracker) ForEachPublishedTrackInfo(fn func(ID, webrtc_ext.TrackInfo))
Iterates over published tracks and calls a closure upon each track info.
func (*Tracker) GetParticipant ¶
func (t *Tracker) GetParticipant(participantID ID) *Participant
Gets an existing participant if any.
func (*Tracker) HasParticipants ¶
func (*Tracker) RemoveParticipant ¶
Removes the participant from the conference closing all its tracks. Returns a set of **streams** that are to be removed. The return type is odd since Go does not natively support sets, so we emulate it with a map.
func (*Tracker) RemovePublishedTrack ¶
Informs the tracker that one of the previously published tracks is gone.
func (*Tracker) Subscribe ¶
func (t *Tracker) Subscribe( participantID ID, trackID track.TrackID, desiredWidth, desiredHeight int, ) error
Subscribes a given participant to the track.
func (*Tracker) Unsubscribe ¶
Unsubscribes a given `participantID` from the track.
func (*Tracker) UpdatePublishedTrackMetadata ¶
func (t *Tracker) UpdatePublishedTrackMetadata(id track.TrackID, metadata track.TrackMetadata)
Updates metadata associated with a given track.