Add control of playout delay (#1838)

* Add control of playout delay

Add config to enable playout delay. The delay will be limited by
[min,max] in the config option and calculated by upstream & downstream
RTT.

* check protocol version to enable playout delay

* Move config to room, limit playout-delay update interval, solve comments

* Remove adaptive playout-delay

* Remove unused config
This commit is contained in:
cnderrauber
2023-08-02 16:12:23 +08:00
committed by GitHub
parent 0c5161e9ab
commit f7a1776f4c
24 changed files with 598 additions and 137 deletions
+2 -2
View File
@@ -86,7 +86,7 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) {
sdp.SDESRTPStreamIDURI,
sdp.TransportCCURI,
frameMarking,
dd.ExtensionUrl,
dd.ExtensionURI,
},
},
RTCPFeedback: RTCPFeedbackConfig{
@@ -106,7 +106,7 @@ func NewWebRTCConfig(conf *config.Config) (*WebRTCConfig, error) {
subscriberConfig := DirectionConfig{
StrictACKs: conf.RTC.StrictACKs,
RTPHeaderExtension: RTPHeaderExtensionConfig{
Video: []string{dd.ExtensionUrl},
Video: []string{dd.ExtensionURI},
},
RTCPFeedback: RTCPFeedbackConfig{
Video: []webrtc.RTCPFeedback{
+8 -1
View File
@@ -226,7 +226,7 @@ func (t *MediaTrackReceiver) SetPotentialCodecs(codecs []webrtc.RTPCodecParamete
// that is munged in svc codec.
headersWithoutDD := make([]webrtc.RTPHeaderExtensionParameter, 0, len(headers))
for _, h := range headers {
if h.URI != dependencydescriptor.ExtensionUrl {
if h.URI != dependencydescriptor.ExtensionURI {
headersWithoutDD = append(headersWithoutDD, h)
}
}
@@ -401,6 +401,13 @@ func (t *MediaTrackReceiver) Source() livekit.TrackSource {
return t.trackInfo.Source
}
func (t *MediaTrackReceiver) Stream() string {
t.lock.RLock()
defer t.lock.RUnlock()
return t.trackInfo.Stream
}
func (t *MediaTrackReceiver) PublisherID() livekit.ParticipantID {
return t.params.ParticipantID
}
+21 -13
View File
@@ -112,20 +112,29 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
for _, c := range codecs {
c.RTCPFeedback = rtcpFeedback
}
streamID := wr.StreamID()
if sub.SupportSyncStreamID() && t.params.MediaTrack.Stream() != "" {
streamID = PackSyncStreamID(t.params.MediaTrack.PublisherID(), t.params.MediaTrack.Stream())
}
var trailer []byte
if t.params.MediaTrack.IsEncrypted() {
trailer = sub.GetTrailer()
}
downTrack, err := sfu.NewDownTrack(
codecs,
wr,
sub.GetBufferFactory(),
subscriberID,
t.params.ReceiverConfig.PacketBufferSize,
sub.GetPacer(),
trailer,
LoggerWithTrack(sub.GetLogger(), trackID, t.params.IsRelayed),
)
downTrack, err := sfu.NewDownTrack(sfu.DowntrackParams{
Codecs: codecs,
Receiver: wr,
BufferFactory: sub.GetBufferFactory(),
SubID: subscriberID,
StreamID: streamID,
MaxTrack: t.params.ReceiverConfig.PacketBufferSize,
PlayoutDelayLimit: sub.GetPlayoutDelayConfig(),
Pacer: sub.GetPacer(),
Trailer: trailer,
Logger: LoggerWithTrack(sub.GetLogger(), trackID, t.params.IsRelayed),
})
if err != nil {
return nil, err
}
@@ -200,6 +209,8 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
reusingTransceiver.Store(true)
rtpSender := existingTransceiver.Sender()
if rtpSender != nil {
// replaced track will bind immediately without negotiation, SetTransceiver first before bind
downTrack.SetTransceiver(existingTransceiver)
err := rtpSender.ReplaceTrack(downTrack)
if err == nil {
sender = rtpSender
@@ -260,9 +271,6 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
subTrack.SetNeedsNegotiation(!replacedTrack)
subTrack.SetRTPSender(sender)
sendParameters := sender.GetParameters()
downTrack.SetRTPHeaderExtensions(sendParameters.HeaderExtensions)
downTrack.SetTransceiver(transceiver)
downTrack.OnCloseHandler(func(willBeResumed bool) {
+14
View File
@@ -108,6 +108,7 @@ type ParticipantParams struct {
SubscriberAllowPause bool
SubscriptionLimitAudio int32
SubscriptionLimitVideo int32
PlayoutDelay *livekit.PlayoutDelay
}
type ParticipantImpl struct {
@@ -1104,6 +1105,7 @@ func (p *ParticipantImpl) setupTransportManager() error {
TCPFallbackRTTThreshold: p.params.TCPFallbackRTTThreshold,
AllowUDPUnstableFallback: p.params.AllowUDPUnstableFallback,
TURNSEnabled: p.params.TURNSEnabled,
AllowPlayoutDelay: p.params.PlayoutDelay.GetEnabled() && p.SupportSyncStreamID(),
Logger: p.params.Logger,
})
if err != nil {
@@ -1584,6 +1586,10 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
DisableRed: req.DisableRed,
Stereo: req.Stereo,
Encryption: req.Encryption,
Stream: req.Stream,
}
if ti.Stream == "" {
ti.Stream = StreamFromTrackSource(ti.Source)
}
p.setStableTrackID(req.Cid, ti)
for _, codec := range req.SimulcastCodecs {
@@ -2214,6 +2220,14 @@ func (p *ParticipantImpl) UpdateMediaLoss(nodeID livekit.NodeID, trackID livekit
return nil
}
func (p *ParticipantImpl) GetPlayoutDelayConfig() *livekit.PlayoutDelay {
return p.params.PlayoutDelay
}
func (p *ParticipantImpl) SupportSyncStreamID() bool {
return p.ProtocolVersion().SupportSyncStreamID() && !p.params.ClientInfo.isFirefox()
}
func codecsFromMediaDescription(m *sdp.MediaDescription) (out []sdp.Codec, err error) {
s := &sdp.SessionDescription{
MediaDescriptions: []*sdp.MediaDescription{m},
+1 -1
View File
@@ -155,7 +155,7 @@ func (p *ParticipantImpl) setCodecPreferencesVideoForPublisher(offer webrtc.Sess
// remove dd extension if av1/vp9 not preferred
if !strings.Contains(strings.ToLower(mime), "av1") && !strings.Contains(strings.ToLower(mime), "vp9") {
for i, attr := range unmatchVideo.Attributes {
if strings.Contains(attr.Value, dd.ExtensionUrl) {
if strings.Contains(attr.Value, dd.ExtensionURI) {
unmatchVideo.Attributes[i] = unmatchVideo.Attributes[len(unmatchVideo.Attributes)-1]
unmatchVideo.Attributes = unmatchVideo.Attributes[:len(unmatchVideo.Attributes)-1]
break
+9 -1
View File
@@ -43,6 +43,7 @@ import (
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu/pacer"
"github.com/livekit/livekit-server/pkg/sfu/rtpextension"
"github.com/livekit/livekit-server/pkg/sfu/streamallocator"
"github.com/livekit/livekit-server/pkg/telemetry"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
@@ -251,10 +252,17 @@ type TransportParams struct {
ClientInfo ClientInfo
IsOfferer bool
IsSendSide bool
AllowPlayoutDelay bool
}
func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimator cc.BandwidthEstimator)) (*webrtc.PeerConnection, *webrtc.MediaEngine, error) {
me, err := createMediaEngine(params.EnabledCodecs, params.DirectionConfig)
directionConfig := params.DirectionConfig
if params.AllowPlayoutDelay {
directionConfig.RTPHeaderExtension.Video = append(directionConfig.RTPHeaderExtension.Video, rtpextension.PlayoutDelayURI)
}
me, err := createMediaEngine(params.EnabledCodecs, directionConfig)
if err != nil {
return nil, nil, err
}
+2
View File
@@ -65,6 +65,7 @@ type TransportManagerParams struct {
TCPFallbackRTTThreshold int
AllowUDPUnstableFallback bool
TURNSEnabled bool
AllowPlayoutDelay bool
Logger logger.Logger
}
@@ -184,6 +185,7 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
ClientInfo: params.ClientInfo,
IsOfferer: true,
IsSendSide: true,
AllowPlayoutDelay: params.AllowPlayoutDelay,
})
if err != nil {
return nil, err
+3
View File
@@ -295,6 +295,7 @@ type LocalParticipant interface {
GetLogger() logger.Logger
GetAdaptiveStream() bool
ProtocolVersion() ProtocolVersion
SupportSyncStreamID() bool
ConnectedAt() time.Time
IsClosed() bool
IsReady() bool
@@ -305,6 +306,7 @@ type LocalParticipant interface {
GetClientConfiguration() *livekit.ClientConfiguration
GetICEConnectionType() ICEConnectionType
GetBufferFactory() *buffer.Factory
GetPlayoutDelayConfig() *livekit.PlayoutDelay
SetResponseSink(sink routing.MessageSink)
CloseSignalConnection(reason SignallingCloseReason)
@@ -429,6 +431,7 @@ type MediaTrack interface {
Kind() livekit.TrackType
Name() string
Source() livekit.TrackSource
Stream() string
ToProto() *livekit.TrackInfo
+5 -1
View File
@@ -16,7 +16,7 @@ package types
type ProtocolVersion int
const CurrentProtocol = 9
const CurrentProtocol = 10
func (v ProtocolVersion) SupportsPackedStreamId() bool {
return v > 0
@@ -71,3 +71,7 @@ func (v ProtocolVersion) SupportFastStart() bool {
func (v ProtocolVersion) SupportHandlesDisconnectedUpdate() bool {
return v > 8
}
func (v ProtocolVersion) SupportSyncStreamID() bool {
return v > 9
}
@@ -302,6 +302,16 @@ type FakeLocalMediaTrack struct {
sourceReturnsOnCall map[int]struct {
result1 livekit.TrackSource
}
StreamStub func() string
streamMutex sync.RWMutex
streamArgsForCall []struct {
}
streamReturns struct {
result1 string
}
streamReturnsOnCall map[int]struct {
result1 string
}
ToProtoStub func() *livekit.TrackInfo
toProtoMutex sync.RWMutex
toProtoArgsForCall []struct {
@@ -1893,6 +1903,59 @@ func (fake *FakeLocalMediaTrack) SourceReturnsOnCall(i int, result1 livekit.Trac
}{result1}
}
func (fake *FakeLocalMediaTrack) Stream() string {
fake.streamMutex.Lock()
ret, specificReturn := fake.streamReturnsOnCall[len(fake.streamArgsForCall)]
fake.streamArgsForCall = append(fake.streamArgsForCall, struct {
}{})
stub := fake.StreamStub
fakeReturns := fake.streamReturns
fake.recordInvocation("Stream", []interface{}{})
fake.streamMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalMediaTrack) StreamCallCount() int {
fake.streamMutex.RLock()
defer fake.streamMutex.RUnlock()
return len(fake.streamArgsForCall)
}
func (fake *FakeLocalMediaTrack) StreamCalls(stub func() string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = stub
}
func (fake *FakeLocalMediaTrack) StreamReturns(result1 string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = nil
fake.streamReturns = struct {
result1 string
}{result1}
}
func (fake *FakeLocalMediaTrack) StreamReturnsOnCall(i int, result1 string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = nil
if fake.streamReturnsOnCall == nil {
fake.streamReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.streamReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeLocalMediaTrack) ToProto() *livekit.TrackInfo {
fake.toProtoMutex.Lock()
ret, specificReturn := fake.toProtoReturnsOnCall[len(fake.toProtoArgsForCall)]
@@ -2050,6 +2113,8 @@ func (fake *FakeLocalMediaTrack) Invocations() map[string][][]interface{} {
defer fake.signalCidMutex.RUnlock()
fake.sourceMutex.RLock()
defer fake.sourceMutex.RUnlock()
fake.streamMutex.RLock()
defer fake.streamMutex.RUnlock()
fake.toProtoMutex.RLock()
defer fake.toProtoMutex.RUnlock()
fake.updateVideoLayersMutex.RLock()
@@ -263,6 +263,16 @@ type FakeLocalParticipant struct {
getPacerReturnsOnCall map[int]struct {
result1 pacer.Pacer
}
GetPlayoutDelayConfigStub func() *livekit.PlayoutDelay
getPlayoutDelayConfigMutex sync.RWMutex
getPlayoutDelayConfigArgsForCall []struct {
}
getPlayoutDelayConfigReturns struct {
result1 *livekit.PlayoutDelay
}
getPlayoutDelayConfigReturnsOnCall map[int]struct {
result1 *livekit.PlayoutDelay
}
GetPublishedTrackStub func(livekit.TrackID) types.MediaTrack
getPublishedTrackMutex sync.RWMutex
getPublishedTrackArgsForCall []struct {
@@ -772,6 +782,16 @@ type FakeLocalParticipant struct {
arg2 livekit.TrackID
arg3 bool
}
SupportSyncStreamIDStub func() bool
supportSyncStreamIDMutex sync.RWMutex
supportSyncStreamIDArgsForCall []struct {
}
supportSyncStreamIDReturns struct {
result1 bool
}
supportSyncStreamIDReturnsOnCall map[int]struct {
result1 bool
}
ToProtoStub func() *livekit.ParticipantInfo
toProtoMutex sync.RWMutex
toProtoArgsForCall []struct {
@@ -2149,6 +2169,59 @@ func (fake *FakeLocalParticipant) GetPacerReturnsOnCall(i int, result1 pacer.Pac
}{result1}
}
func (fake *FakeLocalParticipant) GetPlayoutDelayConfig() *livekit.PlayoutDelay {
fake.getPlayoutDelayConfigMutex.Lock()
ret, specificReturn := fake.getPlayoutDelayConfigReturnsOnCall[len(fake.getPlayoutDelayConfigArgsForCall)]
fake.getPlayoutDelayConfigArgsForCall = append(fake.getPlayoutDelayConfigArgsForCall, struct {
}{})
stub := fake.GetPlayoutDelayConfigStub
fakeReturns := fake.getPlayoutDelayConfigReturns
fake.recordInvocation("GetPlayoutDelayConfig", []interface{}{})
fake.getPlayoutDelayConfigMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) GetPlayoutDelayConfigCallCount() int {
fake.getPlayoutDelayConfigMutex.RLock()
defer fake.getPlayoutDelayConfigMutex.RUnlock()
return len(fake.getPlayoutDelayConfigArgsForCall)
}
func (fake *FakeLocalParticipant) GetPlayoutDelayConfigCalls(stub func() *livekit.PlayoutDelay) {
fake.getPlayoutDelayConfigMutex.Lock()
defer fake.getPlayoutDelayConfigMutex.Unlock()
fake.GetPlayoutDelayConfigStub = stub
}
func (fake *FakeLocalParticipant) GetPlayoutDelayConfigReturns(result1 *livekit.PlayoutDelay) {
fake.getPlayoutDelayConfigMutex.Lock()
defer fake.getPlayoutDelayConfigMutex.Unlock()
fake.GetPlayoutDelayConfigStub = nil
fake.getPlayoutDelayConfigReturns = struct {
result1 *livekit.PlayoutDelay
}{result1}
}
func (fake *FakeLocalParticipant) GetPlayoutDelayConfigReturnsOnCall(i int, result1 *livekit.PlayoutDelay) {
fake.getPlayoutDelayConfigMutex.Lock()
defer fake.getPlayoutDelayConfigMutex.Unlock()
fake.GetPlayoutDelayConfigStub = nil
if fake.getPlayoutDelayConfigReturnsOnCall == nil {
fake.getPlayoutDelayConfigReturnsOnCall = make(map[int]struct {
result1 *livekit.PlayoutDelay
})
}
fake.getPlayoutDelayConfigReturnsOnCall[i] = struct {
result1 *livekit.PlayoutDelay
}{result1}
}
func (fake *FakeLocalParticipant) GetPublishedTrack(arg1 livekit.TrackID) types.MediaTrack {
fake.getPublishedTrackMutex.Lock()
ret, specificReturn := fake.getPublishedTrackReturnsOnCall[len(fake.getPublishedTrackArgsForCall)]
@@ -5008,6 +5081,59 @@ func (fake *FakeLocalParticipant) SubscriptionPermissionUpdateArgsForCall(i int)
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakeLocalParticipant) SupportSyncStreamID() bool {
fake.supportSyncStreamIDMutex.Lock()
ret, specificReturn := fake.supportSyncStreamIDReturnsOnCall[len(fake.supportSyncStreamIDArgsForCall)]
fake.supportSyncStreamIDArgsForCall = append(fake.supportSyncStreamIDArgsForCall, struct {
}{})
stub := fake.SupportSyncStreamIDStub
fakeReturns := fake.supportSyncStreamIDReturns
fake.recordInvocation("SupportSyncStreamID", []interface{}{})
fake.supportSyncStreamIDMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) SupportSyncStreamIDCallCount() int {
fake.supportSyncStreamIDMutex.RLock()
defer fake.supportSyncStreamIDMutex.RUnlock()
return len(fake.supportSyncStreamIDArgsForCall)
}
func (fake *FakeLocalParticipant) SupportSyncStreamIDCalls(stub func() bool) {
fake.supportSyncStreamIDMutex.Lock()
defer fake.supportSyncStreamIDMutex.Unlock()
fake.SupportSyncStreamIDStub = stub
}
func (fake *FakeLocalParticipant) SupportSyncStreamIDReturns(result1 bool) {
fake.supportSyncStreamIDMutex.Lock()
defer fake.supportSyncStreamIDMutex.Unlock()
fake.SupportSyncStreamIDStub = nil
fake.supportSyncStreamIDReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeLocalParticipant) SupportSyncStreamIDReturnsOnCall(i int, result1 bool) {
fake.supportSyncStreamIDMutex.Lock()
defer fake.supportSyncStreamIDMutex.Unlock()
fake.SupportSyncStreamIDStub = nil
if fake.supportSyncStreamIDReturnsOnCall == nil {
fake.supportSyncStreamIDReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.supportSyncStreamIDReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeLocalParticipant) ToProto() *livekit.ParticipantInfo {
fake.toProtoMutex.Lock()
ret, specificReturn := fake.toProtoReturnsOnCall[len(fake.toProtoArgsForCall)]
@@ -5703,6 +5829,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
defer fake.getLoggerMutex.RUnlock()
fake.getPacerMutex.RLock()
defer fake.getPacerMutex.RUnlock()
fake.getPlayoutDelayConfigMutex.RLock()
defer fake.getPlayoutDelayConfigMutex.RUnlock()
fake.getPublishedTrackMutex.RLock()
defer fake.getPublishedTrackMutex.RUnlock()
fake.getPublishedTracksMutex.RLock()
@@ -5831,6 +5959,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} {
defer fake.subscriptionPermissionMutex.RUnlock()
fake.subscriptionPermissionUpdateMutex.RLock()
defer fake.subscriptionPermissionUpdateMutex.RUnlock()
fake.supportSyncStreamIDMutex.RLock()
defer fake.supportSyncStreamIDMutex.RUnlock()
fake.toProtoMutex.RLock()
defer fake.toProtoMutex.RUnlock()
fake.toProtoWithVersionMutex.RLock()
@@ -236,6 +236,16 @@ type FakeMediaTrack struct {
sourceReturnsOnCall map[int]struct {
result1 livekit.TrackSource
}
StreamStub func() string
streamMutex sync.RWMutex
streamArgsForCall []struct {
}
streamReturns struct {
result1 string
}
streamReturnsOnCall map[int]struct {
result1 string
}
ToProtoStub func() *livekit.TrackInfo
toProtoMutex sync.RWMutex
toProtoArgsForCall []struct {
@@ -1474,6 +1484,59 @@ func (fake *FakeMediaTrack) SourceReturnsOnCall(i int, result1 livekit.TrackSour
}{result1}
}
func (fake *FakeMediaTrack) Stream() string {
fake.streamMutex.Lock()
ret, specificReturn := fake.streamReturnsOnCall[len(fake.streamArgsForCall)]
fake.streamArgsForCall = append(fake.streamArgsForCall, struct {
}{})
stub := fake.StreamStub
fakeReturns := fake.streamReturns
fake.recordInvocation("Stream", []interface{}{})
fake.streamMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeMediaTrack) StreamCallCount() int {
fake.streamMutex.RLock()
defer fake.streamMutex.RUnlock()
return len(fake.streamArgsForCall)
}
func (fake *FakeMediaTrack) StreamCalls(stub func() string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = stub
}
func (fake *FakeMediaTrack) StreamReturns(result1 string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = nil
fake.streamReturns = struct {
result1 string
}{result1}
}
func (fake *FakeMediaTrack) StreamReturnsOnCall(i int, result1 string) {
fake.streamMutex.Lock()
defer fake.streamMutex.Unlock()
fake.StreamStub = nil
if fake.streamReturnsOnCall == nil {
fake.streamReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.streamReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeMediaTrack) ToProto() *livekit.TrackInfo {
fake.toProtoMutex.Lock()
ret, specificReturn := fake.toProtoReturnsOnCall[len(fake.toProtoArgsForCall)]
@@ -1615,6 +1678,8 @@ func (fake *FakeMediaTrack) Invocations() map[string][][]interface{} {
defer fake.setMutedMutex.RUnlock()
fake.sourceMutex.RLock()
defer fake.sourceMutex.RUnlock()
fake.streamMutex.RLock()
defer fake.streamMutex.RUnlock()
fake.toProtoMutex.RLock()
defer fake.toProtoMutex.RUnlock()
fake.updateVideoLayersMutex.RLock()
+19
View File
@@ -42,6 +42,25 @@ func PackStreamID(participantID livekit.ParticipantID, trackID livekit.TrackID)
return string(participantID) + trackIdSeparator + string(trackID)
}
func PackSyncStreamID(participantID livekit.ParticipantID, stream string) string {
return string(participantID) + trackIdSeparator + stream
}
func StreamFromTrackSource(source livekit.TrackSource) string {
// group camera/mic, screenshare/audio together
switch source {
case livekit.TrackSource_SCREEN_SHARE:
return "screen"
case livekit.TrackSource_SCREEN_SHARE_AUDIO:
return "screen"
case livekit.TrackSource_CAMERA:
return "camera"
case livekit.TrackSource_MICROPHONE:
return "camera"
}
return "unknown"
}
func PackDataTrackLabel(participantID livekit.ParticipantID, trackID livekit.TrackID, label string) string {
return string(participantID) + trackIdSeparator + string(trackID) + trackIdSeparator + label
}