participant

package
v0.0.0-...-3f3c78e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

type ID struct {
	UserID   id.UserID
	DeviceID id.DeviceID
	CallID   string
}

Things that we assume as identifiers for the participants in the call. There could be no 2 participants in the room with identical IDs.

func (ID) String

func (id ID) String() string

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 Pong

type Pong struct{}

type TrackStoppedMessage

type TrackStoppedMessage struct {
	TrackID track.TrackID
	OwnerID ID
}

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 (t *Tracker) HasParticipants() bool

func (*Tracker) RemoveParticipant

func (t *Tracker) RemoveParticipant(participantID ID) map[string]bool

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

func (t *Tracker) RemovePublishedTrack(id track.TrackID)

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

func (t *Tracker) Unsubscribe(participantID ID, trackID track.TrackID)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL