rtc

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEmptyTimeout       = 5 * 60 // 5m
	DefaultRoomDepartureGrace = 20
	AudioLevelQuantization    = 8 // ideally power of 2 to minimize float decimal

)
View Source
const (
	LossyDataChannel    = "_lossy"
	ReliableDataChannel = "_reliable"
)

Variables

View Source
var (
	ErrRoomClosed              = errors.New("room has 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")
	ErrUnexpectedOffer         = errors.New("expected answer SDP, received offer")
	ErrDataChannelUnavailable  = errors.New("data channel is not available")
	ErrCannotSubscribe         = errors.New("participant does not have permission to subscribe")
	ErrEmptyIdentity           = errors.New("participant identity cannot be empty")
	ErrEmptyParticipantID      = errors.New("participant ID cannot be empty")
	ErrMissingGrants           = errors.New("VideoGrant is missing")
)
View Source
var (
	ErrNotOpen    = errors.New("track is not open")
	ErrNoReceiver = errors.New("cannot subscribe without a receiver in place")
)
View Source
var (
	ErrIceRestartWithoutLocalSDP = errors.New("ICE restart without local SDP settled")
	ErrNoTransceiver             = errors.New("no transceiver")
	ErrNoSender                  = errors.New("no sender")
	ErrNoICECandidateHandler     = errors.New("no ICE candidate handler")
	ErrNoOfferHandler            = errors.New("no offer handler")
	ErrNoAnswerHandler           = errors.New("no answer handler")
	ErrMidNotFound               = errors.New("mid not found")
)
View Source
var (
	ErrSubscriptionPermissionNeedsId = errors.New("either participant identity or SID needed")
)

Functions

func FromProtoSessionDescription

func FromProtoSessionDescription(sd *livekit.SessionDescription) webrtc.SessionDescription

func FromProtoTrickle

func FromProtoTrickle(trickle *livekit.TrickleRequest) (webrtc.ICECandidateInit, error)

func HandleParticipantSignal

func HandleParticipantSignal(room types.Room, participant types.LocalParticipant, req *livekit.SignalRequest, pLogger logger.Logger) error

func IPFilterFromConf

func IPFilterFromConf(ips config.IPsConfig) (func(ip net.IP) bool, error)

func InterfaceFilterFromConf

func InterfaceFilterFromConf(ifs config.InterfacesConfig) func(string) bool

func IsEOF

func IsEOF(err error) bool

func LoggerWithCodecMime

func LoggerWithCodecMime(l logger.Logger, mime string) 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 PackDataTrackLabel

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

func PackStreamID

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

func Recover

func Recover()

func RecoverSilent

func RecoverSilent()

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 ToProtoParticipants

func ToProtoParticipants(participants []types.LocalParticipant) []*livekit.ParticipantInfo

func ToProtoSessionDescription

func ToProtoSessionDescription(sd webrtc.SessionDescription) *livekit.SessionDescription

func ToProtoTrackKind

func ToProtoTrackKind(kind webrtc.RTPCodecType) livekit.TrackType

func ToProtoTrickle

func ToProtoTrickle(candidateInit webrtc.ICECandidateInit) *livekit.TrickleRequest

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 ClientInfo

type ClientInfo struct {
	*livekit.ClientInfo
}

func (ClientInfo) CompareVersion

func (c ClientInfo) CompareVersion(version string) int

CompareVersion compares two semver versions returning 1 if current version is greater than version 0 if they are the same, and -1 if it's an earlier version

func (ClientInfo) SupportsAudioRED

func (c ClientInfo) SupportsAudioRED() bool

func (ClientInfo) SupportsICETCP

func (c ClientInfo) SupportsICETCP() bool

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) Codec

func (d *DummyReceiver) Codec() webrtc.RTPCodecParameters

func (*DummyReceiver) DebugInfo

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

func (*DummyReceiver) DeleteDownTrack

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

func (*DummyReceiver) GetAudioLevel

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

func (*DummyReceiver) GetLayerDimension

func (d *DummyReceiver) GetLayerDimension(quality int32) (uint32, uint32)

func (*DummyReceiver) GetLayeredBitrate

func (d *DummyReceiver) GetLayeredBitrate() 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) HeaderExtensions

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

func (*DummyReceiver) ReadRTP

func (d *DummyReceiver) ReadRTP(buf []byte, layer uint8, sn uint16) (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) Upgrade

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

type DynacastManager

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

func NewDynacastManager

func NewDynacastManager(params DynacastManagerParams) *DynacastManager

func (*DynacastManager) AddCodec

func (d *DynacastManager) AddCodec(mime string)

func (*DynacastManager) Close

func (d *DynacastManager) Close()

func (*DynacastManager) ForceQuality

func (d *DynacastManager) ForceQuality(quality livekit.VideoQuality)

It is possible for tracks to be in pending close state. When track is waiting to be closed, a node is not streaming a track. This can be used to force an update announcing that subscribed quality is OFF, i.e. indicating not pulling track any more.

func (*DynacastManager) ForceUpdate

func (d *DynacastManager) ForceUpdate()

THere are situations like track unmute or streaming from a sifferent node where subscribed quality needs to sent to the provider immediately. This bypasses any debouncing and forces a subscribed quality update with immediate effect.

func (*DynacastManager) NotifySubscriberMaxQuality

func (d *DynacastManager) NotifySubscriberMaxQuality(subscriberID livekit.ParticipantID, mime string, quality livekit.VideoQuality)

func (*DynacastManager) NotifySubscriberNodeMaxQuality

func (d *DynacastManager) NotifySubscriberNodeMaxQuality(nodeID livekit.NodeID, qualities []types.SubscribedCodecQuality)

func (*DynacastManager) OnSubscribedMaxQualityChange

func (d *DynacastManager) OnSubscribedMaxQualityChange(f func(subscribedQualities []*livekit.SubscribedCodec, maxSubscribedQualities []types.SubscribedCodecQuality))

func (*DynacastManager) Restart

func (d *DynacastManager) Restart()

type DynacastManagerParams

type DynacastManagerParams struct {
	DynacastPauseDelay time.Duration
	Logger             logger.Logger
}

type DynacastQuality

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

DynacastQuality manages max subscribed quality of a single receiver of a media track

func NewDynacastQuality

func NewDynacastQuality(params DynacastQualityParams) *DynacastQuality

func (*DynacastQuality) NotifySubscriberMaxQuality

func (d *DynacastQuality) NotifySubscriberMaxQuality(subscriberID livekit.ParticipantID, quality livekit.VideoQuality)

func (*DynacastQuality) NotifySubscriberNodeMaxQuality

func (d *DynacastQuality) NotifySubscriberNodeMaxQuality(nodeID livekit.NodeID, quality livekit.VideoQuality)

func (*DynacastQuality) OnSubscribedMaxQualityChange

func (d *DynacastQuality) OnSubscribedMaxQualityChange(f func(maxSubscribedQuality livekit.VideoQuality))

func (*DynacastQuality) Restart

func (d *DynacastQuality) Restart()

func (*DynacastQuality) Start

func (d *DynacastQuality) Start()

func (*DynacastQuality) Stop

func (d *DynacastQuality) Stop()

type DynacastQualityParams

type DynacastQualityParams struct {
	MimeType           string
	DynacastPauseDelay time.Duration
	Logger             logger.Logger
}

type EgressLauncher

type EgressLauncher interface {
	StartEgress(context.Context, *livekit.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) *MediaTrack

func (*MediaTrack) AddReceiver

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

AddReceiver adds a new RTP receiver to the track, returns true when receiver represents a new codec

func (*MediaTrack) Close

func (t *MediaTrack) Close(willBeResumed bool)

func (*MediaTrack) GetConnectionScore

func (t *MediaTrack) GetConnectionScore() float32

func (*MediaTrack) HasPendingCodec

func (t *MediaTrack) HasPendingCodec() bool

func (*MediaTrack) HasSdpCid

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

func (*MediaTrack) NotifySubscriberNodeMaxQuality

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

func (*MediaTrack) OnSubscribedMaxQualityChange

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

func (*MediaTrack) Restart

func (t *MediaTrack) Restart()

func (*MediaTrack) SetMuted

func (t *MediaTrack) SetMuted(muted bool)

func (*MediaTrack) SetPendingCodecSid

func (t *MediaTrack) SetPendingCodecSid(codecs []*livekit.SimulcastCodec)

func (*MediaTrack) SetRTT

func (t *MediaTrack) SetRTT(rtt uint32)

func (*MediaTrack) SignalCid

func (t *MediaTrack) SignalCid() string

func (*MediaTrack) ToProto

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

type MediaTrackParams

type MediaTrackParams struct {
	TrackInfo           *livekit.TrackInfo
	SignalCid           string
	SdpCid              string
	ParticipantID       livekit.ParticipantID
	ParticipantIdentity livekit.ParticipantIdentity
	ParticipantVersion  uint32
	// channel to send RTCP packets to the source
	RTCPChan          chan []rtcp.Packet
	BufferFactory     *buffer.Factory
	ReceiverConfig    ReceiverConfig
	SubscriberConfig  DirectionConfig
	PLIThrottleConfig config.PLIThrottleConfig
	AudioConfig       config.AudioConfig
	VideoConfig       config.VideoConfig
	Telemetry         telemetry.TelemetryService
	Logger            logger.Logger
	SimTracks         map[uint32]SimulcastTrackInfo
}

type MediaTrackReceiver

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

func NewMediaTrackReceiver

func NewMediaTrackReceiver(params MediaTrackReceiverParams) *MediaTrackReceiver

func (*MediaTrackReceiver) AddOnClose

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

func (*MediaTrackReceiver) AddSubscriber

func (t *MediaTrackReceiver) AddSubscriber(sub types.LocalParticipant) error

AddSubscriber subscribes sub to current mediaTrack

func (*MediaTrackReceiver) ClearAllReceivers

func (t *MediaTrackReceiver) ClearAllReceivers(willBeResumed bool)

func (*MediaTrackReceiver) ClearReceiver

func (t *MediaTrackReceiver) ClearReceiver(mime string, willBeResumed bool)

func (*MediaTrackReceiver) Close

func (t *MediaTrackReceiver) Close()

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(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(spatial int32, fps uint32, mime string) int32

func (*MediaTrackReceiver) GetVideoLayers

func (t *MediaTrackReceiver) GetVideoLayers() []*livekit.VideoLayer

func (*MediaTrackReceiver) ID

func (*MediaTrackReceiver) IsMuted

func (t *MediaTrackReceiver) IsMuted() bool

func (*MediaTrackReceiver) IsSimulcast

func (t *MediaTrackReceiver) IsSimulcast() bool

func (*MediaTrackReceiver) IsSubscribed

func (t *MediaTrackReceiver) IsSubscribed() bool

func (*MediaTrackReceiver) Kind

func (*MediaTrackReceiver) Name

func (t *MediaTrackReceiver) Name() string

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 string))

func (*MediaTrackReceiver) OnVideoLayerUpdate

func (t *MediaTrackReceiver) OnVideoLayerUpdate(f func(layers []*livekit.VideoLayer))

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 string) sfu.TrackReceiver

func (*MediaTrackReceiver) Receivers

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

func (*MediaTrackReceiver) RemoveSubscriber

func (t *MediaTrackReceiver) RemoveSubscriber(subscriberID livekit.ParticipantID, willBeResumed 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) SetLayerSsrc

func (t *MediaTrackReceiver) SetLayerSsrc(mime string, 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) SetSimulcast

func (t *MediaTrackReceiver) SetSimulcast(simulcast bool)

func (*MediaTrackReceiver) SetupReceiver

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

func (*MediaTrackReceiver) Source

func (*MediaTrackReceiver) TrackInfo

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

func (*MediaTrackReceiver) TryClose

func (t *MediaTrackReceiver) TryClose() bool

func (*MediaTrackReceiver) UpdateTrackInfo

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

func (*MediaTrackReceiver) UpdateVideoLayers

func (t *MediaTrackReceiver) UpdateVideoLayers(layers []*livekit.VideoLayer)

type MediaTrackReceiverParams

type MediaTrackReceiverParams struct {
	TrackInfo           *livekit.TrackInfo
	MediaTrack          types.MediaTrack
	IsRelayed           bool
	ParticipantID       livekit.ParticipantID
	ParticipantIdentity livekit.ParticipantIdentity
	ParticipantVersion  uint32
	BufferFactory       *buffer.Factory
	ReceiverConfig      ReceiverConfig
	SubscriberConfig    DirectionConfig
	Telemetry           telemetry.TelemetryService
	Logger              logger.Logger
}

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 string) []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) OnSubscriberMaxQualityChange

func (t *MediaTrackSubscriptions) OnSubscriberMaxQualityChange(f func(subscriberID livekit.ParticipantID, codec webrtc.RTPCodecCapability, layer int32))

func (*MediaTrackSubscriptions) OnSubscriptionOperationComplete

func (t *MediaTrackSubscriptions) OnSubscriptionOperationComplete(f func(sub types.LocalParticipant))

func (*MediaTrackSubscriptions) RemoveSubscriber

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

RemoveSubscriber removes participant from subscription stop all forwarders to the client

func (*MediaTrackSubscriptions) ResyncAllSubscribers

func (t *MediaTrackSubscriptions) ResyncAllSubscribers()

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

	BufferFactory    *buffer.Factory
	ReceiverConfig   ReceiverConfig
	SubscriberConfig DirectionConfig

	Telemetry telemetry.TelemetryService

	Logger logger.Logger
}

type NegotiationState

type NegotiationState int
const (
	NegotiationStateNone NegotiationState = iota
	// waiting for remote description
	NegotiationStateRemote
	// need to Negotiate again
	NegotiationStateRetry
)

func (NegotiationState) String

func (n NegotiationState) String() string

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) (sender *webrtc.RTPSender, transceiver *webrtc.RTPTransceiver, err error)

func (*PCTransport) AddTrackToStreamAllocator

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

func (*PCTransport) AddTransceiverFromTrack

func (t *PCTransport) AddTransceiverFromTrack(trackLocal webrtc.TrackLocal, params types.AddTrackParams) (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) GetICEConnectionType

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

func (*PCTransport) GetMid

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

func (*PCTransport) GetRTPReceiver

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

func (*PCTransport) HandleRemoteDescription

func (t *PCTransport) HandleRemoteDescription(sd webrtc.SessionDescription)

func (*PCTransport) HasEverConnected

func (t *PCTransport) HasEverConnected() bool

func (*PCTransport) ICERestart

func (t *PCTransport) ICERestart()

func (*PCTransport) IsEstablished

func (t *PCTransport) IsEstablished() bool

IsEstablished returns true if the PeerConnection has been established

func (*PCTransport) Negotiate

func (t *PCTransport) Negotiate(force bool)

func (*PCTransport) OnAnswer

func (t *PCTransport) OnAnswer(f func(sd webrtc.SessionDescription) error)

func (*PCTransport) OnDataPacket

func (t *PCTransport) OnDataPacket(f func(kind livekit.DataPacket_Kind, data []byte))

func (*PCTransport) OnFailed

func (t *PCTransport) OnFailed(f func(isShortLived bool))

func (*PCTransport) OnFullyEstablished

func (t *PCTransport) OnFullyEstablished(f func())

func (*PCTransport) OnICECandidate

func (t *PCTransport) OnICECandidate(f func(c *webrtc.ICECandidate) error)

func (*PCTransport) OnInitialConnected

func (t *PCTransport) OnInitialConnected(f func())

func (*PCTransport) OnNegotiationFailed

func (t *PCTransport) OnNegotiationFailed(f func())

func (*PCTransport) OnNegotiationStateChanged

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

func (*PCTransport) OnOffer

func (t *PCTransport) OnOffer(f func(sd webrtc.SessionDescription) error)

OnOffer is called when the PeerConnection starts negotiation and prepares an offer

func (*PCTransport) OnStreamStateChange

func (t *PCTransport) OnStreamStateChange(f func(update *sfu.StreamStateUpdate) error)

func (*PCTransport) OnTrack

func (t *PCTransport) OnTrack(f func(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver))

func (*PCTransport) RemoveTrack

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

func (*PCTransport) RemoveTrackFromStreamAllocator

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

func (*PCTransport) SendDataPacket

func (t *PCTransport) SendDataPacket(dp *livekit.DataPacket) error

func (*PCTransport) SetPreferTCP

func (t *PCTransport) SetPreferTCP(preferTCP bool)

func (*PCTransport) SetPreviousSdp

func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription)

func (*PCTransport) WriteRTCP

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

type ParticipantImpl

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

func NewParticipant

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

func (*ParticipantImpl) AddSubscribedTrack

func (p *ParticipantImpl) AddSubscribedTrack(subTrack types.SubscribedTrack)

AddSubscribedTrack adds a track to the participant's subscribed list

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) 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) CanSubscribe

func (p *ParticipantImpl) CanSubscribe() bool

func (*ParticipantImpl) ClaimGrants

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

func (*ParticipantImpl) ClearInProgressAndProcessSubscriptionRequestsQueue

func (p *ParticipantImpl) ClearInProgressAndProcessSubscriptionRequestsQueue(trackID livekit.TrackID)

func (*ParticipantImpl) Close

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

func (*ParticipantImpl) CloseSignalConnection

func (p *ParticipantImpl) CloseSignalConnection()

closes signal connection to notify client to resume/reconnect

func (*ParticipantImpl) ConnectedAt

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

func (*ParticipantImpl) DebugInfo

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

func (*ParticipantImpl) EnqueueSubscribeTrack

func (p *ParticipantImpl) EnqueueSubscribeTrack(trackID livekit.TrackID, isRelayed bool, f func(sub types.LocalParticipant) error)

func (*ParticipantImpl) EnqueueUnsubscribeTrack

func (p *ParticipantImpl) EnqueueUnsubscribeTrack(trackID livekit.TrackID, isRelayed bool, willBeResumed bool, f func(subscriberID livekit.ParticipantID, willBeResumed bool) error)

func (*ParticipantImpl) GetAdaptiveStream

func (p *ParticipantImpl) GetAdaptiveStream() bool

func (*ParticipantImpl) GetAudioLevel

func (p *ParticipantImpl) GetAudioLevel() (level float64, active bool)

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) GetConnectionQuality

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

func (*ParticipantImpl) GetICEConnectionType

func (p *ParticipantImpl) GetICEConnectionType() types.ICEConnectionType

func (*ParticipantImpl) GetLogger

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

func (*ParticipantImpl) GetSubscribedParticipants

func (p *ParticipantImpl) GetSubscribedParticipants() []livekit.ParticipantID

func (*ParticipantImpl) GetSubscribedTracks

func (p *ParticipantImpl) GetSubscribedTracks() []types.SubscribedTrack

func (*ParticipantImpl) HandleAnswer

func (p *ParticipantImpl) HandleAnswer(answer webrtc.SessionDescription)

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

func (*ParticipantImpl) HandleOffer

func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription)

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

func (*ParticipantImpl) Hidden

func (p *ParticipantImpl) Hidden() bool

func (*ParticipantImpl) ICERestart

func (p *ParticipantImpl) ICERestart(iceConfig *types.IceConfig)

ICERestart restarts subscriber ICE connections

func (*ParticipantImpl) ID

func (*ParticipantImpl) Identity

func (*ParticipantImpl) IsPublisher

func (p *ParticipantImpl) IsPublisher() bool

func (*ParticipantImpl) IsReady

func (p *ParticipantImpl) IsReady() bool

func (*ParticipantImpl) IsRecorder

func (p *ParticipantImpl) IsRecorder() bool

func (*ParticipantImpl) IsSubscribedTo

func (p *ParticipantImpl) IsSubscribedTo(participantID livekit.ParticipantID) bool

func (*ParticipantImpl) MaybeStartMigration

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

func (*ParticipantImpl) MigrateState

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

func (*ParticipantImpl) Negotiate

func (p *ParticipantImpl) Negotiate(force bool)

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

func (*ParticipantImpl) OnClaimsChanged

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

func (*ParticipantImpl) OnClose

func (p *ParticipantImpl) OnClose(callback func(types.LocalParticipant, map[livekit.TrackID]livekit.ParticipantID))

func (*ParticipantImpl) OnDataPacket

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

func (*ParticipantImpl) OnICEConfigChanged

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

func (*ParticipantImpl) OnParticipantUpdate

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

func (*ParticipantImpl) OnStateChange

func (p *ParticipantImpl) OnStateChange(callback func(p types.LocalParticipant, oldState livekit.ParticipantInfo_State))

func (*ParticipantImpl) OnSubscribedTo

func (p *ParticipantImpl) OnSubscribedTo(callback func(types.LocalParticipant, livekit.ParticipantID))

func (*ParticipantImpl) OnTrackPublished

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

func (*ParticipantImpl) OnTrackUpdated

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

func (*ParticipantImpl) ProcessSubscriptionRequestsQueue

func (p *ParticipantImpl) ProcessSubscriptionRequestsQueue(trackID livekit.TrackID)

func (*ParticipantImpl) ProtocolVersion

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

func (*ParticipantImpl) RemoveSubscribedTrack

func (p *ParticipantImpl) RemoveSubscribedTrack(subTrack types.SubscribedTrack)

RemoveSubscribedTrack removes a track to the participant's subscribed list

func (*ParticipantImpl) SendConnectionQualityUpdate

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

func (*ParticipantImpl) SendDataPacket

func (p *ParticipantImpl) SendDataPacket(dp *livekit.DataPacket) 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) SendRoomUpdate

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

func (*ParticipantImpl) SendSpeakerUpdate

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

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

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,
)

func (*ParticipantImpl) SetMigrateState

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

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(trackID livekit.TrackID, muted bool, fromAdmin bool)

func (*ParticipantImpl) Start

func (p *ParticipantImpl) Start()

func (*ParticipantImpl) State

func (*ParticipantImpl) SubscriptionPermissionUpdate

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

func (*ParticipantImpl) ToProto

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

func (*ParticipantImpl) UncacheDownTrack

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

func (*ParticipantImpl) UpdateMediaLoss

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

func (*ParticipantImpl) UpdateRTT

func (p *ParticipantImpl) UpdateRTT(rtt uint32)

func (*ParticipantImpl) UpdateSubscribedQuality

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

func (*ParticipantImpl) UpdateSubscribedTrackSettings

func (p *ParticipantImpl) UpdateSubscribedTrackSettings(trackID livekit.TrackID, settings *livekit.UpdateTrackSettings) error

func (*ParticipantImpl) VerifySubscribeParticipantInfo

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

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             config.AudioConfig
	VideoConfig             config.VideoConfig
	ProtocolVersion         types.ProtocolVersion
	Telemetry               telemetry.TelemetryService
	PLIThrottleConfig       config.PLIThrottleConfig
	CongestionControlConfig config.CongestionControlConfig
	EnabledCodecs           []*livekit.Codec
	Logger                  logger.Logger
	SimTracks               map[uint32]SimulcastTrackInfo
	Grants                  *auth.ClaimGrants
	InitialVersion          uint32
	ClientConf              *livekit.ClientConfiguration
	ClientInfo              ClientInfo
	Region                  string
	Migration               bool
	AdaptiveStream          bool
	AllowTCPFallback        bool
	TURNSEnabled            bool
	GetParticipantInfo      func(pID livekit.ParticipantID) *livekit.ParticipantInfo
}

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 {
	PacketBufferSize int
}

type Room

type Room struct {
	Logger logger.Logger
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(
	room *livekit.Room,
	internal *livekit.RoomInternal,
	config WebRTCConfig,
	audioConfig *config.AudioConfig,
	serverInfo *livekit.ServerInfo,
	telemetry telemetry.TelemetryService,
	egressLauncher EgressLauncher,
) *Room

func (*Room) Close

func (r *Room) Close()

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) FirstJoinedAt

func (r *Room) FirstJoinedAt() int64

func (*Room) GetActiveSpeakers

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

func (*Room) GetBufferFactory

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

func (*Room) GetParticipant

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

func (*Room) GetParticipantBySid

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

func (*Room) GetParticipants

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

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) Join

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

func (*Room) LastLeftAt

func (r *Room) LastLeftAt() int64

func (*Room) Name

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

func (*Room) OnClose

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

func (*Room) OnMetadataUpdate

func (r *Room) OnMetadataUpdate(f func(metadata string))

func (*Room) OnParticipantChanged

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

func (*Room) Release

func (r *Room) Release()

func (*Room) RemoveDisallowedSubscriptions

func (r *Room) RemoveDisallowedSubscriptions(sub types.LocalParticipant, disallowedSubscriptions map[livekit.TrackID]livekit.ParticipantID)

func (*Room) RemoveParticipant

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

func (*Room) ResumeParticipant

func (r *Room) ResumeParticipant(p types.LocalParticipant, responseSink routing.MessageSink) error

func (*Room) SendDataPacket

func (r *Room) SendDataPacket(up *livekit.UserPacket, kind livekit.DataPacket_Kind)

func (*Room) SetMetadata

func (r *Room) SetMetadata(metadata string)

func (*Room) SetParticipantPermission

func (r *Room) SetParticipantPermission(participant types.LocalParticipant, permission *livekit.ParticipantPermission) error

func (*Room) SimulateScenario

func (r *Room) SimulateScenario(participant types.LocalParticipant, simulateScenario *livekit.SimulateScenario) error

func (*Room) SyncState

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

func (*Room) ToProto

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

func (*Room) UpdateSubscriptionPermission

func (r *Room) UpdateSubscriptionPermission(participant types.LocalParticipant, subscriptionPermission *livekit.SubscriptionPermission) error

func (*Room) UpdateSubscriptions

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

func (*Room) UpdateVideoLayers

func (r *Room) UpdateVideoLayers(participant types.Participant, updateVideoLayers *livekit.UpdateVideoLayers) error

type SimulcastTrackInfo

type SimulcastTrackInfo struct {
	Mid string
	Rid string
}

type SubscribeRequest

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

type SubscribeRequestType

type SubscribeRequestType int
const (
	SubscribeRequestTypeRemove SubscribeRequestType = iota
	SubscribeRequestTypeAdd
)

type SubscribedTrack

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

func NewSubscribedTrack

func NewSubscribedTrack(params SubscribedTrackParams) *SubscribedTrack

func (*SubscribedTrack) Bound

func (t *SubscribedTrack) Bound()

func (*SubscribedTrack) DownTrack

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

func (*SubscribedTrack) ID

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) OnBind

func (t *SubscribedTrack) OnBind(f func())

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) SetPublisherMuted

func (t *SubscribedTrack) SetPublisherMuted(muted bool)

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)

func (*SubscribedTrack) UpdateVideoLayer

func (t *SubscribedTrack) UpdateVideoLayer()

type SubscribedTrackParams

type SubscribedTrackParams struct {
	PublisherID       livekit.ParticipantID
	PublisherIdentity livekit.ParticipantIdentity
	PublisherVersion  uint32
	Subscriber        types.LocalParticipant
	MediaTrack        types.MediaTrack
	DownTrack         *sfu.DownTrack
	AdaptiveStream    bool
}

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) AddTrackToSubscriber

func (t *TransportManager) AddTrackToSubscriber(trackLocal webrtc.TrackLocal, params types.AddTrackParams) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*TransportManager) AddTransceiverFromTrackToSubscriber

func (t *TransportManager) AddTransceiverFromTrackToSubscriber(trackLocal webrtc.TrackLocal, params types.AddTrackParams) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)

func (*TransportManager) Close

func (t *TransportManager) Close()

func (*TransportManager) GetICEConnectionType

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

func (*TransportManager) GetPublisherMid

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

func (*TransportManager) GetPublisherRTPReceiver

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

func (*TransportManager) GetUnmatchMediaForOffer

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

func (*TransportManager) HandleAnswer

func (t *TransportManager) HandleAnswer(answer webrtc.SessionDescription)

func (*TransportManager) HandleOffer

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

func (*TransportManager) HasSubscriberEverConnected

func (t *TransportManager) HasSubscriberEverConnected() bool

func (*TransportManager) HaveAllTransportEverConnected

func (t *TransportManager) HaveAllTransportEverConnected() bool

func (*TransportManager) ICERestart

func (t *TransportManager) ICERestart(iceConfig *types.IceConfig)

func (*TransportManager) IsPublisherEstablished

func (t *TransportManager) IsPublisherEstablished() bool

func (*TransportManager) LastPublisherOffer

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

func (*TransportManager) NegotiateSubscriber

func (t *TransportManager) NegotiateSubscriber(force bool)

func (*TransportManager) OnAnyTransportFailed

func (t *TransportManager) OnAnyTransportFailed(f func())

func (*TransportManager) OnAnyTransportNegotiationFailed

func (t *TransportManager) OnAnyTransportNegotiationFailed(f func())

func (*TransportManager) OnDataMessage

func (t *TransportManager) OnDataMessage(f func(kind livekit.DataPacket_Kind, data []byte))

func (*TransportManager) OnICEConfigChanged

func (t *TransportManager) OnICEConfigChanged(f func(iceConfig types.IceConfig))

func (*TransportManager) OnPrimaryTransportFullyEstablished

func (t *TransportManager) OnPrimaryTransportFullyEstablished(f func())

func (*TransportManager) OnPrimaryTransportInitialConnected

func (t *TransportManager) OnPrimaryTransportInitialConnected(f func())

func (*TransportManager) OnPublisherAnswer

func (t *TransportManager) OnPublisherAnswer(f func(answer webrtc.SessionDescription) error)

func (*TransportManager) OnPublisherICECandidate

func (t *TransportManager) OnPublisherICECandidate(f func(c *webrtc.ICECandidate) error)

func (*TransportManager) OnPublisherInitialConnected

func (t *TransportManager) OnPublisherInitialConnected(f func())

func (*TransportManager) OnPublisherTrack

func (t *TransportManager) OnPublisherTrack(f func(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver))

func (*TransportManager) OnReceiverReport

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

func (*TransportManager) OnSubscriberICECandidate

func (t *TransportManager) OnSubscriberICECandidate(f func(c *webrtc.ICECandidate) error)

func (*TransportManager) OnSubscriberInitialConnected

func (t *TransportManager) OnSubscriberInitialConnected(f func())

func (*TransportManager) OnSubscriberOffer

func (t *TransportManager) OnSubscriberOffer(f func(offer webrtc.SessionDescription) error)

func (*TransportManager) OnSubscriberStreamStateChange

func (t *TransportManager) OnSubscriberStreamStateChange(f func(update *sfu.StreamStateUpdate) error)

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) RemoveTrackFromSubscriber

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

func (*TransportManager) SendDataPacket

func (t *TransportManager) SendDataPacket(dp *livekit.DataPacket) error

func (*TransportManager) SetICEConfig

func (t *TransportManager) SetICEConfig(iceConfig types.IceConfig)

func (*TransportManager) SetMigrateInfo

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

func (*TransportManager) SubscriberAsPrimary

func (t *TransportManager) SubscriberAsPrimary() bool

func (*TransportManager) SubscriberClose

func (t *TransportManager) SubscriberClose()

func (*TransportManager) UpdateRTT

func (t *TransportManager) UpdateRTT(rtt uint32, isUDP bool)

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 {
	Identity                livekit.ParticipantIdentity
	SID                     livekit.ParticipantID
	SubscriberAsPrimary     bool
	Config                  *WebRTCConfig
	ProtocolVersion         types.ProtocolVersion
	Telemetry               telemetry.TelemetryService
	CongestionControlConfig config.CongestionControlConfig
	EnabledCodecs           []*livekit.Codec
	SimTracks               map[uint32]SimulcastTrackInfo
	ClientConf              *livekit.ClientConfiguration
	ClientInfo              ClientInfo
	Migration               bool
	AllowTCPFallback        bool
	TURNSEnabled            bool
	Logger                  logger.Logger
}

type TransportParams

type TransportParams struct {
	ParticipantID           livekit.ParticipantID
	ParticipantIdentity     livekit.ParticipantIdentity
	ProtocolVersion         types.ProtocolVersion
	Config                  *WebRTCConfig
	DirectionConfig         DirectionConfig
	CongestionControlConfig config.CongestionControlConfig
	Telemetry               telemetry.TelemetryService
	EnabledCodecs           []*livekit.Codec
	Logger                  logger.Logger
	SimTracks               map[uint32]SimulcastTrackInfo
	ClientInfo              ClientInfo
	IsOfferer               bool
	IsSendSide              bool
}

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
}

func NewUpTrackManager

func NewUpTrackManager(params UpTrackManagerParams) *UpTrackManager

func (*UpTrackManager) AddPublishedTrack

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

func (*UpTrackManager) AddSubscriber

func (u *UpTrackManager) AddSubscriber(sub types.LocalParticipant, params types.AddSubscriberParams) (int, error)

AddSubscriber subscribes op to all publishedTracks

func (*UpTrackManager) Close

func (u *UpTrackManager) Close(willBeResumed bool)

func (*UpTrackManager) DebugInfo

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

func (*UpTrackManager) GetPublishedTrack

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

func (*UpTrackManager) GetPublishedTracks

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

func (*UpTrackManager) OnPublishedTrackUpdated

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

func (*UpTrackManager) OnUpTrackManagerClose

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

func (*UpTrackManager) RemovePublishedTrack

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

func (*UpTrackManager) RemoveSubscriber

func (u *UpTrackManager) RemoveSubscriber(sub types.LocalParticipant, trackID livekit.TrackID, willBeResumed bool)

func (*UpTrackManager) SetPublishedTrackMuted

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

func (*UpTrackManager) Start

func (u *UpTrackManager) Start()

func (*UpTrackManager) SubscriptionPermission

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

func (*UpTrackManager) ToProto

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

func (*UpTrackManager) UpdateSubscriptionPermission

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

func (*UpTrackManager) UpdateVideoLayers

func (u *UpTrackManager) UpdateVideoLayers(updateVideoLayers *livekit.UpdateVideoLayers) error

type UpTrackManagerParams

type UpTrackManagerParams struct {
	SID    livekit.ParticipantID
	Logger logger.Logger
}

type WebRTCConfig

type WebRTCConfig struct {
	Configuration  webrtc.Configuration
	SettingEngine  webrtc.SettingEngine
	Receiver       ReceiverConfig
	BufferFactory  *buffer.Factory
	UDPMux         ice.UDPMux
	TCPMuxListener *net.TCPListener
	Publisher      DirectionConfig
	Subscriber     DirectionConfig
}

func NewWebRTCConfig

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

func (*WebRTCConfig) SetBufferFactory

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

type WrappedReceiver

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

func NewWrappedReceiver

func NewWrappedReceiver(params WrappedReceiverParams) *WrappedReceiver

func (*WrappedReceiver) Codecs

func (r *WrappedReceiver) Codecs() []webrtc.RTPCodecParameters

func (*WrappedReceiver) DetermineReceiver

func (r *WrappedReceiver) DetermineReceiver(codec webrtc.RTPCodecCapability)

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
}

Directories

Path Synopsis
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