rtc

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 38 Imported by: 3

Documentation

Index

Constants

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

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

Functions

func ConvertAudioLevel added in v0.9.14

func ConvertAudioLevel(level uint8) float32

convert decibel back to linear

func FixedPointToPercent added in v0.14.0

func FixedPointToPercent(frac uint8) uint32

converts a fixed point number to the number part of %

func FromProtoTrickle

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

func HandleParticipantSignal added in v0.15.0

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

func IsEOF

func IsEOF(err error) bool

func LoggerWithParticipant added in v0.15.0

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

logger helpers

func LoggerWithRoom added in v0.15.0

func LoggerWithRoom(l logger.Logger, name livekit.RoomName) 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 SpatialLayerForQuality added in v0.15.2

func SpatialLayerForQuality(quality livekit.VideoQuality) int32

func ToProtoParticipants

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

func ToProtoTrackKind

func ToProtoTrackKind(kind webrtc.RTPCodecType) livekit.TrackType

func ToProtoTrickle

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

func UnpackDataTrackLabel

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

func UnpackStreamID

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

Types

type AudioLevel

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

keeps track of audio level for a participant

func NewAudioLevel

func NewAudioLevel(activeLevel uint8, minPercentile uint8) *AudioLevel

func (*AudioLevel) GetLevel

func (l *AudioLevel) GetLevel() (uint8, bool)

returns current audio level, 0 (loudest) to 127 (silent)

func (*AudioLevel) Observe

func (l *AudioLevel) Observe(level uint8, durationMs uint32)

Observes a new frame, must be called from the same thread

type DirectionConfig added in v0.15.2

type DirectionConfig struct {
	RTPHeaderExtension RTPHeaderExtensionConfig
	RTCPFeedback       RTCPFeedbackConfig
}

type MediaTrack

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

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

func NewMediaTrack

func NewMediaTrack(track *webrtc.TrackRemote, params MediaTrackParams) *MediaTrack

func (*MediaTrack) AddOnClose added in v0.15.0

func (t *MediaTrack) AddOnClose(f func())

func (*MediaTrack) AddReceiver

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

AddReceiver adds a new RTP receiver to the track

func (*MediaTrack) AddSubscriber

func (t *MediaTrack) AddSubscriber(sub types.Participant) error

AddSubscriber subscribes sub to current mediaTrack

func (*MediaTrack) DebugInfo added in v0.10.6

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

func (*MediaTrack) GetConnectionScore added in v0.15.0

func (t *MediaTrack) GetConnectionScore() float64

func (*MediaTrack) GetQualityForDimension added in v0.13.7

func (t *MediaTrack) GetQualityForDimension(width, height uint32) livekit.VideoQuality

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

func (*MediaTrack) ID

func (t *MediaTrack) ID() livekit.TrackID

func (*MediaTrack) IsMuted

func (t *MediaTrack) IsMuted() bool

func (*MediaTrack) IsSimulcast added in v0.15.0

func (t *MediaTrack) IsSimulcast() bool

func (*MediaTrack) IsSubscriber added in v0.9.2

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

func (*MediaTrack) Kind

func (t *MediaTrack) Kind() livekit.TrackType

func (*MediaTrack) Name

func (t *MediaTrack) Name() string

func (*MediaTrack) NotifySubscriberMaxQuality added in v0.15.0

func (t *MediaTrack) NotifySubscriberMaxQuality(subscriberID livekit.ParticipantID, quality livekit.VideoQuality)

func (*MediaTrack) NotifySubscriberMute added in v0.15.0

func (t *MediaTrack) NotifySubscriberMute(subscriberID livekit.ParticipantID)

func (*MediaTrack) NumUpTracks added in v0.12.1

func (t *MediaTrack) NumUpTracks() (uint32, uint32)

func (*MediaTrack) OnSubscribedMaxQualityChange added in v0.15.0

func (t *MediaTrack) OnSubscribedMaxQualityChange(f func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error)

func (*MediaTrack) PublishLossPercentage added in v0.14.0

func (t *MediaTrack) PublishLossPercentage() uint32

func (*MediaTrack) Receiver added in v0.15.0

func (t *MediaTrack) Receiver() sfu.TrackReceiver

func (*MediaTrack) RemoveAllSubscribers

func (t *MediaTrack) RemoveAllSubscribers()

func (*MediaTrack) RemoveSubscriber

func (t *MediaTrack) RemoveSubscriber(participantID livekit.ParticipantID)

RemoveSubscriber removes participant from subscription stop all forwarders to the client

func (*MediaTrack) RevokeDisallowedSubscribers added in v0.15.2

func (t *MediaTrack) RevokeDisallowedSubscribers(allowedSubscriberIDs []livekit.ParticipantID) []livekit.ParticipantID

func (*MediaTrack) SdpCid added in v0.13.6

func (t *MediaTrack) SdpCid() string

func (*MediaTrack) SetMuted

func (t *MediaTrack) SetMuted(muted bool)

func (*MediaTrack) SignalCid added in v0.13.6

func (t *MediaTrack) SignalCid() string

func (*MediaTrack) Source added in v0.15.0

func (t *MediaTrack) Source() livekit.TrackSource

func (*MediaTrack) ToProto added in v0.9.13

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

func (*MediaTrack) UpdateVideoLayers added in v0.15.0

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

type MediaTrackParams

type MediaTrackParams struct {
	TrackInfo           *livekit.TrackInfo
	SignalCid           string
	SdpCid              string
	ParticipantID       livekit.ParticipantID
	ParticipantIdentity livekit.ParticipantIdentity
	// channel to send RTCP packets to the source
	RTCPChan       chan []rtcp.Packet
	BufferFactory  *buffer.Factory
	ReceiverConfig ReceiverConfig
	AudioConfig    config.AudioConfig
	Telemetry      telemetry.TelemetryService
	Logger         logger.Logger

	SubscriberConfig DirectionConfig
}

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

func (*PCTransport) AddTrack added in v0.15.0

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

func (*PCTransport) Close

func (t *PCTransport) Close()

func (*PCTransport) CreateAndSendOffer

func (t *PCTransport) CreateAndSendOffer(options *webrtc.OfferOptions) error

func (*PCTransport) Negotiate

func (t *PCTransport) Negotiate()

func (*PCTransport) OnOffer

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

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

func (*PCTransport) OnStreamStateChange added in v0.15.0

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

func (*PCTransport) PeerConnection

func (t *PCTransport) PeerConnection() *webrtc.PeerConnection

func (*PCTransport) RemoveTrack added in v0.15.0

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

func (*PCTransport) SetRemoteDescription

func (t *PCTransport) SetRemoteDescription(sd webrtc.SessionDescription) error

type ParticipantImpl

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

func NewParticipant

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

func (*ParticipantImpl) AddICECandidate

func (p *ParticipantImpl) AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) error

AddICECandidate adds candidates for remote peer

func (*ParticipantImpl) AddSubscribedTrack

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

AddSubscribedTrack adds a track to the participant's subscribed list

func (*ParticipantImpl) AddSubscriber

func (p *ParticipantImpl) AddSubscriber(op types.Participant, params types.AddSubscriberParams) (int, error)

AddSubscriber subscribes op to all publishedTracks or given set of tracks

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

func (p *ParticipantImpl) CanPublish() bool

func (*ParticipantImpl) CanPublishData added in v0.12.2

func (p *ParticipantImpl) CanPublishData() bool

func (*ParticipantImpl) CanSubscribe

func (p *ParticipantImpl) CanSubscribe() bool

func (*ParticipantImpl) Close

func (p *ParticipantImpl) Close() error

func (*ParticipantImpl) ConnectedAt

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

func (*ParticipantImpl) DebugInfo added in v0.10.6

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

func (*ParticipantImpl) GetAudioLevel

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

func (*ParticipantImpl) GetConnectionQuality added in v0.14.0

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

func (*ParticipantImpl) GetPublishedTrack added in v0.13.7

func (p *ParticipantImpl) GetPublishedTrack(sid livekit.TrackID) types.PublishedTrack

func (*ParticipantImpl) GetPublishedTracks

func (p *ParticipantImpl) GetPublishedTracks() []types.PublishedTrack

func (*ParticipantImpl) GetResponseSink

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

func (*ParticipantImpl) GetSubscribedParticipants added in v0.14.0

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

func (*ParticipantImpl) GetSubscribedTrack added in v0.13.7

func (p *ParticipantImpl) GetSubscribedTrack(sid livekit.TrackID) types.SubscribedTrack

func (*ParticipantImpl) GetSubscribedTracks

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

func (*ParticipantImpl) HandleAnswer

func (p *ParticipantImpl) HandleAnswer(sdp webrtc.SessionDescription) error

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

func (*ParticipantImpl) HandleOffer

func (p *ParticipantImpl) HandleOffer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error)

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

func (*ParticipantImpl) Hidden added in v0.11.1

func (p *ParticipantImpl) Hidden() bool

func (*ParticipantImpl) ICERestart

func (p *ParticipantImpl) ICERestart() error

ICERestart restarts subscriber ICE connections

func (*ParticipantImpl) ID

func (*ParticipantImpl) Identity

func (*ParticipantImpl) IsReady

func (p *ParticipantImpl) IsReady() bool

func (*ParticipantImpl) IsRecorder added in v0.15.0

func (p *ParticipantImpl) IsRecorder() bool

func (*ParticipantImpl) IsSubscribedTo added in v0.14.0

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

func (*ParticipantImpl) Negotiate

func (p *ParticipantImpl) Negotiate()

func (*ParticipantImpl) OnClose

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

func (*ParticipantImpl) OnDataPacket

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

func (*ParticipantImpl) OnMetadataUpdate

func (p *ParticipantImpl) OnMetadataUpdate(callback func(types.Participant))

func (*ParticipantImpl) OnStateChange

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

func (*ParticipantImpl) OnTrackPublished

func (p *ParticipantImpl) OnTrackPublished(callback func(types.Participant, types.PublishedTrack))

func (*ParticipantImpl) OnTrackUpdated

func (p *ParticipantImpl) OnTrackUpdated(callback func(types.Participant, types.PublishedTrack))

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

func (p *ParticipantImpl) RemoveSubscriber(op types.Participant, trackID livekit.TrackID)

func (*ParticipantImpl) SendConnectionQualityUpdate added in v0.14.0

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(
	roomInfo *livekit.Room,
	otherParticipants []*livekit.ParticipantInfo,
	iceServers []*livekit.ICEServer,
) error

func (*ParticipantImpl) SendParticipantUpdate

func (p *ParticipantImpl) SendParticipantUpdate(participantsToUpdate []*livekit.ParticipantInfo, updatedAt time.Time) error

func (*ParticipantImpl) SendRoomUpdate added in v0.13.1

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

func (*ParticipantImpl) SendSpeakerUpdate added in v0.13.0

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

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

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) SubscriberAsPrimary added in v0.15.0

func (p *ParticipantImpl) SubscriberAsPrimary() bool

func (*ParticipantImpl) SubscriberMediaEngine

func (p *ParticipantImpl) SubscriberMediaEngine() *webrtc.MediaEngine

func (*ParticipantImpl) SubscriberPC

func (p *ParticipantImpl) SubscriberPC() *webrtc.PeerConnection

func (*ParticipantImpl) SubscriptionPermissionUpdate added in v0.15.2

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

func (*ParticipantImpl) ToProto

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

func (*ParticipantImpl) UpdateSubscriptionPermissions added in v0.15.2

func (p *ParticipantImpl) UpdateSubscriptionPermissions(
	permissions *livekit.UpdateSubscriptionPermissions,
	resolver func(participantID livekit.ParticipantID) types.Participant,
) error

type ParticipantOptions added in v0.9.4

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
	ProtocolVersion         types.ProtocolVersion
	Telemetry               telemetry.TelemetryService
	ThrottleConfig          config.PLIThrottleConfig
	CongestionControlConfig config.CongestionControlConfig
	EnabledCodecs           []*livekit.Codec
	Hidden                  bool
	Recorder                bool
	Logger                  logger.Logger
}

type RTCPFeedbackConfig added in v0.15.2

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

type RTPHeaderExtensionConfig added in v0.15.2

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

type ReceiverConfig

type ReceiverConfig struct {
	PacketBufferSize int
	// contains filtered or unexported fields
}

type Room

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

func NewRoom

func NewRoom(room *livekit.Room, config WebRTCConfig, audioConfig *config.AudioConfig, telemetry telemetry.TelemetryService) *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 added in v0.10.6

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 added in v0.15.2

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

func (*Room) GetParticipant

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

func (*Room) GetParticipantBySid added in v0.15.2

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

func (*Room) GetParticipants

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

func (*Room) IsClosed added in v0.13.7

func (r *Room) IsClosed() bool

func (*Room) Join

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

func (*Room) LastLeftAt

func (r *Room) LastLeftAt() int64

func (*Room) Name added in v0.15.0

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

func (*Room) OnClose

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

func (*Room) OnMetadataUpdate added in v0.13.1

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

func (*Room) OnParticipantChanged

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

func (*Room) RemoveDisallowedSubscriptions added in v0.15.2

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

func (*Room) RemoveParticipant

func (r *Room) RemoveParticipant(identity livekit.ParticipantIdentity)

func (*Room) ResumeParticipant added in v0.13.7

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

func (*Room) SendDataPacket added in v0.12.2

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

func (*Room) SetMetadata added in v0.13.1

func (r *Room) SetMetadata(metadata string)

func (*Room) UpdateSubscriptionPermissions added in v0.15.2

func (r *Room) UpdateSubscriptionPermissions(participant types.Participant, permissions *livekit.UpdateSubscriptionPermissions) error

func (*Room) UpdateSubscriptions

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

type SubscribedTrack

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

func NewSubscribedTrack

func NewSubscribedTrack(params SubscribedTrackParams) *SubscribedTrack

func (*SubscribedTrack) Bound added in v0.15.0

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 added in v0.15.0

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

func (*SubscribedTrack) OnBind added in v0.15.0

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

func (*SubscribedTrack) PublisherID added in v0.15.2

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

func (*SubscribedTrack) PublisherIdentity added in v0.13.7

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

func (*SubscribedTrack) SetPublisherMuted

func (t *SubscribedTrack) SetPublisherMuted(muted bool)

func (*SubscribedTrack) UpdateSubscriberSettings added in v0.9.14

func (t *SubscribedTrack) UpdateSubscriberSettings(settings *livekit.UpdateTrackSettings)

func (*SubscribedTrack) UpdateVideoLayer added in v0.15.0

func (t *SubscribedTrack) UpdateVideoLayer()

type SubscribedTrackParams added in v0.15.0

type SubscribedTrackParams struct {
	PublisherID       livekit.ParticipantID
	PublisherIdentity livekit.ParticipantIdentity
	SubscriberID      livekit.ParticipantID
	MediaTrack        types.MediaTrack
	DownTrack         *sfu.DownTrack
}

type TransportParams

type TransportParams struct {
	ParticipantID           livekit.ParticipantID
	ParticipantIdentity     livekit.ParticipantIdentity
	Target                  livekit.SignalTarget
	Config                  *WebRTCConfig
	CongestionControlConfig config.CongestionControlConfig
	Telemetry               telemetry.TelemetryService
	EnabledCodecs           []*livekit.Codec
	Logger                  logger.Logger
}

type UptrackManager added in v0.15.2

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

func NewUptrackManager added in v0.15.2

func NewUptrackManager(params UptrackManagerParams) *UptrackManager

func (*UptrackManager) AddSubscriber added in v0.15.2

func (u *UptrackManager) AddSubscriber(sub types.Participant, params types.AddSubscriberParams) (int, error)

AddSubscriber subscribes op to all publishedTracks

func (*UptrackManager) AddTrack added in v0.15.2

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

func (*UptrackManager) Close added in v0.15.2

func (u *UptrackManager) Close()

func (*UptrackManager) DebugInfo added in v0.15.2

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

func (*UptrackManager) GetAudioLevel added in v0.15.2

func (u *UptrackManager) GetAudioLevel() (level uint8, active bool)

func (*UptrackManager) GetConnectionQuality added in v0.15.2

func (u *UptrackManager) GetConnectionQuality() (scores float64, numTracks int)

func (*UptrackManager) GetDTX added in v0.15.2

func (u *UptrackManager) GetDTX() bool

func (*UptrackManager) GetPublishedTrack added in v0.15.2

func (u *UptrackManager) GetPublishedTrack(sid livekit.TrackID) types.PublishedTrack

func (*UptrackManager) GetPublishedTracks added in v0.15.2

func (u *UptrackManager) GetPublishedTracks() []types.PublishedTrack

func (*UptrackManager) MediaTrackReceived added in v0.15.2

func (u *UptrackManager) MediaTrackReceived(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver)

when a new remoteTrack is created, creates a Track and adds it to room

func (*UptrackManager) OnSubscribedMaxQualityChange added in v0.15.2

func (u *UptrackManager) OnSubscribedMaxQualityChange(f func(trackID livekit.TrackID, subscribedQualities []*livekit.SubscribedQuality) error)

func (*UptrackManager) OnTrackPublished added in v0.15.2

func (u *UptrackManager) OnTrackPublished(f func(track types.PublishedTrack))

func (*UptrackManager) OnTrackUpdated added in v0.15.2

func (u *UptrackManager) OnTrackUpdated(f func(track types.PublishedTrack, onlyIfReady bool))

func (*UptrackManager) OnWriteRTCP added in v0.15.2

func (u *UptrackManager) OnWriteRTCP(f func(pkts []rtcp.Packet))

func (*UptrackManager) RemoveSubscriber added in v0.15.2

func (u *UptrackManager) RemoveSubscriber(sub types.Participant, trackID livekit.TrackID)

func (*UptrackManager) SetTrackMuted added in v0.15.2

func (u *UptrackManager) SetTrackMuted(trackID livekit.TrackID, muted bool)

func (*UptrackManager) Start added in v0.15.2

func (u *UptrackManager) Start()

func (*UptrackManager) ToProto added in v0.15.2

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

func (*UptrackManager) UpdateSubscriptionPermissions added in v0.15.2

func (u *UptrackManager) UpdateSubscriptionPermissions(
	permissions *livekit.UpdateSubscriptionPermissions,
	resolver func(participantID livekit.ParticipantID) types.Participant,
) error

type UptrackManagerParams added in v0.15.2

type UptrackManagerParams struct {
	Identity       livekit.ParticipantIdentity
	SID            livekit.ParticipantID
	Config         *WebRTCConfig
	AudioConfig    config.AudioConfig
	Telemetry      telemetry.TelemetryService
	ThrottleConfig config.PLIThrottleConfig
	Logger         logger.Logger
}

type WebRTCConfig

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

func NewWebRTCConfig

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

func (*WebRTCConfig) SetBufferFactory added in v0.9.11

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

type WrappedReceiver

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

func NewWrappedReceiver

func NewWrappedReceiver(receiver sfu.TrackReceiver, trackID livekit.TrackID, streamId string) WrappedReceiver

func (WrappedReceiver) StreamID

func (r WrappedReceiver) StreamID() string

func (WrappedReceiver) TrackID

func (r WrappedReceiver) TrackID() livekit.TrackID

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