rtc

package
v1.9.12 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 83 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingIntervalSeconds = 5
	PingTimeoutSeconds  = 15
)
View Source
const (
	LossyDataChannel    = "_lossy"
	ReliableDataChannel = "_reliable"
)
View Source
const (
	AudioLevelQuantization = 8 // ideally power of 2 to minimize float decimal

)

Variables

View Source
var (
	ErrRoomClosed               = errors.New("room has already closed")
	ErrParticipantSessionClosed = errors.New("participant session is already closed")
	ErrPermissionDenied         = errors.New("no permissions to access the room")
	ErrMaxParticipantsExceeded  = errors.New("room has exceeded its max participants")
	ErrLimitExceeded            = errors.New("node has exceeded its configured limit")
	ErrAlreadyJoined            = errors.New("a participant with the same identity is already in the room")
	ErrDataChannelUnavailable   = errors.New("data channel is not available")
	ErrDataChannelBufferFull    = errors.New("data channel buffer is full")
	ErrTransportFailure         = errors.New("transport failure")
	ErrEmptyIdentity            = errors.New("participant identity cannot be empty")
	ErrEmptyParticipantID       = errors.New("participant ID cannot be empty")
	ErrMissingGrants            = errors.New("VideoGrant is missing")
	ErrInternalError            = errors.New("internal error")

	// Track subscription related
	ErrNoTrackPermission         = errors.New("participant is not allowed to subscribe to this track")
	ErrNoSubscribePermission     = errors.New("participant is not given permission to subscribe to tracks")
	ErrTrackNotFound             = errors.New("track cannot be found")
	ErrTrackNotBound             = errors.New("track not bound")
	ErrSubscriptionLimitExceeded = errors.New("participant has exceeded its subscription limit")

	ErrNoSubscribeMetricsPermission = errors.New("participant is not given permission to subscribe to metrics")
)
View Source
var (
	OpusCodecParameters = webrtc.RTPCodecParameters{
		RTPCodecCapability: webrtc.RTPCodecCapability{
			MimeType:    mime.MimeTypeOpus.String(),
			ClockRate:   48000,
			Channels:    2,
			SDPFmtpLine: "minptime=10;useinbandfec=1",
		},
		PayloadType: 111,
	}

	RedCodecParameters = webrtc.RTPCodecParameters{
		RTPCodecCapability: webrtc.RTPCodecCapability{
			MimeType:    mime.MimeTypeRED.String(),
			ClockRate:   48000,
			Channels:    2,
			SDPFmtpLine: "111/111",
		},
		PayloadType: 63,
	}

	PCMUCodecParameters = webrtc.RTPCodecParameters{
		RTPCodecCapability: webrtc.RTPCodecCapability{
			MimeType:  mime.MimeTypePCMU.String(),
			ClockRate: 8000,
		},
		PayloadType: 0,
	}

	PCMACodecParameters = webrtc.RTPCodecParameters{
		RTPCodecCapability: webrtc.RTPCodecCapability{
			MimeType:  mime.MimeTypePCMA.String(),
			ClockRate: 8000,
		},
		PayloadType: 8,
	}
)
View Source
var (
	ErrNotOpen    = errors.New("track is not open")
	ErrNoReceiver = errors.New("cannot subscribe without a receiver in place")
)
View Source
var (
	ErrNoICETransport                    = errors.New("no ICE transport")
	ErrIceRestartWithoutLocalSDP         = errors.New("ICE restart without local SDP settled")
	ErrIceRestartOnClosedPeerConnection  = errors.New("ICE restart on closed peer connection")
	ErrNoTransceiver                     = errors.New("no transceiver")
	ErrNoSender                          = errors.New("no sender")
	ErrMidNotFound                       = errors.New("mid not found")
	ErrNotSynchronousLocalCandidatesMode = errors.New("not using synchronous local candidates mode")
	ErrNoRemoteDescription               = errors.New("no remote description")
	ErrNoLocalDescription                = errors.New("no local description")
	ErrInvalidSDPFragment                = errors.New("invalid sdp fragment")
	ErrNoBundleMid                       = errors.New("could not get bundle mid")
	ErrMidMismatch                       = errors.New("media mid does not match bundle mid")
	ErrICECredentialMismatch             = errors.New("ice credential mismatch")
)
View Source
var (
	ErrJobShutdownTimeout = psrpc.NewErrorf(psrpc.DeadlineExceeded, "timed out waiting for agent job to shutdown")
)
View Source
var (
	ErrMoveOldClientVersion = errors.New("participant client version does not support moving")
)
View Source
var (
	ErrSubscriptionPermissionNeedsId = errors.New("either participant identity or SID needed")
)

Functions

func BroadcastDataMessageForRoom

func BroadcastDataMessageForRoom(r types.Room, source types.LocalParticipant, data []byte, logger logger.Logger)

func BroadcastDataPacketForRoom

func BroadcastDataPacketForRoom(
	r types.Room,
	source types.LocalParticipant,
	kind livekit.DataPacket_Kind,
	dp *livekit.DataPacket,
	logger logger.Logger,
)

func BroadcastMetricsForRoom

func BroadcastMetricsForRoom(r types.Room, source types.Participant, dp *livekit.DataPacket, logger logger.Logger)

func ChunkProtoBatch

func ChunkProtoBatch[T proto.Message](batch []T, target int) [][]T

func CompareParticipant

func CompareParticipant(pi1 *livekit.ParticipantInfo, pi2 *livekit.ParticipantInfo) int

func GetOtherParticipantInfo

func GetOtherParticipantInfo(
	lp types.LocalParticipant,
	isMigratingIn bool,
	allParticipants []types.Participant,
	skipSubscriberBroadcast bool,
) []*livekit.ParticipantInfo

GetOtherParticipantInfo returns ParticipantInfo for everyone in the room except for the participant identified by lp.Identity()

func IsCloseNotifySkippable

func IsCloseNotifySkippable(closeReason types.ParticipantCloseReason) bool

func IsCodecEnabled

func IsCodecEnabled(codecs []*livekit.Codec, cap webrtc.RTPCodecCapability) bool

func IsEOF

func IsEOF(err error) bool

func IsParticipantExemptFromTrackPermissionsRestrictions

func IsParticipantExemptFromTrackPermissionsRestrictions(p types.LocalParticipant) bool

func IsRedEnabled

func IsRedEnabled(ti *livekit.TrackInfo) bool

func LoggerWithCodecMime

func LoggerWithCodecMime(l logger.Logger, mimeType mime.MimeType) logger.Logger

func LoggerWithPCTarget

func LoggerWithPCTarget(l logger.Logger, target livekit.SignalTarget) logger.Logger

func LoggerWithParticipant

func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity, sid livekit.ParticipantID, isRemote bool) logger.Logger

logger helpers

func LoggerWithRoom

func LoggerWithRoom(l logger.Logger, name livekit.RoomName, roomID livekit.RoomID) logger.Logger

func LoggerWithTrack

func LoggerWithTrack(l logger.Logger, trackID livekit.TrackID, isRelayed bool) logger.Logger

func MaybeTruncateIP

func MaybeTruncateIP(addr string) string

func NewMockParticipant

func NewMockParticipant(identity livekit.ParticipantIdentity, protocol types.ProtocolVersion, hidden bool, publisher bool) *typesfakes.FakeLocalParticipant

func NewMockTrack

func NewMockTrack(kind livekit.TrackType, name string) *typesfakes.FakeMediaTrack

func PackDataTrackLabel

func PackDataTrackLabel(participantID livekit.ParticipantID, trackID livekit.TrackID, label string) string

func PackStreamID

func PackStreamID(participantID livekit.ParticipantID, trackID livekit.TrackID) string

func PackSyncStreamID

func PackSyncStreamID(participantID livekit.ParticipantID, stream string) string

func Recover

func Recover(l logger.Logger) any

func SendParticipantUpdates

func SendParticipantUpdates(updates []*ParticipantUpdate, participants []types.LocalParticipant, batchTargetSize int)

func StartTrackEgress

func StartTrackEgress(
	ctx context.Context,
	launcher EgressLauncher,
	ts telemetry.TelemetryService,
	opts *livekit.AutoTrackEgress,
	track types.MediaTrack,
	roomName livekit.RoomName,
	roomID livekit.RoomID,
) error

func StreamFromTrackSource

func StreamFromTrackSource(source livekit.TrackSource) string

func ToProtoTrackKind

func ToProtoTrackKind(kind webrtc.RTPCodecType) livekit.TrackType

func UnpackDataTrackLabel

func UnpackDataTrackLabel(packed string) (participantID livekit.ParticipantID, trackID livekit.TrackID, label string)

func UnpackStreamID

func UnpackStreamID(packed string) (participantID livekit.ParticipantID, trackID livekit.TrackID)

Types

type AgentStore

type AgentStore interface {
	StoreAgentDispatch(ctx context.Context, dispatch *livekit.AgentDispatch) error
	DeleteAgentDispatch(ctx context.Context, dispatch *livekit.AgentDispatch) error
	ListAgentDispatches(ctx context.Context, roomName livekit.RoomName) ([]*livekit.AgentDispatch, error)

	StoreAgentJob(ctx context.Context, job *livekit.Job) error
	DeleteAgentJob(ctx context.Context, job *livekit.Job) error
}

Duplicate the service.AgentStore interface to avoid a rtc -> service -> rtc import cycle

type AnyTransportHandler

type AnyTransportHandler struct {
	transport.UnimplementedHandler
	// contains filtered or unexported fields
}

func (AnyTransportHandler) OnFailed

func (h AnyTransportHandler) OnFailed(_isShortLived bool, _ici *types.ICEConnectionInfo)

func (AnyTransportHandler) OnICECandidate

func (h AnyTransportHandler) OnICECandidate(c *webrtc.ICECandidate, target livekit.SignalTarget) error

func (AnyTransportHandler) OnNegotiationFailed

func (h AnyTransportHandler) OnNegotiationFailed()

type ClientInfo

type ClientInfo struct {
	*livekit.ClientInfo
}

func (ClientInfo) CanHandleReconnectResponse

func (c ClientInfo) CanHandleReconnectResponse() bool

func (ClientInfo) ComplyWithCodecOrderInSDPAnswer

func (c ClientInfo) ComplyWithCodecOrderInSDPAnswer() bool

func (ClientInfo) FireTrackByRTPPacket

func (c ClientInfo) FireTrackByRTPPacket() bool

GoSDK(pion) relies on rtp packets to fire ontrack event, browsers and native (libwebrtc) rely on sdp

func (ClientInfo) SupportsAudioRED

func (c ClientInfo) SupportsAudioRED() bool

func (ClientInfo) SupportsChangeRTPSenderEncodingActive

func (c ClientInfo) SupportsChangeRTPSenderEncodingActive() bool

func (ClientInfo) SupportsCodecChange

func (c ClientInfo) SupportsCodecChange() bool

func (ClientInfo) SupportsICETCP

func (c ClientInfo) SupportsICETCP() bool

func (ClientInfo) SupportsPrflxOverRelay

func (c ClientInfo) SupportsPrflxOverRelay() bool

func (ClientInfo) SupportsRequestResponse

func (c ClientInfo) SupportsRequestResponse() bool

func (ClientInfo) SupportsSctpZeroChecksum

func (c ClientInfo) SupportsSctpZeroChecksum() bool

func (ClientInfo) SupportsTrackSubscribedEvent

func (c ClientInfo) SupportsTrackSubscribedEvent() bool

Rust SDK can't decode unknown signal message (TrackSubscribed and ErrorResponse)

type DirectionConfig

type DirectionConfig struct {
	RTPHeaderExtension RTPHeaderExtensionConfig
	RTCPFeedback       RTCPFeedbackConfig
}

type DummyReceiver

type DummyReceiver struct {
	// contains filtered or unexported fields
}

func NewDummyReceiver

func NewDummyReceiver(trackID livekit.TrackID, streamId string, codec webrtc.RTPCodecParameters, headerExtensions []webrtc.RTPHeaderExtensionParameter) *DummyReceiver

func (*DummyReceiver) AddDownTrack

func (d *DummyReceiver) AddDownTrack(track sfu.TrackSender) error

func (*DummyReceiver) AddOnCodecStateChange

func (d *DummyReceiver) AddOnCodecStateChange(f func(codec webrtc.RTPCodecParameters, state sfu.ReceiverCodecState))

func (*DummyReceiver) AddOnReady

func (d *DummyReceiver) AddOnReady(f func())

func (*DummyReceiver) Codec

func (*DummyReceiver) CodecState

func (d *DummyReceiver) CodecState() sfu.ReceiverCodecState

func (*DummyReceiver) DebugInfo

func (d *DummyReceiver) DebugInfo() map[string]interface{}

func (*DummyReceiver) DeleteDownTrack

func (d *DummyReceiver) DeleteDownTrack(subscriberID livekit.ParticipantID)

func (*DummyReceiver) GetAudioLevel

func (d *DummyReceiver) GetAudioLevel() (float64, bool)

func (*DummyReceiver) GetDownTracks

func (d *DummyReceiver) GetDownTracks() []sfu.TrackSender

func (*DummyReceiver) GetLayeredBitrate

func (d *DummyReceiver) GetLayeredBitrate() ([]int32, sfu.Bitrates)

func (*DummyReceiver) GetPrimaryReceiverForRed

func (d *DummyReceiver) GetPrimaryReceiverForRed() sfu.TrackReceiver

func (*DummyReceiver) GetRedReceiver

func (d *DummyReceiver) GetRedReceiver() sfu.TrackReceiver

func (*DummyReceiver) GetTemporalLayerFpsForSpatial

func (d *DummyReceiver) GetTemporalLayerFpsForSpatial(spatial int32) []float32

func (*DummyReceiver) GetTrackStats

func (d *DummyReceiver) GetTrackStats() *livekit.RTPStats

func (*DummyReceiver) HeaderExtensions

func (d *DummyReceiver) HeaderExtensions() []webrtc.RTPHeaderExtensionParameter

func (*DummyReceiver) IsClosed

func (d *DummyReceiver) IsClosed() bool

func (*DummyReceiver) Mime

func (d *DummyReceiver) Mime() mime.MimeType

func (*DummyReceiver) ReadRTP

func (d *DummyReceiver) ReadRTP(buf []byte, layer uint8, esn uint64) (int, error)

func (*DummyReceiver) Receiver

func (d *DummyReceiver) Receiver() sfu.TrackReceiver

func (*DummyReceiver) SendPLI

func (d *DummyReceiver) SendPLI(layer int32, force bool)

func (*DummyReceiver) SetMaxExpectedSpatialLayer

func (d *DummyReceiver) SetMaxExpectedSpatialLayer(layer int32)

func (*DummyReceiver) SetUpTrackPaused

func (d *DummyReceiver) SetUpTrackPaused(paused bool)

func (*DummyReceiver) StreamID

func (d *DummyReceiver) StreamID() string

func (*DummyReceiver) TrackID

func (d *DummyReceiver) TrackID() livekit.TrackID

func (*DummyReceiver) TrackInfo

func (d *DummyReceiver) TrackInfo() *livekit.TrackInfo

func (*DummyReceiver) UpdateTrackInfo

func (d *DummyReceiver) UpdateTrackInfo(ti *livekit.TrackInfo)

func (*DummyReceiver) Upgrade

func (d *DummyReceiver) Upgrade(receiver sfu.TrackReceiver)

func (*DummyReceiver) VideoLayerMode

func (d *DummyReceiver) VideoLayerMode() livekit.VideoLayer_Mode

func (*DummyReceiver) VideoSizes

func (d *DummyReceiver) VideoSizes() []buffer.VideoSize

type DummyRedReceiver

type DummyRedReceiver struct {
	*DummyReceiver
	// contains filtered or unexported fields
}

func NewDummyRedReceiver

func NewDummyRedReceiver(d *DummyReceiver, isRedEncoding bool) *DummyRedReceiver

func (*DummyRedReceiver) AddDownTrack

func (d *DummyRedReceiver) AddDownTrack(track sfu.TrackSender) error

func (*DummyRedReceiver) DeleteDownTrack

func (d *DummyRedReceiver) DeleteDownTrack(subscriberID livekit.ParticipantID)

func (*DummyRedReceiver) GetDownTracks

func (d *DummyRedReceiver) GetDownTracks() []sfu.TrackSender

func (*DummyRedReceiver) ReadRTP

func (d *DummyRedReceiver) ReadRTP(buf []byte, layer uint8, esn uint64) (int, error)

type EgressLauncher

type EgressLauncher interface {
	StartEgress(context.Context, *rpc.StartEgressRequest) (*livekit.EgressInfo, error)
}

type MediaLossProxy

type MediaLossProxy struct {
	// contains filtered or unexported fields
}

func NewMediaLossProxy

func NewMediaLossProxy(params MediaLossProxyParams) *MediaLossProxy

func (*MediaLossProxy) HandleMaxLossFeedback

func (m *MediaLossProxy) HandleMaxLossFeedback(_ *sfu.DownTrack, report *rtcp.ReceiverReport)

func (*MediaLossProxy) NotifySubscriberNodeMediaLoss

func (m *MediaLossProxy) NotifySubscriberNodeMediaLoss(_nodeID livekit.NodeID, fractionalLoss uint8)

func (*MediaLossProxy) OnMediaLossUpdate

func (m *MediaLossProxy) OnMediaLossUpdate(f func(fractionalLoss uint8))

type MediaLossProxyParams

type MediaLossProxyParams struct {
	Logger logger.Logger
}

type MediaTrack

type MediaTrack struct {
	*MediaTrackReceiver
	*MediaLossProxy
	// contains filtered or unexported fields
}

MediaTrack represents a WebRTC track that needs to be forwarded Implements MediaTrack and PublishedTrack interface

func NewMediaTrack

func NewMediaTrack(params MediaTrackParams, ti *livekit.TrackInfo) *MediaTrack

func (*MediaTrack) AddReceiver

func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track sfu.TrackRemote, mid string) (bool, bool)

AddReceiver adds a new RTP receiver to the track, returns true when receiver represents a new codec and if a receiver was added successfully

func (*MediaTrack) ClearSubscriberNodes

func (t *MediaTrack) ClearSubscriberNodes()

func (*MediaTrack) Close

func (t *MediaTrack) Close(isExpectedToResume bool)

func (*MediaTrack) GetCidsForMimeType

func (t *MediaTrack) GetCidsForMimeType(mimeType mime.MimeType) (string, string)

func (*MediaTrack) GetConnectionScoreAndQuality

func (t *MediaTrack) GetConnectionScoreAndQuality() (float32, livekit.ConnectionQuality)

func (*MediaTrack) GetMimeTypeForSdpCid

func (t *MediaTrack) GetMimeTypeForSdpCid(cid string) mime.MimeType

func (*MediaTrack) HasPendingCodec

func (t *MediaTrack) HasPendingCodec() bool

func (*MediaTrack) HasSdpCid

func (t *MediaTrack) HasSdpCid(cid string) bool

func (*MediaTrack) HasSignalCid

func (t *MediaTrack) HasSignalCid(cid string) bool

func (*MediaTrack) Logger

func (t *MediaTrack) Logger() logger.Logger

func (*MediaTrack) NotifySubscriberNodeMaxQuality

func (t *MediaTrack) NotifySubscriberNodeMaxQuality(nodeID livekit.NodeID, qualities []types.SubscribedCodecQuality)

func (*MediaTrack) NotifySubscriptionNode

func (t *MediaTrack) NotifySubscriptionNode(nodeID livekit.NodeID, codecs []*livekit.SubscribedAudioCodec)

func (*MediaTrack) OnDynacastSubscribedAudioCodecChange

func (t *MediaTrack) OnDynacastSubscribedAudioCodecChange(codecs []*livekit.SubscribedAudioCodec)

func (*MediaTrack) OnDynacastSubscribedMaxQualityChange

func (t *MediaTrack) OnDynacastSubscribedMaxQualityChange(
	subscribedQualities []*livekit.SubscribedCodec,
	maxSubscribedQualities []types.SubscribedCodecQuality,
)

func (*MediaTrack) OnSubscribedAudioCodecChange

func (t *MediaTrack) OnSubscribedAudioCodecChange(
	f func(
		trackID livekit.TrackID,
		codecs []*livekit.SubscribedAudioCodec,
	) error,
)

func (*MediaTrack) OnSubscribedMaxQualityChange

func (t *MediaTrack) OnSubscribedMaxQualityChange(
	f func(
		trackID livekit.TrackID,
		trackInfo *livekit.TrackInfo,
		subscribedQualities []*livekit.SubscribedCodec,
		maxSubscribedQualities []types.SubscribedCodecQuality,
	) error,
)

func (*MediaTrack) OnTrackSubscribed

func (t *MediaTrack) OnTrackSubscribed()

OnTrackSubscribed is called when the track is subscribed by a non-hidden subscriber this allows the publisher to know when they should start sending data

func (*MediaTrack) Restart

func (t *MediaTrack) Restart()

func (*MediaTrack) SetMuted

func (t *MediaTrack) SetMuted(muted bool)

func (*MediaTrack) SetRTT

func (t *MediaTrack) SetRTT(rtt uint32)

func (*MediaTrack) ToProto

func (t *MediaTrack) ToProto() *livekit.TrackInfo

type MediaTrackParams

type MediaTrackParams struct {
	ParticipantID            func() livekit.ParticipantID
	ParticipantIdentity      livekit.ParticipantIdentity
	ParticipantVersion       uint32
	ParticipantCountry       string
	BufferFactory            *buffer.Factory
	ReceiverConfig           ReceiverConfig
	SubscriberConfig         DirectionConfig
	PLIThrottleConfig        sfu.PLIThrottleConfig
	AudioConfig              sfu.AudioConfig
	VideoConfig              config.VideoConfig
	Telemetry                telemetry.TelemetryService
	Logger                   logger.Logger
	Reporter                 roomobs.TrackReporter
	SimTracks                map[uint32]SimulcastTrackInfo
	OnRTCP                   func([]rtcp.Packet)
	ForwardStats             *sfu.ForwardStats
	OnTrackEverSubscribed    func(livekit.TrackID)
	ShouldRegressCodec       func() bool
	PreferVideoSizeFromMedia bool
}

type MediaTrackReceiver

type MediaTrackReceiver struct {
	*MediaTrackSubscriptions
	// contains filtered or unexported fields
}

func (*MediaTrackReceiver) ActiveReceiver

func (t *MediaTrackReceiver) ActiveReceiver() sfu.TrackReceiver

func (*MediaTrackReceiver) AddOnClose

func (t *MediaTrackReceiver) AddOnClose(f func(isExpectedToResume bool))

func (*MediaTrackReceiver) AddSubscriber

AddSubscriber subscribes sub to current mediaTrack

func (*MediaTrackReceiver) ClearAllReceivers

func (t *MediaTrackReceiver) ClearAllReceivers(isExpectedToResume bool)

func (*MediaTrackReceiver) ClearReceiver

func (t *MediaTrackReceiver) ClearReceiver(mime mime.MimeType, isExpectedToResume bool)

func (*MediaTrackReceiver) Close

func (t *MediaTrackReceiver) Close(isExpectedToResume bool)

func (*MediaTrackReceiver) DebugInfo

func (t *MediaTrackReceiver) DebugInfo() map[string]interface{}

func (*MediaTrackReceiver) GetAudioLevel

func (t *MediaTrackReceiver) GetAudioLevel() (float64, bool)

func (*MediaTrackReceiver) GetQualityForDimension

func (t *MediaTrackReceiver) GetQualityForDimension(mimeType mime.MimeType, width, height uint32) livekit.VideoQuality

GetQualityForDimension finds the closest quality to use for desired dimensions affords a 20% tolerance on dimension

func (*MediaTrackReceiver) GetTemporalLayerForSpatialFps

func (t *MediaTrackReceiver) GetTemporalLayerForSpatialFps(mimeType mime.MimeType, spatial int32, fps uint32) int32

func (*MediaTrackReceiver) GetTrackStats

func (t *MediaTrackReceiver) GetTrackStats() *livekit.RTPStats

func (*MediaTrackReceiver) HandleReceiverCodecChange

func (t *MediaTrackReceiver) HandleReceiverCodecChange(r sfu.TrackReceiver, codec webrtc.RTPCodecParameters, state sfu.ReceiverCodecState)

func (*MediaTrackReceiver) ID

func (*MediaTrackReceiver) IsEncrypted

func (t *MediaTrackReceiver) IsEncrypted() bool

func (*MediaTrackReceiver) IsMuted

func (t *MediaTrackReceiver) IsMuted() bool

func (*MediaTrackReceiver) IsOpen

func (t *MediaTrackReceiver) IsOpen() bool

func (*MediaTrackReceiver) Kind

func (*MediaTrackReceiver) Name

func (t *MediaTrackReceiver) Name() string

func (*MediaTrackReceiver) NotifyMaxLayerChange

func (t *MediaTrackReceiver) NotifyMaxLayerChange(mimeType mime.MimeType, maxLayer int32)

func (*MediaTrackReceiver) OnCodecRegression

func (t *MediaTrackReceiver) OnCodecRegression(f func(old, new webrtc.RTPCodecParameters))

func (*MediaTrackReceiver) OnMediaLossFeedback

func (t *MediaTrackReceiver) OnMediaLossFeedback(f func(dt *sfu.DownTrack, rr *rtcp.ReceiverReport))

func (*MediaTrackReceiver) OnSetupReceiver

func (t *MediaTrackReceiver) OnSetupReceiver(f func(mime mime.MimeType))

func (*MediaTrackReceiver) PrimaryReceiver

func (t *MediaTrackReceiver) PrimaryReceiver() sfu.TrackReceiver

func (*MediaTrackReceiver) PublisherID

func (t *MediaTrackReceiver) PublisherID() livekit.ParticipantID

func (*MediaTrackReceiver) PublisherIdentity

func (t *MediaTrackReceiver) PublisherIdentity() livekit.ParticipantIdentity

func (*MediaTrackReceiver) PublisherVersion

func (t *MediaTrackReceiver) PublisherVersion() uint32

func (*MediaTrackReceiver) Receiver

func (t *MediaTrackReceiver) Receiver(mime mime.MimeType) sfu.TrackReceiver

func (*MediaTrackReceiver) Receivers

func (t *MediaTrackReceiver) Receivers() []sfu.TrackReceiver

func (*MediaTrackReceiver) RemoveSubscriber

func (t *MediaTrackReceiver) RemoveSubscriber(subscriberID livekit.ParticipantID, isExpectedToResume bool)

RemoveSubscriber removes participant from subscription stop all forwarders to the client

func (*MediaTrackReceiver) Restart

func (t *MediaTrackReceiver) Restart()

func (*MediaTrackReceiver) RevokeDisallowedSubscribers

func (t *MediaTrackReceiver) RevokeDisallowedSubscribers(allowedSubscriberIdentities []livekit.ParticipantIdentity) []livekit.ParticipantIdentity

func (*MediaTrackReceiver) SetClosing

func (t *MediaTrackReceiver) SetClosing(isExpectedToResume bool)

func (*MediaTrackReceiver) SetLayerSsrc

func (t *MediaTrackReceiver) SetLayerSsrc(mimeType mime.MimeType, rid string, ssrc uint32)

func (*MediaTrackReceiver) SetMuted

func (t *MediaTrackReceiver) SetMuted(muted bool)

func (*MediaTrackReceiver) SetPotentialCodecs

func (t *MediaTrackReceiver) SetPotentialCodecs(codecs []webrtc.RTPCodecParameters, headers []webrtc.RTPHeaderExtensionParameter)

func (*MediaTrackReceiver) SetRTT

func (t *MediaTrackReceiver) SetRTT(rtt uint32)

func (*MediaTrackReceiver) SetupReceiver

func (t *MediaTrackReceiver) SetupReceiver(receiver sfu.TrackReceiver, priority int, mid string)

func (*MediaTrackReceiver) Source

func (*MediaTrackReceiver) Stream

func (t *MediaTrackReceiver) Stream() string

func (*MediaTrackReceiver) TrackInfo

func (t *MediaTrackReceiver) TrackInfo() *livekit.TrackInfo

func (*MediaTrackReceiver) TrackInfoClone

func (t *MediaTrackReceiver) TrackInfoClone() *livekit.TrackInfo

func (*MediaTrackReceiver) TryClose

func (t *MediaTrackReceiver) TryClose() bool

func (*MediaTrackReceiver) UpdateAudioTrack

func (t *MediaTrackReceiver) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack)

func (*MediaTrackReceiver) UpdateCodecInfo

func (t *MediaTrackReceiver) UpdateCodecInfo(codecs []*livekit.SimulcastCodec)

func (*MediaTrackReceiver) UpdateCodecRids

func (t *MediaTrackReceiver) UpdateCodecRids(mimeType mime.MimeType, rids buffer.VideoLayersRid)

func (*MediaTrackReceiver) UpdateCodecSdpCid

func (t *MediaTrackReceiver) UpdateCodecSdpCid(mimeType mime.MimeType, sdpCid string)

func (*MediaTrackReceiver) UpdateTrackInfo

func (t *MediaTrackReceiver) UpdateTrackInfo(ti *livekit.TrackInfo)

func (*MediaTrackReceiver) UpdateVideoTrack

func (t *MediaTrackReceiver) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack)

type MediaTrackReceiverParams

type MediaTrackReceiverParams struct {
	MediaTrack               types.MediaTrack
	IsRelayed                bool
	ParticipantID            func() livekit.ParticipantID
	ParticipantIdentity      livekit.ParticipantIdentity
	ParticipantVersion       uint32
	ReceiverConfig           ReceiverConfig
	SubscriberConfig         DirectionConfig
	AudioConfig              sfu.AudioConfig
	Telemetry                telemetry.TelemetryService
	Logger                   logger.Logger
	RegressionTargetCodec    mime.MimeType
	PreferVideoSizeFromMedia bool
}

type MediaTrackSubscriptions

type MediaTrackSubscriptions struct {
	// contains filtered or unexported fields
}

MediaTrackSubscriptions manages subscriptions of a media track

func (*MediaTrackSubscriptions) AddSubscriber

AddSubscriber subscribes sub to current mediaTrack

func (*MediaTrackSubscriptions) DebugInfo

func (t *MediaTrackSubscriptions) DebugInfo() []map[string]interface{}

func (*MediaTrackSubscriptions) GetAllSubscribers

func (t *MediaTrackSubscriptions) GetAllSubscribers() []livekit.ParticipantID

func (*MediaTrackSubscriptions) GetAllSubscribersForMime

func (t *MediaTrackSubscriptions) GetAllSubscribersForMime(mime mime.MimeType) []livekit.ParticipantID

func (*MediaTrackSubscriptions) GetNumSubscribers

func (t *MediaTrackSubscriptions) GetNumSubscribers() int

func (*MediaTrackSubscriptions) IsSubscriber

func (t *MediaTrackSubscriptions) IsSubscriber(subID livekit.ParticipantID) bool

func (*MediaTrackSubscriptions) OnDownTrackCreated

func (t *MediaTrackSubscriptions) OnDownTrackCreated(f func(downTrack *sfu.DownTrack))

func (*MediaTrackSubscriptions) OnSubscriberAudioCodecChange

func (t *MediaTrackSubscriptions) OnSubscriberAudioCodecChange(f func(subscriberID livekit.ParticipantID, mime mime.MimeType, enabled bool))

func (*MediaTrackSubscriptions) OnSubscriberMaxQualityChange

func (t *MediaTrackSubscriptions) OnSubscriberMaxQualityChange(f func(subscriberID livekit.ParticipantID, mime mime.MimeType, layer int32))

func (*MediaTrackSubscriptions) RemoveSubscriber

func (t *MediaTrackSubscriptions) RemoveSubscriber(subscriberID livekit.ParticipantID, isExpectedToResume bool) error

RemoveSubscriber removes participant from subscription stop all forwarders to the client

func (*MediaTrackSubscriptions) SetMuted

func (t *MediaTrackSubscriptions) SetMuted(muted bool)

func (*MediaTrackSubscriptions) UpdateVideoLayers

func (t *MediaTrackSubscriptions) UpdateVideoLayers()

type MediaTrackSubscriptionsParams

type MediaTrackSubscriptionsParams struct {
	MediaTrack types.MediaTrack
	IsRelayed  bool

	ReceiverConfig   ReceiverConfig
	SubscriberConfig DirectionConfig

	Telemetry telemetry.TelemetryService

	Logger logger.Logger
}

type MigrationDataCache

type MigrationDataCache struct {
	// contains filtered or unexported fields
}

func NewMigrationDataCache

func NewMigrationDataCache(lastSeq uint32, expiredAt time.Time) *MigrationDataCache

func (*MigrationDataCache) Add

Add adds a message to the cache if there is a gap between the last sequence number and cached messages then return the cache State:

  • MigrationDataCacheStateWaiting: waiting for the next packet (lastSeq + 1) of last sequence from old node
  • MigrationDataCacheStateTimeout: the next packet is not received before the expiredAt, participant will continue to process the reliable messages, subscribers will see the gap after the publisher migration
  • MigrationDataCacheStateDone: the next packet is received, participant can continue to process the reliable messages

func (*MigrationDataCache) Get

type MigrationDataCacheState

type MigrationDataCacheState int
const (
	MigrationDataCacheStateWaiting MigrationDataCacheState = iota
	MigrationDataCacheStateTimeout
	MigrationDataCacheStateDone
)

type PCTransport

type PCTransport struct {
	// contains filtered or unexported fields
}

PCTransport is a wrapper around PeerConnection, with some helper methods

func NewPCTransport

func NewPCTransport(params TransportParams) (*PCTransport, error)

func (*PCTransport) AddICECandidate

func (t *PCTransport) AddICECandidate(candidate webrtc.ICECandidateInit)

func (*PCTransport) AddTrack

func (t *PCTransport) AddTrack(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
	enabledCodecs []*livekit.Codec,
	rtcpFeedbackConfig RTCPFeedbackConfig,
) (sender *webrtc.RTPSender, transceiver *webrtc.RTPTransceiver, err error)

func (*PCTransport) AddTrackToStreamAllocator

func (t *PCTransport) AddTrackToStreamAllocator(subTrack types.SubscribedTrack)

func (*PCTransport) AddTransceiverFromKind

func (t *PCTransport) AddTransceiverFromKind(
	kind webrtc.RTPCodecType,
	init webrtc.RTPTransceiverInit,
) (*webrtc.RTPTransceiver, error)

func (*PCTransport) AddTransceiverFromTrack

func (t *PCTransport) AddTransceiverFromTrack(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
	enabledCodecs []*livekit.Codec,
	rtcpFeedbackConfig RTCPFeedbackConfig,
) (sender *webrtc.RTPSender, transceiver *webrtc.RTPTransceiver, err error)

func (*PCTransport) Close

func (t *PCTransport) Close()

func (*PCTransport) CreateDataChannel

func (t *PCTransport) CreateDataChannel(label string, dci *webrtc.DataChannelInit) error

func (*PCTransport) CreateDataChannelIfEmpty

func (t *PCTransport) CreateDataChannelIfEmpty(dcLabel string, dci *webrtc.DataChannelInit) (label string, id uint16, existing bool, err error)

func (*PCTransport) CreateReadableDataChannel

func (t *PCTransport) CreateReadableDataChannel(label string, dci *webrtc.DataChannelInit) error

for testing only

func (*PCTransport) CurrentLocalDescription

func (t *PCTransport) CurrentLocalDescription() *webrtc.SessionDescription

func (*PCTransport) CurrentRemoteDescription

func (t *PCTransport) CurrentRemoteDescription() *webrtc.SessionDescription

func (*PCTransport) GetAnswer

func (t *PCTransport) GetAnswer() (webrtc.SessionDescription, uint32, error)

func (*PCTransport) GetICEConnectionInfo

func (t *PCTransport) GetICEConnectionInfo() *types.ICEConnectionInfo

func (*PCTransport) GetICEConnectionType

func (t *PCTransport) GetICEConnectionType() types.ICEConnectionType

func (*PCTransport) GetICESessionUfrag

func (t *PCTransport) GetICESessionUfrag() (string, error)

func (*PCTransport) GetMid

func (t *PCTransport) GetMid(rtpReceiver *webrtc.RTPReceiver) string

func (*PCTransport) GetPacer

func (t *PCTransport) GetPacer() pacer.Pacer

func (*PCTransport) GetRTPReceiver

func (t *PCTransport) GetRTPReceiver(mid string) *webrtc.RTPReceiver

func (*PCTransport) GetRTPTransceiver

func (t *PCTransport) GetRTPTransceiver(mid string) *webrtc.RTPTransceiver

func (*PCTransport) GetRTT

func (t *PCTransport) GetRTT() (float64, bool)

func (*PCTransport) HandleICERestartSDPFragment

func (t *PCTransport) HandleICERestartSDPFragment(sdpFragment string) (string, error)

Handles SDP Fragment for ICE Restart in WHIP

func (*PCTransport) HandleICETrickleSDPFragment

func (t *PCTransport) HandleICETrickleSDPFragment(sdpFragment string) error

Handles SDP Fragment for ICE Trickle in WHIP

func (*PCTransport) HandleRemoteDescription

func (t *PCTransport) HandleRemoteDescription(sd webrtc.SessionDescription, remoteId uint32) error

func (*PCTransport) HasEverConnected

func (t *PCTransport) HasEverConnected() bool

func (*PCTransport) ICERestart

func (t *PCTransport) ICERestart() error

func (*PCTransport) IsEstablished

func (t *PCTransport) IsEstablished() bool

func (*PCTransport) IsShortConnection

func (t *PCTransport) IsShortConnection(at time.Time) (bool, time.Duration)

func (*PCTransport) Negotiate

func (t *PCTransport) Negotiate(force bool)

func (*PCTransport) OnNegotiationStateChanged

func (t *PCTransport) OnNegotiationStateChanged(f func(state transport.NegotiationState))

func (*PCTransport) PendingRemoteDescription

func (t *PCTransport) PendingRemoteDescription() *webrtc.SessionDescription

func (*PCTransport) RemoveTrack

func (t *PCTransport) RemoveTrack(sender *webrtc.RTPSender) error

func (*PCTransport) RemoveTrackFromStreamAllocator

func (t *PCTransport) RemoveTrackFromStreamAllocator(subTrack types.SubscribedTrack)

func (*PCTransport) ResetShortConnOnICERestart

func (t *PCTransport) ResetShortConnOnICERestart()

func (*PCTransport) SendDataMessage

func (t *PCTransport) SendDataMessage(kind livekit.DataPacket_Kind, data []byte) error

func (*PCTransport) SendDataMessageUnlabeled

func (t *PCTransport) SendDataMessageUnlabeled(data []byte, useRaw bool, sender livekit.ParticipantIdentity) error

func (*PCTransport) SetAllowPauseOfStreamAllocator

func (t *PCTransport) SetAllowPauseOfStreamAllocator(allowPause bool)

func (*PCTransport) SetChannelCapacityOfStreamAllocator

func (t *PCTransport) SetChannelCapacityOfStreamAllocator(channelCapacity int64)

func (*PCTransport) SetPreferTCP

func (t *PCTransport) SetPreferTCP(preferTCP bool)

func (*PCTransport) SetPreviousSdp

func (t *PCTransport) SetPreviousSdp(localDescription, remoteDescription *webrtc.SessionDescription)

func (*PCTransport) SetSignalingRTT

func (t *PCTransport) SetSignalingRTT(rtt uint32)

func (*PCTransport) WriteRTCP

func (t *PCTransport) WriteRTCP(pkts []rtcp.Packet) error

type ParticipantImpl

type ParticipantImpl struct {
	*TransportManager
	*UpTrackManager
	*SubscriptionManager
	// contains filtered or unexported fields
}

func NewParticipant

func NewParticipant(params ParticipantParams) (*ParticipantImpl, error)

func (*ParticipantImpl) AddOnClose

func (p *ParticipantImpl) AddOnClose(key string, callback func(types.LocalParticipant))

func (*ParticipantImpl) AddTrack

func (p *ParticipantImpl) AddTrack(req *livekit.AddTrackRequest)

AddTrack is called when client intends to publish track. records track details and lets client know it's ok to proceed

func (*ParticipantImpl) AddTrackLocal

func (p *ParticipantImpl) AddTrackLocal(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*ParticipantImpl) AddTransceiverFromTrackLocal

func (p *ParticipantImpl) AddTransceiverFromTrackLocal(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*ParticipantImpl) CacheDownTrack

func (p *ParticipantImpl) CacheDownTrack(trackID livekit.TrackID, rtpTransceiver *webrtc.RTPTransceiver, downTrack sfu.DownTrackState)

func (*ParticipantImpl) CanPublish

func (p *ParticipantImpl) CanPublish() bool

func (*ParticipantImpl) CanPublishData

func (p *ParticipantImpl) CanPublishData() bool

func (*ParticipantImpl) CanPublishSource

func (p *ParticipantImpl) CanPublishSource(source livekit.TrackSource) bool

func (*ParticipantImpl) CanSkipBroadcast

func (p *ParticipantImpl) CanSkipBroadcast() bool

func (*ParticipantImpl) CanSubscribe

func (p *ParticipantImpl) CanSubscribe() bool

func (*ParticipantImpl) CanSubscribeMetrics

func (p *ParticipantImpl) CanSubscribeMetrics() bool

func (*ParticipantImpl) ClaimGrants

func (p *ParticipantImpl) ClaimGrants() *auth.ClaimGrants

func (*ParticipantImpl) Close

func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseReason, isExpectedToResume bool) error

func (*ParticipantImpl) CloseReason

func (p *ParticipantImpl) CloseReason() types.ParticipantCloseReason

func (*ParticipantImpl) CloseSignalConnection

func (p *ParticipantImpl) CloseSignalConnection(reason types.SignallingCloseReason)

func (*ParticipantImpl) ConnectedAt

func (p *ParticipantImpl) ConnectedAt() time.Time

func (*ParticipantImpl) DebugInfo

func (p *ParticipantImpl) DebugInfo() map[string]interface{}

func (*ParticipantImpl) Disconnected

func (p *ParticipantImpl) Disconnected() <-chan struct{}

func (*ParticipantImpl) GetAdaptiveStream

func (p *ParticipantImpl) GetAdaptiveStream() bool

func (*ParticipantImpl) GetAnswer

func (*ParticipantImpl) GetBufferFactory

func (p *ParticipantImpl) GetBufferFactory() *buffer.Factory

func (*ParticipantImpl) GetCachedDownTrack

func (p *ParticipantImpl) GetCachedDownTrack(trackID livekit.TrackID) (*webrtc.RTPTransceiver, sfu.DownTrackState)

func (*ParticipantImpl) GetClientConfiguration

func (p *ParticipantImpl) GetClientConfiguration() *livekit.ClientConfiguration

func (*ParticipantImpl) GetClientInfo

func (p *ParticipantImpl) GetClientInfo() *livekit.ClientInfo

func (*ParticipantImpl) GetConnectionQuality

func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo

func (*ParticipantImpl) GetCountry

func (p *ParticipantImpl) GetCountry() string

func (*ParticipantImpl) GetDisableSenderReportPassThrough

func (p *ParticipantImpl) GetDisableSenderReportPassThrough() bool

func (*ParticipantImpl) GetEnabledPublishCodecs

func (p *ParticipantImpl) GetEnabledPublishCodecs() []*livekit.Codec

func (*ParticipantImpl) GetLastReliableSequence

func (p *ParticipantImpl) GetLastReliableSequence(migrateOut bool) uint32

func (*ParticipantImpl) GetLogger

func (p *ParticipantImpl) GetLogger() logger.Logger

func (*ParticipantImpl) GetLoggerResolver

func (p *ParticipantImpl) GetLoggerResolver() logger.DeferredFieldResolver

func (*ParticipantImpl) GetPacer

func (p *ParticipantImpl) GetPacer() pacer.Pacer

func (*ParticipantImpl) GetPendingTrack

func (p *ParticipantImpl) GetPendingTrack(trackID livekit.TrackID) *livekit.TrackInfo

func (*ParticipantImpl) GetPlayoutDelayConfig

func (p *ParticipantImpl) GetPlayoutDelayConfig() *livekit.PlayoutDelay

func (*ParticipantImpl) GetReporter

func (*ParticipantImpl) GetReporterResolver

func (p *ParticipantImpl) GetReporterResolver() roomobs.ParticipantReporterResolver

func (*ParticipantImpl) GetResponseSink

func (p *ParticipantImpl) GetResponseSink() routing.MessageSink

func (*ParticipantImpl) GetTrailer

func (p *ParticipantImpl) GetTrailer() []byte

func (*ParticipantImpl) HandleAnswer

func (p *ParticipantImpl) HandleAnswer(sd *livekit.SessionDescription)

HandleAnswer handles a client answer response, with subscriber PC, server initiates the offer and client answers

func (*ParticipantImpl) HandleICETrickle

func (p *ParticipantImpl) HandleICETrickle(trickleRequest *livekit.TrickleRequest)

func (*ParticipantImpl) HandleLeaveRequest

func (p *ParticipantImpl) HandleLeaveRequest(reason types.ParticipantCloseReason)

func (*ParticipantImpl) HandleMetrics

func (p *ParticipantImpl) HandleMetrics(senderParticipantID livekit.ParticipantID, metrics *livekit.MetricsBatch) error

func (*ParticipantImpl) HandleOffer

func (p *ParticipantImpl) HandleOffer(sd *livekit.SessionDescription) error

HandleOffer an offer from remote participant, used when clients make the initial connection

func (*ParticipantImpl) HandleReconnectAndSendResponse

func (p *ParticipantImpl) HandleReconnectAndSendResponse(reconnectReason livekit.ReconnectReason, reconnectResponse *livekit.ReconnectResponse) error

func (*ParticipantImpl) HandleSignalMessage

func (p *ParticipantImpl) HandleSignalMessage(msg proto.Message) error

func (*ParticipantImpl) HandleSignalSourceClose

func (p *ParticipantImpl) HandleSignalSourceClose()

func (*ParticipantImpl) HandleSimulateScenario

func (p *ParticipantImpl) HandleSimulateScenario(simulateScenario *livekit.SimulateScenario) error

func (*ParticipantImpl) HandleSyncState

func (p *ParticipantImpl) HandleSyncState(syncState *livekit.SyncState) error

func (*ParticipantImpl) HandleUpdateSubscriptionPermission

func (p *ParticipantImpl) HandleUpdateSubscriptionPermission(subscriptionPermission *livekit.SubscriptionPermission) error

func (*ParticipantImpl) HandleUpdateSubscriptions

func (p *ParticipantImpl) HandleUpdateSubscriptions(
	trackIDs []livekit.TrackID,
	participantTracks []*livekit.ParticipantTracks,
	subscribe bool,
)

func (*ParticipantImpl) HasConnected

func (p *ParticipantImpl) HasConnected() bool

func (*ParticipantImpl) Hidden

func (p *ParticipantImpl) Hidden() bool

func (*ParticipantImpl) ICERestart

func (p *ParticipantImpl) ICERestart(iceConfig *livekit.ICEConfig)

ICERestart restarts subscriber ICE connections

func (*ParticipantImpl) ID

func (*ParticipantImpl) Identity

func (*ParticipantImpl) IsAgent

func (p *ParticipantImpl) IsAgent() bool

func (*ParticipantImpl) IsClosed

func (p *ParticipantImpl) IsClosed() bool

func (*ParticipantImpl) IsDependent

func (p *ParticipantImpl) IsDependent() bool

func (*ParticipantImpl) IsDisconnected

func (p *ParticipantImpl) IsDisconnected() bool

func (*ParticipantImpl) IsIdle

func (p *ParticipantImpl) IsIdle() bool

func (*ParticipantImpl) IsPublisher

func (p *ParticipantImpl) IsPublisher() bool

func (*ParticipantImpl) IsReady

func (p *ParticipantImpl) IsReady() bool

func (*ParticipantImpl) IsReconnect

func (p *ParticipantImpl) IsReconnect() bool

func (*ParticipantImpl) IsRecorder

func (p *ParticipantImpl) IsRecorder() bool

func (*ParticipantImpl) IsUsingSinglePeerConnection

func (p *ParticipantImpl) IsUsingSinglePeerConnection() bool

func (*ParticipantImpl) IssueFullReconnect

func (p *ParticipantImpl) IssueFullReconnect(reason types.ParticipantCloseReason)

func (*ParticipantImpl) Kind

func (*ParticipantImpl) MaybeStartMigration

func (p *ParticipantImpl) MaybeStartMigration(force bool, onStart func()) bool

func (*ParticipantImpl) MetricsCollectorBatchReady

func (p *ParticipantImpl) MetricsCollectorBatchReady(mb *livekit.MetricsBatch)

func (*ParticipantImpl) MetricsCollectorTimeToCollectMetrics

func (p *ParticipantImpl) MetricsCollectorTimeToCollectMetrics()

func (*ParticipantImpl) MetricsReporterBatchReady

func (p *ParticipantImpl) MetricsReporterBatchReady(mb *livekit.MetricsBatch)

func (*ParticipantImpl) MigrateState

func (p *ParticipantImpl) MigrateState() types.MigrateState

func (*ParticipantImpl) MoveToRoom

func (p *ParticipantImpl) MoveToRoom(params types.MoveToRoomParams)

func (*ParticipantImpl) Negotiate

func (p *ParticipantImpl) Negotiate(force bool)

Negotiate subscriber SDP with client, if force is true, will cancel pending negotiate task and negotiate immediately

func (*ParticipantImpl) NotifyMigration

func (p *ParticipantImpl) NotifyMigration()

func (*ParticipantImpl) OnClaimsChanged

func (p *ParticipantImpl) OnClaimsChanged(callback func(types.LocalParticipant))

func (*ParticipantImpl) OnDataMessage

func (p *ParticipantImpl) OnDataMessage(callback func(types.LocalParticipant, []byte))

func (*ParticipantImpl) OnDataPacket

func (p *ParticipantImpl) OnDataPacket(callback func(types.LocalParticipant, livekit.DataPacket_Kind, *livekit.DataPacket))

func (*ParticipantImpl) OnICEConfigChanged

func (p *ParticipantImpl) OnICEConfigChanged(f func(participant types.LocalParticipant, iceConfig *livekit.ICEConfig))

func (*ParticipantImpl) OnLeave

func (*ParticipantImpl) OnMetrics

func (p *ParticipantImpl) OnMetrics(callback func(types.Participant, *livekit.DataPacket))

func (*ParticipantImpl) OnMigrateStateChange

func (p *ParticipantImpl) OnMigrateStateChange(callback func(p types.LocalParticipant, state types.MigrateState))

func (*ParticipantImpl) OnParticipantUpdate

func (p *ParticipantImpl) OnParticipantUpdate(callback func(types.LocalParticipant))

func (*ParticipantImpl) OnSimulateScenario

func (p *ParticipantImpl) OnSimulateScenario(callback func(types.LocalParticipant, *livekit.SimulateScenario) error)

func (*ParticipantImpl) OnStateChange

func (p *ParticipantImpl) OnStateChange(callback func(p types.LocalParticipant))

func (*ParticipantImpl) OnSubscriberReady

func (p *ParticipantImpl) OnSubscriberReady(callback func(p types.LocalParticipant))

func (*ParticipantImpl) OnSyncState

func (p *ParticipantImpl) OnSyncState(callback func(types.LocalParticipant, *livekit.SyncState) error)

func (*ParticipantImpl) OnTrackPublished

func (p *ParticipantImpl) OnTrackPublished(callback func(types.LocalParticipant, types.MediaTrack))

func (*ParticipantImpl) OnTrackUnpublished

func (p *ParticipantImpl) OnTrackUnpublished(callback func(types.LocalParticipant, types.MediaTrack))

func (*ParticipantImpl) OnTrackUpdated

func (p *ParticipantImpl) OnTrackUpdated(callback func(types.LocalParticipant, types.MediaTrack))

func (*ParticipantImpl) OnUpdateSubscriptionPermission

func (p *ParticipantImpl) OnUpdateSubscriptionPermission(callback func(types.LocalParticipant, *livekit.SubscriptionPermission) error)

func (*ParticipantImpl) OnUpdateSubscriptions

func (p *ParticipantImpl) OnUpdateSubscriptions(callback func(types.LocalParticipant, []livekit.TrackID, []*livekit.ParticipantTracks, bool))

func (*ParticipantImpl) PerformRpc

func (p *ParticipantImpl) PerformRpc(req *livekit.PerformRpcRequest, resultCh chan string, errorCh chan error)

func (*ParticipantImpl) ProtocolVersion

func (p *ParticipantImpl) ProtocolVersion() types.ProtocolVersion

func (*ParticipantImpl) SendConnectionQualityUpdate

func (p *ParticipantImpl) SendConnectionQualityUpdate(update *livekit.ConnectionQualityUpdate) error

func (*ParticipantImpl) SendDataMessage

func (p *ParticipantImpl) SendDataMessage(kind livekit.DataPacket_Kind, data []byte, sender livekit.ParticipantID, seq uint32) error

func (*ParticipantImpl) SendDataMessageUnlabeled

func (p *ParticipantImpl) SendDataMessageUnlabeled(data []byte, useRaw bool, sender livekit.ParticipantIdentity) error

func (*ParticipantImpl) SendJoinResponse

func (p *ParticipantImpl) SendJoinResponse(joinResponse *livekit.JoinResponse) error

func (*ParticipantImpl) SendParticipantUpdate

func (p *ParticipantImpl) SendParticipantUpdate(participantsToUpdate []*livekit.ParticipantInfo) error

func (*ParticipantImpl) SendRefreshToken

func (p *ParticipantImpl) SendRefreshToken(token string) error

func (*ParticipantImpl) SendRoomMovedResponse

func (p *ParticipantImpl) SendRoomMovedResponse(roomMovedResponse *livekit.RoomMovedResponse) error

func (*ParticipantImpl) SendRoomUpdate

func (p *ParticipantImpl) SendRoomUpdate(room *livekit.Room) error

func (*ParticipantImpl) SendSpeakerUpdate

func (p *ParticipantImpl) SendSpeakerUpdate(speakers []*livekit.SpeakerInfo, force bool) error

SendSpeakerUpdate notifies participant changes to speakers. only send members that have changed since last update

func (*ParticipantImpl) SendSubscriptionPermissionUpdate

func (p *ParticipantImpl) SendSubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool) error

func (*ParticipantImpl) SetAttributes

func (p *ParticipantImpl) SetAttributes(attrs map[string]string)

func (*ParticipantImpl) SetMetadata

func (p *ParticipantImpl) SetMetadata(metadata string)

SetMetadata attaches metadata to the participant

func (*ParticipantImpl) SetMigrateInfo

func (p *ParticipantImpl) SetMigrateInfo(
	previousOffer, previousAnswer *webrtc.SessionDescription,
	mediaTracks []*livekit.TrackPublishedResponse,
	dataChannels []*livekit.DataChannelInfo,
	dataChannelReceiveState []*livekit.DataChannelReceiveState,
)

func (*ParticipantImpl) SetMigrateState

func (p *ParticipantImpl) SetMigrateState(s types.MigrateState)

func (*ParticipantImpl) SetName

func (p *ParticipantImpl) SetName(name string)

SetName attaches name to the participant

func (*ParticipantImpl) SetPermission

func (p *ParticipantImpl) SetPermission(permission *livekit.ParticipantPermission) bool

func (*ParticipantImpl) SetResponseSink

func (p *ParticipantImpl) SetResponseSink(sink routing.MessageSink)

func (*ParticipantImpl) SetTrackMuted

func (p *ParticipantImpl) SetTrackMuted(mute *livekit.MuteTrackRequest, fromAdmin bool) *livekit.TrackInfo

func (*ParticipantImpl) State

func (*ParticipantImpl) SupportsCodecChange

func (p *ParticipantImpl) SupportsCodecChange() bool

func (*ParticipantImpl) SupportsMoving

func (p *ParticipantImpl) SupportsMoving() error

func (*ParticipantImpl) SupportsSyncStreamID

func (p *ParticipantImpl) SupportsSyncStreamID() bool

func (*ParticipantImpl) SupportsTransceiverReuse

func (p *ParticipantImpl) SupportsTransceiverReuse() bool

func (*ParticipantImpl) TelemetryGuard

func (p *ParticipantImpl) TelemetryGuard() *telemetry.ReferenceGuard

func (*ParticipantImpl) ToProto

func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo

func (*ParticipantImpl) ToProtoWithVersion

func (p *ParticipantImpl) ToProtoWithVersion() (*livekit.ParticipantInfo, utils.TimedVersion)

func (*ParticipantImpl) UncacheDownTrack

func (p *ParticipantImpl) UncacheDownTrack(rtpTransceiver *webrtc.RTPTransceiver)

func (*ParticipantImpl) UpdateAudioTrack

func (p *ParticipantImpl) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack) error

func (*ParticipantImpl) UpdateMediaLoss

func (p *ParticipantImpl) UpdateMediaLoss(nodeID livekit.NodeID, trackID livekit.TrackID, fractionalLoss uint32) error

func (*ParticipantImpl) UpdateMediaRTT

func (p *ParticipantImpl) UpdateMediaRTT(rtt uint32)

func (*ParticipantImpl) UpdateMetadata

func (p *ParticipantImpl) UpdateMetadata(update *livekit.UpdateParticipantMetadata, fromAdmin bool) error

func (*ParticipantImpl) UpdateSubscribedAudioCodecs

func (p *ParticipantImpl) UpdateSubscribedAudioCodecs(nodeID livekit.NodeID, trackID livekit.TrackID, codecs []*livekit.SubscribedAudioCodec) error

func (*ParticipantImpl) UpdateSubscribedQuality

func (p *ParticipantImpl) UpdateSubscribedQuality(nodeID livekit.NodeID, trackID livekit.TrackID, maxQualities []types.SubscribedCodecQuality) error

func (*ParticipantImpl) UpdateVideoTrack

func (p *ParticipantImpl) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack) error

func (*ParticipantImpl) Verify

func (p *ParticipantImpl) Verify() bool

func (*ParticipantImpl) VerifySubscribeParticipantInfo

func (p *ParticipantImpl) VerifySubscribeParticipantInfo(pID livekit.ParticipantID, version uint32)

func (*ParticipantImpl) Version

func (p *ParticipantImpl) Version() utils.TimedVersion

type ParticipantOptions

type ParticipantOptions struct {
	AutoSubscribe bool
}

type ParticipantParams

type ParticipantParams struct {
	Identity                livekit.ParticipantIdentity
	Name                    livekit.ParticipantName
	SID                     livekit.ParticipantID
	Config                  *WebRTCConfig
	Sink                    routing.MessageSink
	AudioConfig             sfu.AudioConfig
	VideoConfig             config.VideoConfig
	LimitConfig             config.LimitConfig
	ProtocolVersion         types.ProtocolVersion
	SessionStartTime        time.Time
	Telemetry               telemetry.TelemetryService
	Trailer                 []byte
	PLIThrottleConfig       sfu.PLIThrottleConfig
	CongestionControlConfig config.CongestionControlConfig
	// codecs that are enabled for this room
	PublishEnabledCodecs           []*livekit.Codec
	SubscribeEnabledCodecs         []*livekit.Codec
	Logger                         logger.Logger
	LoggerResolver                 logger.DeferredFieldResolver
	Reporter                       roomobs.ParticipantSessionReporter
	ReporterResolver               roomobs.ParticipantReporterResolver
	SimTracks                      map[uint32]SimulcastTrackInfo
	Grants                         *auth.ClaimGrants
	InitialVersion                 uint32
	ClientConf                     *livekit.ClientConfiguration
	ClientInfo                     ClientInfo
	Region                         string
	Migration                      bool
	Reconnect                      bool
	AdaptiveStream                 bool
	AllowTCPFallback               bool
	TCPFallbackRTTThreshold        int
	AllowUDPUnstableFallback       bool
	TURNSEnabled                   bool
	ParticipantHelper              types.LocalParticipantHelper
	DisableSupervisor              bool
	ReconnectOnPublicationError    bool
	ReconnectOnSubscriptionError   bool
	ReconnectOnDataChannelError    bool
	VersionGenerator               utils.TimedVersionGenerator
	DisableDynacast                bool
	SubscriberAllowPause           bool
	SubscriptionLimitAudio         int32
	SubscriptionLimitVideo         int32
	PlayoutDelay                   *livekit.PlayoutDelay
	SyncStreams                    bool
	ForwardStats                   *sfu.ForwardStats
	DisableSenderReportPassThrough bool
	MetricConfig                   metric.MetricConfig
	UseOneShotSignallingMode       bool
	EnableMetrics                  bool
	DataChannelMaxBufferedAmount   uint64
	DatachannelSlowThreshold       int
	FireOnTrackBySdp               bool
	DisableCodecRegression         bool
	LastPubReliableSeq             uint32
	Country                        string
	PreferVideoSizeFromMedia       bool
	UseSinglePeerConnection        bool
}

type ParticipantUpdate

type ParticipantUpdate struct {
	ParticipantInfo         *livekit.ParticipantInfo
	IsSynthesizedDisconnect bool
	CloseReason             types.ParticipantCloseReason
}

func PushAndDequeueUpdates

func PushAndDequeueUpdates(
	pi *livekit.ParticipantInfo,
	closeReason types.ParticipantCloseReason,
	isImmediate bool,
	existingParticipant types.Participant,
	cache map[livekit.ParticipantIdentity]*ParticipantUpdate,
) []*ParticipantUpdate

push a participant update for batched broadcast, optionally returning immediate updates to broadcast. it handles the following scenarios * subscriber-only updates will be queued for batch updates * publisher & immediate updates will be returned without queuing * when the SID changes, it will return both updates, with the earlier participant set to disconnected

type PrimaryTransportHandler

type PrimaryTransportHandler struct {
	transport.Handler
	// contains filtered or unexported fields
}

func (PrimaryTransportHandler) OnFullyEstablished

func (h PrimaryTransportHandler) OnFullyEstablished()

func (PrimaryTransportHandler) OnInitialConnected

func (h PrimaryTransportHandler) OnInitialConnected()

type PublisherTransportHandler

type PublisherTransportHandler struct {
	AnyTransportHandler
}

func (PublisherTransportHandler) OnAnswer

func (h PublisherTransportHandler) OnAnswer(sd webrtc.SessionDescription, answerId uint32, midToTrackID map[string]string) error

func (PublisherTransportHandler) OnDataMessage

func (h PublisherTransportHandler) OnDataMessage(kind livekit.DataPacket_Kind, data []byte)

func (PublisherTransportHandler) OnDataMessageUnlabeled

func (h PublisherTransportHandler) OnDataMessageUnlabeled(data []byte)

func (PublisherTransportHandler) OnDataSendError

func (h PublisherTransportHandler) OnDataSendError(err error)

func (PublisherTransportHandler) OnInitialConnected

func (h PublisherTransportHandler) OnInitialConnected()

func (PublisherTransportHandler) OnSetRemoteDescriptionOffer

func (h PublisherTransportHandler) OnSetRemoteDescriptionOffer()

func (PublisherTransportHandler) OnTrack

func (h PublisherTransportHandler) OnTrack(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver)

func (PublisherTransportHandler) OnUnmatchedMedia

func (h PublisherTransportHandler) OnUnmatchedMedia(numAudios uint32, numVideos uint32) error

type RTCPFeedbackConfig

type RTCPFeedbackConfig struct {
	Audio []webrtc.RTCPFeedback
	Video []webrtc.RTCPFeedback
}

type RTPHeaderExtensionConfig

type RTPHeaderExtensionConfig struct {
	Audio []string
	Video []string
}

type ReceiverConfig

type ReceiverConfig struct {
	PacketBufferSizeVideo int
	PacketBufferSizeAudio int
}

type Room

type Room struct {
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(
	room *livekit.Room,
	internal *livekit.RoomInternal,
	config WebRTCConfig,
	roomConfig config.RoomConfig,
	audioConfig *sfu.AudioConfig,
	serverInfo *livekit.ServerInfo,
	telemetry telemetry.TelemetryService,
	agentClient agent.Client,
	agentStore AgentStore,
	egressLauncher EgressLauncher,
) *Room

func (*Room) AddAgentDispatch

func (r *Room) AddAgentDispatch(dispatch *livekit.AgentDispatch) (*livekit.AgentDispatch, error)

func (*Room) Close

func (r *Room) Close(reason types.ParticipantCloseReason)

func (*Room) CloseIfEmpty

func (r *Room) CloseIfEmpty()

CloseIfEmpty closes the room if all participants had left, or it's still empty past timeout

func (*Room) DebugInfo

func (r *Room) DebugInfo() map[string]interface{}

func (*Room) DeleteAgentDispatch

func (r *Room) DeleteAgentDispatch(dispatchID string) (*livekit.AgentDispatch, error)

func (*Room) FirstJoinedAt

func (r *Room) FirstJoinedAt() int64

func (*Room) GetActiveSpeakers

func (r *Room) GetActiveSpeakers() []*livekit.SpeakerInfo

func (*Room) GetAgentDispatches

func (r *Room) GetAgentDispatches(dispatchID string) ([]*livekit.AgentDispatch, error)

func (*Room) GetBufferFactory

func (r *Room) GetBufferFactory() *buffer.Factory

func (*Room) GetCachedReliableDataMessage

func (r *Room) GetCachedReliableDataMessage(seqs map[livekit.ParticipantID]uint32) []*types.DataMessageCache

func (*Room) GetLocalParticipants

func (r *Room) GetLocalParticipants() []types.LocalParticipant

func (*Room) GetParticipant

func (r *Room) GetParticipant(identity livekit.ParticipantIdentity) types.LocalParticipant

func (*Room) GetParticipantByID

func (r *Room) GetParticipantByID(participantID livekit.ParticipantID) types.LocalParticipant

func (*Room) GetParticipantCount

func (r *Room) GetParticipantCount() int

func (*Room) GetParticipantRequestSource

func (r *Room) GetParticipantRequestSource(identity livekit.ParticipantIdentity) routing.MessageSource

func (*Room) GetParticipants

func (r *Room) GetParticipants() []types.LocalParticipant

func (*Room) HandleSyncState

func (r *Room) HandleSyncState(participant types.LocalParticipant, state *livekit.SyncState) error

func (*Room) Hold

func (r *Room) Hold() bool

func (*Room) ID

func (r *Room) ID() livekit.RoomID

func (*Room) Internal

func (r *Room) Internal() *livekit.RoomInternal

func (*Room) IsClosed

func (r *Room) IsClosed() bool

func (*Room) IsDataMessageUserPacketDuplicate

func (r *Room) IsDataMessageUserPacketDuplicate(up *livekit.UserPacket) bool

func (*Room) Join

func (r *Room) Join(
	participant types.LocalParticipant,
	requestSource routing.MessageSource,
	opts *ParticipantOptions,
	iceServers []*livekit.ICEServer,
) error

func (*Room) LastLeftAt

func (r *Room) LastLeftAt() int64

func (*Room) Logger

func (r *Room) Logger() logger.Logger

func (*Room) Name

func (r *Room) Name() livekit.RoomName

func (*Room) OnClose

func (r *Room) OnClose(f func())

func (*Room) OnParticipantChanged

func (r *Room) OnParticipantChanged(f func(participant types.LocalParticipant))

func (*Room) OnRoomUpdated

func (r *Room) OnRoomUpdated(f func())

func (*Room) Release

func (r *Room) Release()

func (*Room) RemoveParticipant

func (r *Room) RemoveParticipant(
	identity livekit.ParticipantIdentity,
	pID livekit.ParticipantID,
	reason types.ParticipantCloseReason,
)

func (*Room) ReplaceParticipantRequestSource

func (r *Room) ReplaceParticipantRequestSource(identity livekit.ParticipantIdentity, reqSource routing.MessageSource)

func (*Room) ResolveMediaTrackForSubscriber

func (r *Room) ResolveMediaTrackForSubscriber(sub types.LocalParticipant, trackID livekit.TrackID) types.MediaResolverResult

func (*Room) ResumeParticipant

func (r *Room) ResumeParticipant(
	p types.LocalParticipant,
	requestSource routing.MessageSource,
	responseSink routing.MessageSink,
	iceConfig *livekit.ICEConfig,
	iceServers []*livekit.ICEServer,
	reason livekit.ReconnectReason,
) error

func (*Room) SendDataPacket

func (r *Room) SendDataPacket(dp *livekit.DataPacket, kind livekit.DataPacket_Kind)

func (*Room) SetMetadata

func (r *Room) SetMetadata(metadata string) <-chan struct{}

func (*Room) ToProto

func (r *Room) ToProto() *livekit.Room

func (*Room) Trailer

func (r *Room) Trailer() []byte

func (*Room) UpdateProto added in v1.9.12

func (r *Room) UpdateProto() *livekit.Room

func (*Room) UpdateSubscriptions

func (r *Room) UpdateSubscriptions(
	participant types.LocalParticipant,
	trackIDs []livekit.TrackID,
	participantTracks []*livekit.ParticipantTracks,
	subscribe bool,
)

type RoomTrackManager

type RoomTrackManager struct {
	// contains filtered or unexported fields
}

RoomTrackManager holds tracks that are published to the room

func NewRoomTrackManager

func NewRoomTrackManager() *RoomTrackManager

func (*RoomTrackManager) AddTrack

func (r *RoomTrackManager) AddTrack(track types.MediaTrack, publisherIdentity livekit.ParticipantIdentity, publisherID livekit.ParticipantID)

func (*RoomTrackManager) GetOrCreateTrackChangeNotifier

func (r *RoomTrackManager) GetOrCreateTrackChangeNotifier(trackID livekit.TrackID) *utils.ChangeNotifier

func (*RoomTrackManager) GetOrCreateTrackRemoveNotifier

func (r *RoomTrackManager) GetOrCreateTrackRemoveNotifier(trackID livekit.TrackID) *utils.ChangeNotifier

func (*RoomTrackManager) GetTrackInfo

func (r *RoomTrackManager) GetTrackInfo(trackID livekit.TrackID) *TrackInfo

func (*RoomTrackManager) HasObservers

func (r *RoomTrackManager) HasObservers(track types.MediaTrack) bool

HasObservers lets caller know if the current media track has any observers this is used to signal interest in the track. when another MediaTrack with the same trackID is being used, track is not considered to be observed.

func (*RoomTrackManager) NotifyTrackChanged

func (r *RoomTrackManager) NotifyTrackChanged(trackID livekit.TrackID)

func (*RoomTrackManager) RemoveTrack

func (r *RoomTrackManager) RemoveTrack(track types.MediaTrack)

type SimulcastTrackInfo

type SimulcastTrackInfo struct {
	Mid string
	Rid string
}

type SubscribedTrack

type SubscribedTrack struct {
	// contains filtered or unexported fields
}

func NewSubscribedTrack

func NewSubscribedTrack(params SubscribedTrackParams) (*SubscribedTrack, error)

func (*SubscribedTrack) AddOnBind

func (t *SubscribedTrack) AddOnBind(f func(error))

func (*SubscribedTrack) Bound

func (t *SubscribedTrack) Bound(err error)

for DownTrack callback to notify us that it's bound

func (*SubscribedTrack) Close

func (t *SubscribedTrack) Close(isExpectedToResume bool)

for DownTrack callback to notify us that it's closed

func (*SubscribedTrack) DownTrack

func (t *SubscribedTrack) DownTrack() *sfu.DownTrack

func (*SubscribedTrack) ID

func (*SubscribedTrack) IsBound

func (t *SubscribedTrack) IsBound() bool

func (*SubscribedTrack) IsMuted

func (t *SubscribedTrack) IsMuted() bool

has subscriber indicated it wants to mute this track

func (*SubscribedTrack) MediaTrack

func (t *SubscribedTrack) MediaTrack() types.MediaTrack

func (*SubscribedTrack) NeedsNegotiation

func (t *SubscribedTrack) NeedsNegotiation() bool

func (*SubscribedTrack) OnBindAndConnected

func (t *SubscribedTrack) OnBindAndConnected()

func (*SubscribedTrack) OnClose

func (t *SubscribedTrack) OnClose(f func(bool))

func (*SubscribedTrack) OnCodecNegotiated

func (t *SubscribedTrack) OnCodecNegotiated(codec webrtc.RTPCodecCapability)

func (*SubscribedTrack) OnDownTrackClose

func (t *SubscribedTrack) OnDownTrackClose(isExpectedToResume bool)

func (*SubscribedTrack) OnMaxSubscribedLayerChanged

func (t *SubscribedTrack) OnMaxSubscribedLayerChanged(layer int32)

func (*SubscribedTrack) OnRttUpdate

func (t *SubscribedTrack) OnRttUpdate(rtt uint32)

func (*SubscribedTrack) OnStatsUpdate

func (t *SubscribedTrack) OnStatsUpdate(stat *livekit.AnalyticsStat)

func (*SubscribedTrack) PublisherID

func (t *SubscribedTrack) PublisherID() livekit.ParticipantID

func (*SubscribedTrack) PublisherIdentity

func (t *SubscribedTrack) PublisherIdentity() livekit.ParticipantIdentity

func (*SubscribedTrack) PublisherVersion

func (t *SubscribedTrack) PublisherVersion() uint32

func (*SubscribedTrack) RTPSender

func (t *SubscribedTrack) RTPSender() *webrtc.RTPSender

func (*SubscribedTrack) SetNeedsNegotiation

func (t *SubscribedTrack) SetNeedsNegotiation(needs bool)

func (*SubscribedTrack) SetPublisherMuted

func (t *SubscribedTrack) SetPublisherMuted(muted bool)

func (*SubscribedTrack) SetRTPSender

func (t *SubscribedTrack) SetRTPSender(sender *webrtc.RTPSender)

func (*SubscribedTrack) Subscriber

func (t *SubscribedTrack) Subscriber() types.LocalParticipant

func (*SubscribedTrack) SubscriberID

func (t *SubscribedTrack) SubscriberID() livekit.ParticipantID

func (*SubscribedTrack) SubscriberIdentity

func (t *SubscribedTrack) SubscriberIdentity() livekit.ParticipantIdentity

func (*SubscribedTrack) UpdateSubscriberSettings

func (t *SubscribedTrack) UpdateSubscriberSettings(settings *livekit.UpdateTrackSettings, isImmediate bool)

func (*SubscribedTrack) UpdateVideoLayer

func (t *SubscribedTrack) UpdateVideoLayer()

type SubscribedTrackParams

type SubscribedTrackParams struct {
	ReceiverConfig               ReceiverConfig
	SubscriberConfig             DirectionConfig
	Subscriber                   types.LocalParticipant
	MediaTrack                   types.MediaTrack
	AdaptiveStream               bool
	Telemetry                    telemetry.TelemetryService
	WrappedReceiver              *WrappedReceiver
	IsRelayed                    bool
	OnDownTrackCreated           func(downTrack *sfu.DownTrack)
	OnDownTrackClosed            func(subscriberID livekit.ParticipantID)
	OnSubscriberMaxQualityChange func(subscriberID livekit.ParticipantID, mime mime.MimeType, layer int32)
	OnSubscriberAudioCodecChange func(subscriberID livekit.ParticipantID, mime mime.MimeType, enabled bool)
}

type SubscriberTransportHandler

type SubscriberTransportHandler struct {
	AnyTransportHandler
}

func (SubscriberTransportHandler) OnDataSendError

func (h SubscriberTransportHandler) OnDataSendError(err error)

func (SubscriberTransportHandler) OnInitialConnected

func (h SubscriberTransportHandler) OnInitialConnected()

func (SubscriberTransportHandler) OnOffer

func (h SubscriberTransportHandler) OnOffer(sd webrtc.SessionDescription, offerId uint32, midToTrackID map[string]string) error

func (SubscriberTransportHandler) OnStreamStateChange

func (h SubscriberTransportHandler) OnStreamStateChange(update *streamallocator.StreamStateUpdate) error

type SubscriptionManager

type SubscriptionManager struct {
	// contains filtered or unexported fields
}

SubscriptionManager manages a participant's subscriptions

func NewSubscriptionManager

func NewSubscriptionManager(params SubscriptionManagerParams) *SubscriptionManager

func (*SubscriptionManager) ClearAllSubscriptions

func (m *SubscriptionManager) ClearAllSubscriptions()

func (*SubscriptionManager) Close

func (m *SubscriptionManager) Close(isExpectedToResume bool)

func (*SubscriptionManager) GetSubscribedParticipants

func (m *SubscriptionManager) GetSubscribedParticipants() []livekit.ParticipantID

func (*SubscriptionManager) GetSubscribedTracks

func (m *SubscriptionManager) GetSubscribedTracks() []types.SubscribedTrack

func (*SubscriptionManager) HasSubscriptions

func (m *SubscriptionManager) HasSubscriptions() bool

func (*SubscriptionManager) IsSubscribedTo

func (m *SubscriptionManager) IsSubscribedTo(participantID livekit.ParticipantID) bool

func (*SubscriptionManager) IsTrackNameSubscribed

func (m *SubscriptionManager) IsTrackNameSubscribed(publisherIdentity livekit.ParticipantIdentity, trackName string) bool

func (*SubscriptionManager) OnSubscribeStatusChanged

func (m *SubscriptionManager) OnSubscribeStatusChanged(fn func(publisherID livekit.ParticipantID, subscribed bool))

OnSubscribeStatusChanged callback will be notified when a participant subscribes or unsubscribes to another participant it will only fire once per publisher. If current participant is subscribed to multiple tracks from another, this callback will only fire once.

func (*SubscriptionManager) ReconcileAll

func (m *SubscriptionManager) ReconcileAll()

func (*SubscriptionManager) StopAndGetSubscribedTracksForwarderState

func (m *SubscriptionManager) StopAndGetSubscribedTracksForwarderState() map[livekit.TrackID]*livekit.RTPForwarderState

func (*SubscriptionManager) SubscribeToTrack

func (m *SubscriptionManager) SubscribeToTrack(trackID livekit.TrackID, isSync bool)

func (*SubscriptionManager) UnsubscribeFromTrack

func (m *SubscriptionManager) UnsubscribeFromTrack(trackID livekit.TrackID)

func (*SubscriptionManager) UpdateSubscribedTrackSettings

func (m *SubscriptionManager) UpdateSubscribedTrackSettings(trackID livekit.TrackID, settings *livekit.UpdateTrackSettings)

func (*SubscriptionManager) WaitUntilSubscribed

func (m *SubscriptionManager) WaitUntilSubscribed(timeout time.Duration) error

type SubscriptionManagerParams

type SubscriptionManagerParams struct {
	Logger              logger.Logger
	Participant         types.LocalParticipant
	TrackResolver       types.MediaTrackResolver
	OnTrackSubscribed   func(subTrack types.SubscribedTrack)
	OnTrackUnsubscribed func(subTrack types.SubscribedTrack)
	OnSubscriptionError func(trackID livekit.TrackID, fatal bool, err error)
	Telemetry           telemetry.TelemetryService

	SubscriptionLimitVideo, SubscriptionLimitAudio int32

	UseOneShotSignallingMode bool
}

type TrackInfo

type TrackInfo struct {
	Track             types.MediaTrack
	PublisherIdentity livekit.ParticipantIdentity
	PublisherID       livekit.ParticipantID
}

type TransportManager

type TransportManager struct {
	// contains filtered or unexported fields
}

func NewTransportManager

func NewTransportManager(params TransportManagerParams) (*TransportManager, error)

func (*TransportManager) AddICECandidate

func (t *TransportManager) AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget)

AddICECandidate adds candidates for remote peer

func (*TransportManager) AddSubscribedTrack

func (t *TransportManager) AddSubscribedTrack(subTrack types.SubscribedTrack)

func (*TransportManager) AddTrackLocal

func (t *TransportManager) AddTrackLocal(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
	enabledCodecs []*livekit.Codec,
	rtcpFeedbackConfig RTCPFeedbackConfig,
) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*TransportManager) AddTransceiverFromTrackLocal

func (t *TransportManager) AddTransceiverFromTrackLocal(
	trackLocal webrtc.TrackLocal,
	params types.AddTrackParams,
	enabledCodecs []*livekit.Codec,
	rtcpFeedbackConfig RTCPFeedbackConfig,
) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*TransportManager) Close

func (t *TransportManager) Close()

func (*TransportManager) GetAnswer

func (*TransportManager) GetICEConfig

func (t *TransportManager) GetICEConfig() *livekit.ICEConfig

func (*TransportManager) GetICEConnectionInfo

func (t *TransportManager) GetICEConnectionInfo() []*types.ICEConnectionInfo

func (*TransportManager) GetPublisherICESessionUfrag

func (t *TransportManager) GetPublisherICESessionUfrag() (string, error)

func (*TransportManager) GetPublisherMid

func (t *TransportManager) GetPublisherMid(rtpReceiver *webrtc.RTPReceiver) string

func (*TransportManager) GetPublisherRTPReceiver

func (t *TransportManager) GetPublisherRTPReceiver(mid string) *webrtc.RTPReceiver

func (*TransportManager) GetPublisherRTPTransceiver

func (t *TransportManager) GetPublisherRTPTransceiver(mid string) *webrtc.RTPTransceiver

func (*TransportManager) GetPublisherRTT

func (t *TransportManager) GetPublisherRTT() (float64, bool)

func (*TransportManager) GetSubscriberPacer

func (t *TransportManager) GetSubscriberPacer() pacer.Pacer

func (*TransportManager) GetSubscriberRTT

func (t *TransportManager) GetSubscriberRTT() (float64, bool)

func (*TransportManager) GetUnmatchMediaForOffer

func (t *TransportManager) GetUnmatchMediaForOffer(parsedOffer *sdp.SessionDescription, mediaType string) (unmatched []*sdp.MediaDescription, err error)

func (*TransportManager) HandleAnswer

func (t *TransportManager) HandleAnswer(answer webrtc.SessionDescription, answerId uint32)

func (*TransportManager) HandleClientReconnect

func (t *TransportManager) HandleClientReconnect(reason livekit.ReconnectReason)

func (*TransportManager) HandleICERestartSDPFragment

func (t *TransportManager) HandleICERestartSDPFragment(sdpFragment string) (string, error)

func (*TransportManager) HandleICETrickleSDPFragment

func (t *TransportManager) HandleICETrickleSDPFragment(sdpFragment string) error

func (*TransportManager) HandleOffer

func (t *TransportManager) HandleOffer(offer webrtc.SessionDescription, offerId uint32, shouldPend bool) error

func (*TransportManager) HandleReceiverReport

func (t *TransportManager) HandleReceiverReport(dt *sfu.DownTrack, report *rtcp.ReceiverReport)

func (*TransportManager) HasPublisherEverConnected

func (t *TransportManager) HasPublisherEverConnected() bool

func (*TransportManager) HasSubscriberEverConnected

func (t *TransportManager) HasSubscriberEverConnected() bool

func (*TransportManager) ICERestart

func (t *TransportManager) ICERestart(iceConfig *livekit.ICEConfig) error

func (*TransportManager) IsPublisherEstablished

func (t *TransportManager) IsPublisherEstablished() bool

func (*TransportManager) LastPublisherOffer

func (t *TransportManager) LastPublisherOffer() *webrtc.SessionDescription

func (*TransportManager) LastPublisherOfferPending

func (t *TransportManager) LastPublisherOfferPending() *webrtc.SessionDescription

func (*TransportManager) LastSeenSignalAt

func (t *TransportManager) LastSeenSignalAt() time.Time

func (*TransportManager) NegotiateSubscriber

func (t *TransportManager) NegotiateSubscriber(force bool)

func (*TransportManager) OnICEConfigChanged

func (t *TransportManager) OnICEConfigChanged(f func(iceConfig *livekit.ICEConfig))

func (*TransportManager) ProcessPendingPublisherDataChannels

func (t *TransportManager) ProcessPendingPublisherDataChannels()

func (*TransportManager) ProcessPendingPublisherOffer

func (t *TransportManager) ProcessPendingPublisherOffer()

func (*TransportManager) RemoveSubscribedTrack

func (t *TransportManager) RemoveSubscribedTrack(subTrack types.SubscribedTrack)

func (*TransportManager) RemoveTrackLocal

func (t *TransportManager) RemoveTrackLocal(sender *webrtc.RTPSender) error

func (*TransportManager) SendDataMessage

func (t *TransportManager) SendDataMessage(kind livekit.DataPacket_Kind, data []byte) error

func (*TransportManager) SendDataMessageUnlabeled

func (t *TransportManager) SendDataMessageUnlabeled(data []byte, useRaw bool, sender livekit.ParticipantIdentity) error

func (*TransportManager) SetICEConfig

func (t *TransportManager) SetICEConfig(iceConfig *livekit.ICEConfig)

func (*TransportManager) SetMigrateInfo

func (t *TransportManager) SetMigrateInfo(
	previousOffer *webrtc.SessionDescription,
	previousAnswer *webrtc.SessionDescription,
	dataChannels []*livekit.DataChannelInfo,
)

func (*TransportManager) SetSignalSourceValid

func (t *TransportManager) SetSignalSourceValid(valid bool)

func (*TransportManager) SetSubscriberAllowPause

func (t *TransportManager) SetSubscriberAllowPause(allowPause bool)

func (*TransportManager) SetSubscriberChannelCapacity

func (t *TransportManager) SetSubscriberChannelCapacity(channelCapacity int64)

func (*TransportManager) SinceLastSignal

func (t *TransportManager) SinceLastSignal() time.Duration

func (*TransportManager) SubscriberAsPrimary

func (t *TransportManager) SubscriberAsPrimary() bool

func (*TransportManager) SubscriberClose

func (t *TransportManager) SubscriberClose()

func (*TransportManager) UpdateLastSeenSignal

func (t *TransportManager) UpdateLastSeenSignal()

func (*TransportManager) UpdateMediaRTT

func (t *TransportManager) UpdateMediaRTT(rtt uint32)

func (*TransportManager) UpdateSignalingRTT

func (t *TransportManager) UpdateSignalingRTT(rtt uint32)

func (*TransportManager) WritePublisherRTCP

func (t *TransportManager) WritePublisherRTCP(pkts []rtcp.Packet) error

func (*TransportManager) WriteSubscriberRTCP

func (t *TransportManager) WriteSubscriberRTCP(pkts []rtcp.Packet) error

type TransportManagerParams

type TransportManagerParams struct {
	SubscriberAsPrimary          bool
	UseSinglePeerConnection      bool
	Config                       *WebRTCConfig
	Twcc                         *twcc.Responder
	ProtocolVersion              types.ProtocolVersion
	CongestionControlConfig      config.CongestionControlConfig
	EnabledSubscribeCodecs       []*livekit.Codec
	EnabledPublishCodecs         []*livekit.Codec
	SimTracks                    map[uint32]SimulcastTrackInfo
	ClientInfo                   ClientInfo
	Migration                    bool
	AllowTCPFallback             bool
	TCPFallbackRTTThreshold      int
	AllowUDPUnstableFallback     bool
	TURNSEnabled                 bool
	AllowPlayoutDelay            bool
	DataChannelMaxBufferedAmount uint64
	DatachannelSlowThreshold     int
	Logger                       logger.Logger
	PublisherHandler             transport.Handler
	SubscriberHandler            transport.Handler
	DataChannelStats             *telemetry.BytesTrackStats
	UseOneShotSignallingMode     bool
	FireOnTrackBySdp             bool
}

type TransportManagerTransportHandler

type TransportManagerTransportHandler struct {
	transport.Handler
	// contains filtered or unexported fields
}

func (TransportManagerTransportHandler) OnFailed

func (h TransportManagerTransportHandler) OnFailed(isShortLived bool, iceConnectionInfo *types.ICEConnectionInfo)

type TransportParams

type TransportParams struct {
	Handler                      transport.Handler
	ProtocolVersion              types.ProtocolVersion
	Config                       *WebRTCConfig
	Twcc                         *lktwcc.Responder
	DirectionConfig              DirectionConfig
	CongestionControlConfig      config.CongestionControlConfig
	EnabledCodecs                []*livekit.Codec
	Logger                       logger.Logger
	Transport                    livekit.SignalTarget
	SimTracks                    map[uint32]SimulcastTrackInfo
	ClientInfo                   ClientInfo
	IsOfferer                    bool
	IsSendSide                   bool
	AllowPlayoutDelay            bool
	UseOneShotSignallingMode     bool
	FireOnTrackBySdp             bool
	DataChannelMaxBufferedAmount uint64
	DatachannelSlowThreshold     int

	// for development test
	DatachannelMaxReceiverBufferSize int
}

type UnhandleSimulcastInterceptor

type UnhandleSimulcastInterceptor struct {
	interceptor.NoOp
	// contains filtered or unexported fields
}

func (*UnhandleSimulcastInterceptor) BindRemoteStream

type UnhandleSimulcastInterceptorFactory

type UnhandleSimulcastInterceptorFactory struct {
	// contains filtered or unexported fields
}

func (*UnhandleSimulcastInterceptorFactory) NewInterceptor

type UnhandleSimulcastOption

type UnhandleSimulcastOption func(r *UnhandleSimulcastInterceptor) error

func UnhandleSimulcastTracks

func UnhandleSimulcastTracks(tracks map[uint32]SimulcastTrackInfo) UnhandleSimulcastOption

type UpTrackManager

type UpTrackManager struct {
	// contains filtered or unexported fields
}

UpTrackManager manages all uptracks from a participant

func NewUpTrackManager

func NewUpTrackManager(params UpTrackManagerParams) *UpTrackManager

func (*UpTrackManager) AddPublishedTrack

func (u *UpTrackManager) AddPublishedTrack(track types.MediaTrack)

func (*UpTrackManager) Close

func (u *UpTrackManager) Close(isExpectedToResume bool)

func (*UpTrackManager) DebugInfo

func (u *UpTrackManager) DebugInfo() map[string]interface{}

func (*UpTrackManager) GetAudioLevel

func (u *UpTrackManager) GetAudioLevel() (level float64, active bool)

func (*UpTrackManager) GetPublishedTrack

func (u *UpTrackManager) GetPublishedTrack(trackID livekit.TrackID) types.MediaTrack

func (*UpTrackManager) GetPublishedTracks

func (u *UpTrackManager) GetPublishedTracks() []types.MediaTrack

func (*UpTrackManager) HasPermission

func (u *UpTrackManager) HasPermission(trackID livekit.TrackID, subIdentity livekit.ParticipantIdentity) bool

func (*UpTrackManager) OnPublishedTrackUpdated

func (u *UpTrackManager) OnPublishedTrackUpdated(f func(track types.MediaTrack))

func (*UpTrackManager) OnUpTrackManagerClose

func (u *UpTrackManager) OnUpTrackManagerClose(f func())

func (*UpTrackManager) RemovePublishedTrack

func (u *UpTrackManager) RemovePublishedTrack(track types.MediaTrack, isExpectedToResume bool)

func (*UpTrackManager) SetPublishedTrackMuted

func (u *UpTrackManager) SetPublishedTrackMuted(trackID livekit.TrackID, muted bool) (types.MediaTrack, bool)

func (*UpTrackManager) SubscriptionPermission

func (u *UpTrackManager) SubscriptionPermission() (*livekit.SubscriptionPermission, utils.TimedVersion)

func (*UpTrackManager) ToProto

func (u *UpTrackManager) ToProto() []*livekit.TrackInfo

func (*UpTrackManager) UpdatePublishedAudioTrack

func (u *UpTrackManager) UpdatePublishedAudioTrack(update *livekit.UpdateLocalAudioTrack) types.MediaTrack

func (*UpTrackManager) UpdatePublishedVideoTrack

func (u *UpTrackManager) UpdatePublishedVideoTrack(update *livekit.UpdateLocalVideoTrack) types.MediaTrack

func (*UpTrackManager) UpdateSubscriptionPermission

func (u *UpTrackManager) UpdateSubscriptionPermission(
	subscriptionPermission *livekit.SubscriptionPermission,
	timedVersion utils.TimedVersion,
	resolverBySid func(participantID livekit.ParticipantID) types.LocalParticipant,
) error

type UpTrackManagerParams

type UpTrackManagerParams struct {
	Logger           logger.Logger
	VersionGenerator utils.TimedVersionGenerator
}

type UserPacketDeduper

type UserPacketDeduper struct {
	// contains filtered or unexported fields
}

func NewUserPacketDeduper

func NewUserPacketDeduper() *UserPacketDeduper

func (*UserPacketDeduper) IsDuplicate

func (u *UserPacketDeduper) IsDuplicate(up *livekit.UserPacket) bool

type WebRTCConfig

type WebRTCConfig struct {
	rtcconfig.WebRTCConfig

	BufferFactory *buffer.Factory
	Receiver      ReceiverConfig
	Publisher     DirectionConfig
	Subscriber    DirectionConfig
}

func NewWebRTCConfig

func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error)

func (*WebRTCConfig) SetBufferFactory

func (c *WebRTCConfig) SetBufferFactory(factory *buffer.Factory)

func (*WebRTCConfig) UpdatePublisherConfig

func (c *WebRTCConfig) UpdatePublisherConfig(consolidated bool)

func (*WebRTCConfig) UpdateSubscriberConfig

func (c *WebRTCConfig) UpdateSubscriberConfig(ccConf config.CongestionControlConfig)

type WrappedReceiver

type WrappedReceiver struct {
	sfu.TrackReceiver
	// contains filtered or unexported fields
}

func NewWrappedReceiver

func NewWrappedReceiver(params WrappedReceiverParams) *WrappedReceiver

func (*WrappedReceiver) AddOnReady

func (r *WrappedReceiver) AddOnReady(f func())

func (*WrappedReceiver) Codecs

func (*WrappedReceiver) DeleteDownTrack

func (r *WrappedReceiver) DeleteDownTrack(participantID livekit.ParticipantID)

func (*WrappedReceiver) DetermineReceiver

func (r *WrappedReceiver) DetermineReceiver(codec webrtc.RTPCodecCapability) (isAvailable bool, needsPublish bool)

DetermineReceiver determines the receiver of negotiated codec and returns

isAvailable: returns true if given codec is a potential codec from publisher or if an existing published codec can be translated needsPublish: indicates if the codec is needed from publisher, some combinations can be achieved via codec translation internally,

example: unecrypted opus -> RED translation and vice-versa can be done without the need for publisher to send the other codec.

func (*WrappedReceiver) StreamID

func (r *WrappedReceiver) StreamID() string

func (*WrappedReceiver) TrackID

func (r *WrappedReceiver) TrackID() livekit.TrackID

type WrappedReceiverParams

type WrappedReceiverParams struct {
	Receivers      []*simulcastReceiver
	TrackID        livekit.TrackID
	StreamId       string
	UpstreamCodecs []webrtc.RTPCodecParameters
	Logger         logger.Logger
	DisableRed     bool
	IsEncrypted    bool
}

Directories

Path Synopsis
transportfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
typesfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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