From cf4801064d2a37d61be9be425dcd0a5d0de41bb2 Mon Sep 17 00:00:00 2001 From: kannonski Date: Wed, 19 Jul 2023 23:23:30 +0200 Subject: [PATCH 01/21] changing key file permissions control (#1893) --- pkg/config/config.go | 5 +++-- pkg/service/wire.go | 5 +++-- pkg/service/wire_gen.go | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 8b7b340e7..f13cd49e4 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -36,7 +36,7 @@ const ( ) var ( - ErrKeyFileIncorrectPermission = errors.New("key file must have 0600 permission") + ErrKeyFileIncorrectPermission = errors.New("key file others permissions must be set to 0") ErrKeysNotSet = errors.New("one of key-file or keys must be provided") ) @@ -547,9 +547,10 @@ func (conf *Config) ToCLIFlagNames(existingFlags []cli.Flag) map[string]reflect. func (conf *Config) ValidateKeys() error { // prefer keyfile if set if conf.KeyFile != "" { + var otherFilter os.FileMode = 0007 if st, err := os.Stat(conf.KeyFile); err != nil { return err - } else if st.Mode().Perm() != 0600 { + } else if st.Mode().Perm()&otherFilter != 0000 { return ErrKeyFileIncorrectPermission } f, err := os.Open(conf.KeyFile) diff --git a/pkg/service/wire.go b/pkg/service/wire.go index 126542780..bb8451e05 100644 --- a/pkg/service/wire.go +++ b/pkg/service/wire.go @@ -87,10 +87,11 @@ func getNodeID(currentNode routing.LocalNode) livekit.NodeID { func createKeyProvider(conf *config.Config) (auth.KeyProvider, error) { // prefer keyfile if set if conf.KeyFile != "" { + var otherFilter os.FileMode = 0007 if st, err := os.Stat(conf.KeyFile); err != nil { return nil, err - } else if st.Mode().Perm() != 0600 { - return nil, fmt.Errorf("key file must have permission set to 600") + } else if st.Mode().Perm()&otherFilter != 0000 { + return nil, fmt.Errorf("key file others permissions must be set to 0") } f, err := os.Open(conf.KeyFile) if err != nil { diff --git a/pkg/service/wire_gen.go b/pkg/service/wire_gen.go index 1ce19893a..ec817449d 100644 --- a/pkg/service/wire_gen.go +++ b/pkg/service/wire_gen.go @@ -132,10 +132,11 @@ func getNodeID(currentNode routing.LocalNode) livekit.NodeID { func createKeyProvider(conf *config.Config) (auth.KeyProvider, error) { if conf.KeyFile != "" { + var otherFilter os.FileMode = 0007 if st, err := os.Stat(conf.KeyFile); err != nil { return nil, err - } else if st.Mode().Perm() != 0600 { - return nil, fmt.Errorf("key file must have permission set to 600") + } else if st.Mode().Perm()&otherFilter != 0000 { + return nil, fmt.Errorf("key file others permission must be set to 0") } f, err := os.Open(conf.KeyFile) if err != nil { From 6ad1e1598d3ddf864d7b5ab4f2abcdbab5ebbf65 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Thu, 20 Jul 2023 19:13:27 -0700 Subject: [PATCH 02/21] move signal server start to server start (#1894) * move signal server start to server start * fix test --- pkg/service/server.go | 4 ++++ pkg/service/signal.go | 13 +++++++------ pkg/service/signal_test.go | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pkg/service/server.go b/pkg/service/server.go index c21b98fe0..390432116 100644 --- a/pkg/service/server.go +++ b/pkg/service/server.go @@ -227,6 +227,10 @@ func (s *LivekitServer) Start() error { go s.promServer.Serve(promLn) } + if err := s.signalServer.Start(); err != nil { + return err + } + httpGroup := &errgroup.Group{} for _, ln := range listeners { l := ln diff --git a/pkg/service/signal.go b/pkg/service/signal.go index 3de03c1ae..817344914 100644 --- a/pkg/service/signal.go +++ b/pkg/service/signal.go @@ -28,6 +28,7 @@ type SessionHandler func( type SignalServer struct { server rpc.TypedSignalServer + nodeID livekit.NodeID } func NewSignalServer( @@ -47,12 +48,7 @@ func NewSignalServer( if err != nil { return nil, err } - logger.Debugw("starting relay signal server", "topic", nodeID) - if err := s.RegisterRelaySignalTopic(nodeID); err != nil { - return nil, err - } - - return &SignalServer{s}, nil + return &SignalServer{s, nodeID}, nil } func NewDefaultSignalServer( @@ -101,6 +97,11 @@ func NewDefaultSignalServer( return NewSignalServer(livekit.NodeID(currentNode.Id), currentNode.Region, bus, config, sessionHandler) } +func (s *SignalServer) Start() error { + logger.Debugw("starting relay signal server", "topic", s.nodeID) + return s.server.RegisterRelaySignalTopic(s.nodeID) +} + func (r *SignalServer) Stop() { r.server.Kill() } diff --git a/pkg/service/signal_test.go b/pkg/service/signal_test.go index 946675864..ec83c5c3e 100644 --- a/pkg/service/signal_test.go +++ b/pkg/service/signal_test.go @@ -44,7 +44,7 @@ func TestSignal(t *testing.T) { client, err := routing.NewSignalClient(livekit.NodeID("node0"), bus, cfg) require.NoError(t, err) - _, err = NewSignalServer(livekit.NodeID("node1"), "region", bus, cfg, func( + server, err := NewSignalServer(livekit.NodeID("node1"), "region", bus, cfg, func( ctx context.Context, roomName livekit.RoomName, pi routing.ParticipantInit, @@ -62,6 +62,9 @@ func TestSignal(t *testing.T) { }) require.NoError(t, err) + err = server.Start() + require.NoError(t, err) + _, reqSink, resSource, err := client.StartParticipantSignal( context.Background(), livekit.RoomName("room1"), From 3980d049c9c3dff519de69387f26ced62aa690b5 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Thu, 20 Jul 2023 19:23:35 -0700 Subject: [PATCH 03/21] close disconnected participants when signal channel fails (#1895) * close disconnected participants when signal channel fails * fix typefake * update reason --- pkg/rtc/participant.go | 9 ++++++ pkg/rtc/types/interfaces.go | 1 + .../typesfakes/fake_local_participant.go | 30 +++++++++++++++++++ pkg/service/roommanager.go | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index e0d5214d4..587879833 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -516,6 +516,15 @@ func (p *ParticipantImpl) OnClaimsChanged(callback func(types.LocalParticipant)) p.lock.Unlock() } +func (p *ParticipantImpl) HandleSignalSourceClose() { + p.TransportManager.SetSignalSourceValid(false) + + if !p.TransportManager.HasPublisherEverConnected() && !p.TransportManager.HasSubscriberEverConnected() { + p.params.Logger.Infow("closing disconnected participant") + _ = p.Close(false, types.ParticipantCloseReasonJoinFailed, false) + } +} + // HandleOffer an offer from remote participant, used when clients make the initial connection func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription) { p.params.Logger.Debugw("received offer", "transport", livekit.SignalTarget_PUBLISHER) diff --git a/pkg/rtc/types/interfaces.go b/pkg/rtc/types/interfaces.go index 443a0a3d5..eb9336121 100644 --- a/pkg/rtc/types/interfaces.go +++ b/pkg/rtc/types/interfaces.go @@ -295,6 +295,7 @@ type LocalParticipant interface { CloseSignalConnection(reason SignallingCloseReason) UpdateLastSeenSignal() SetSignalSourceValid(valid bool) + HandleSignalSourceClose() // permissions ClaimGrants() *auth.ClaimGrants diff --git a/pkg/rtc/types/typesfakes/fake_local_participant.go b/pkg/rtc/types/typesfakes/fake_local_participant.go index deb07909f..b071877d9 100644 --- a/pkg/rtc/types/typesfakes/fake_local_participant.go +++ b/pkg/rtc/types/typesfakes/fake_local_participant.go @@ -326,6 +326,10 @@ type FakeLocalParticipant struct { handleReconnectAndSendResponseReturnsOnCall map[int]struct { result1 error } + HandleSignalSourceCloseStub func() + handleSignalSourceCloseMutex sync.RWMutex + handleSignalSourceCloseArgsForCall []struct { + } HasPermissionStub func(livekit.TrackID, livekit.ParticipantIdentity) bool hasPermissionMutex sync.RWMutex hasPermissionArgsForCall []struct { @@ -2481,6 +2485,30 @@ func (fake *FakeLocalParticipant) HandleReconnectAndSendResponseReturnsOnCall(i }{result1} } +func (fake *FakeLocalParticipant) HandleSignalSourceClose() { + fake.handleSignalSourceCloseMutex.Lock() + fake.handleSignalSourceCloseArgsForCall = append(fake.handleSignalSourceCloseArgsForCall, struct { + }{}) + stub := fake.HandleSignalSourceCloseStub + fake.recordInvocation("HandleSignalSourceClose", []interface{}{}) + fake.handleSignalSourceCloseMutex.Unlock() + if stub != nil { + fake.HandleSignalSourceCloseStub() + } +} + +func (fake *FakeLocalParticipant) HandleSignalSourceCloseCallCount() int { + fake.handleSignalSourceCloseMutex.RLock() + defer fake.handleSignalSourceCloseMutex.RUnlock() + return len(fake.handleSignalSourceCloseArgsForCall) +} + +func (fake *FakeLocalParticipant) HandleSignalSourceCloseCalls(stub func()) { + fake.handleSignalSourceCloseMutex.Lock() + defer fake.handleSignalSourceCloseMutex.Unlock() + fake.HandleSignalSourceCloseStub = stub +} + func (fake *FakeLocalParticipant) HasPermission(arg1 livekit.TrackID, arg2 livekit.ParticipantIdentity) bool { fake.hasPermissionMutex.Lock() ret, specificReturn := fake.hasPermissionReturnsOnCall[len(fake.hasPermissionArgsForCall)] @@ -5626,6 +5654,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} { defer fake.handleOfferMutex.RUnlock() fake.handleReconnectAndSendResponseMutex.RLock() defer fake.handleReconnectAndSendResponseMutex.RUnlock() + fake.handleSignalSourceCloseMutex.RLock() + defer fake.handleSignalSourceCloseMutex.RUnlock() fake.hasPermissionMutex.RLock() defer fake.hasPermissionMutex.RUnlock() fake.hiddenMutex.RLock() diff --git a/pkg/service/roommanager.go b/pkg/service/roommanager.go index bd09448dd..b0cefd31c 100644 --- a/pkg/service/roommanager.go +++ b/pkg/service/roommanager.go @@ -549,7 +549,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa // this means ICE restart isn't possible in single node mode if obj == nil { if room.GetParticipantRequestSource(participant.Identity()) == requestSource { - participant.SetSignalSourceValid(false) + participant.HandleSignalSourceClose() } return } From 6c20c7eb152018ab6b2cc0cb99bdf63fbb82177f Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Thu, 20 Jul 2023 21:21:40 -0700 Subject: [PATCH 04/21] add test for removing disconnected participants on signal close (#1896) * add test for removing disconnected participants on signal close * cleanup --- pkg/service/wire_gen.go | 2 +- test/client/client.go | 201 +++++++++++++++++++++++----------------- test/multinode_test.go | 44 +++++++++ 3 files changed, 163 insertions(+), 84 deletions(-) diff --git a/pkg/service/wire_gen.go b/pkg/service/wire_gen.go index ec817449d..b051fb954 100644 --- a/pkg/service/wire_gen.go +++ b/pkg/service/wire_gen.go @@ -136,7 +136,7 @@ func createKeyProvider(conf *config.Config) (auth.KeyProvider, error) { if st, err := os.Stat(conf.KeyFile); err != nil { return nil, err } else if st.Mode().Perm()&otherFilter != 0000 { - return nil, fmt.Errorf("key file others permission must be set to 0") + return nil, fmt.Errorf("key file others permissions must be set to 0") } f, err := os.Open(conf.KeyFile) if err != nil { diff --git a/test/client/client.go b/test/client/client.go index fa9b485a1..776d356a7 100644 --- a/test/client/client.go +++ b/test/client/client.go @@ -28,6 +28,11 @@ import ( "github.com/livekit/livekit-server/pkg/rtc/types" ) +type SignalRequestHandler func(msg *livekit.SignalRequest) error +type SignalRequestInterceptor func(msg *livekit.SignalRequest, next SignalRequestHandler) error +type SignalResponseHandler func(msg *livekit.SignalResponse) error +type SignalResponseInterceptor func(msg *livekit.SignalResponse, next SignalResponseHandler) error + type RTCClient struct { id livekit.ParticipantID conn *websocket.Conn @@ -45,6 +50,9 @@ type RTCClient struct { localParticipant *livekit.ParticipantInfo remoteParticipants map[livekit.ParticipantID]*livekit.ParticipantInfo + signalRequestInterceptor SignalRequestInterceptor + signalResponseInterceptor SignalResponseInterceptor + subscriberAsPrimary atomic.Bool publisherFullyEstablished atomic.Bool subscriberFullyEstablished atomic.Bool @@ -83,10 +91,12 @@ var ( ) type Options struct { - AutoSubscribe bool - Publish string - ClientInfo *livekit.ClientInfo - DisabledCodecs []webrtc.RTPCodecCapability + AutoSubscribe bool + Publish string + ClientInfo *livekit.ClientInfo + DisabledCodecs []webrtc.RTPCodecCapability + SignalRequestInterceptor SignalRequestInterceptor + SignalResponseInterceptor SignalResponseInterceptor } func NewWebSocketConn(host, token string, opts *Options) (*websocket.Conn, error) { @@ -265,6 +275,11 @@ func NewRTCClient(conn *websocket.Conn, opts *Options) (*RTCClient, error) { }) }) + if opts != nil { + c.signalRequestInterceptor = opts.SignalRequestInterceptor + c.signalResponseInterceptor = opts.SignalResponseInterceptor + } + return c, nil } @@ -290,89 +305,101 @@ func (c *RTCClient) Run() error { logger.Errorw("error while reading", err) return err } - switch msg := res.Message.(type) { - case *livekit.SignalResponse_Join: - c.localParticipant = msg.Join.Participant - c.id = livekit.ParticipantID(msg.Join.Participant.Sid) - c.lock.Lock() - for _, p := range msg.Join.OtherParticipants { - c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p - } - c.lock.Unlock() - // if publish only, negotiate - if !msg.Join.SubscriberPrimary { - c.subscriberAsPrimary.Store(false) - c.publisher.Negotiate(false) - } else { - c.subscriberAsPrimary.Store(true) - } - - logger.Infow("join accepted, awaiting offer", "participant", msg.Join.Participant.Identity) - case *livekit.SignalResponse_Answer: - // logger.Debugw("received server answer", - // "participant", c.localParticipant.Identity, - // "answer", msg.Answer.Sdp) - c.handleAnswer(rtc.FromProtoSessionDescription(msg.Answer)) - case *livekit.SignalResponse_Offer: - logger.Infow("received server offer", - "participant", c.localParticipant.Identity, - ) - desc := rtc.FromProtoSessionDescription(msg.Offer) - c.handleOffer(desc) - case *livekit.SignalResponse_Trickle: - candidateInit, err := rtc.FromProtoTrickle(msg.Trickle) - if err != nil { - return err - } - if msg.Trickle.Target == livekit.SignalTarget_PUBLISHER { - c.publisher.AddICECandidate(candidateInit) - } else { - c.subscriber.AddICECandidate(candidateInit) - } - case *livekit.SignalResponse_Update: - c.lock.Lock() - for _, p := range msg.Update.Participants { - if livekit.ParticipantID(p.Sid) != c.id { - if p.State != livekit.ParticipantInfo_DISCONNECTED { - c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p - } else { - delete(c.remoteParticipants, livekit.ParticipantID(p.Sid)) - } - } - } - c.lock.Unlock() - - case *livekit.SignalResponse_TrackPublished: - logger.Debugw("track published", "trackID", msg.TrackPublished.Track.Name, "participant", c.localParticipant.Sid, - "cid", msg.TrackPublished.Cid, "trackSid", msg.TrackPublished.Track.Sid) - c.lock.Lock() - c.pendingPublishedTracks[msg.TrackPublished.Cid] = msg.TrackPublished.Track - c.lock.Unlock() - case *livekit.SignalResponse_RefreshToken: - c.lock.Lock() - c.refreshToken = msg.RefreshToken - c.lock.Unlock() - case *livekit.SignalResponse_TrackUnpublished: - sid := msg.TrackUnpublished.TrackSid - c.lock.Lock() - sender := c.trackSenders[sid] - if sender != nil { - if err := c.publisher.RemoveTrack(sender); err != nil { - logger.Errorw("Could not unpublish track", err) - } - c.publisher.Negotiate(false) - } - delete(c.trackSenders, sid) - delete(c.localTracks, sid) - c.lock.Unlock() - case *livekit.SignalResponse_Pong: - c.pongReceivedAt.Store(msg.Pong) - case *livekit.SignalResponse_SubscriptionResponse: - c.subscriptionResponse.Store(msg.SubscriptionResponse) + if c.signalResponseInterceptor != nil { + err = c.signalResponseInterceptor(res, c.handleSignalResponse) + } else { + err = c.handleSignalResponse(res) + } + if err != nil { + return err } } } +func (c *RTCClient) handleSignalResponse(res *livekit.SignalResponse) error { + switch msg := res.Message.(type) { + case *livekit.SignalResponse_Join: + c.localParticipant = msg.Join.Participant + c.id = livekit.ParticipantID(msg.Join.Participant.Sid) + c.lock.Lock() + for _, p := range msg.Join.OtherParticipants { + c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p + } + c.lock.Unlock() + // if publish only, negotiate + if !msg.Join.SubscriberPrimary { + c.subscriberAsPrimary.Store(false) + c.publisher.Negotiate(false) + } else { + c.subscriberAsPrimary.Store(true) + } + + logger.Infow("join accepted, awaiting offer", "participant", msg.Join.Participant.Identity) + case *livekit.SignalResponse_Answer: + // logger.Debugw("received server answer", + // "participant", c.localParticipant.Identity, + // "answer", msg.Answer.Sdp) + c.handleAnswer(rtc.FromProtoSessionDescription(msg.Answer)) + case *livekit.SignalResponse_Offer: + logger.Infow("received server offer", + "participant", c.localParticipant.Identity, + ) + desc := rtc.FromProtoSessionDescription(msg.Offer) + c.handleOffer(desc) + case *livekit.SignalResponse_Trickle: + candidateInit, err := rtc.FromProtoTrickle(msg.Trickle) + if err != nil { + return err + } + if msg.Trickle.Target == livekit.SignalTarget_PUBLISHER { + c.publisher.AddICECandidate(candidateInit) + } else { + c.subscriber.AddICECandidate(candidateInit) + } + case *livekit.SignalResponse_Update: + c.lock.Lock() + for _, p := range msg.Update.Participants { + if livekit.ParticipantID(p.Sid) != c.id { + if p.State != livekit.ParticipantInfo_DISCONNECTED { + c.remoteParticipants[livekit.ParticipantID(p.Sid)] = p + } else { + delete(c.remoteParticipants, livekit.ParticipantID(p.Sid)) + } + } + } + c.lock.Unlock() + + case *livekit.SignalResponse_TrackPublished: + logger.Debugw("track published", "trackID", msg.TrackPublished.Track.Name, "participant", c.localParticipant.Sid, + "cid", msg.TrackPublished.Cid, "trackSid", msg.TrackPublished.Track.Sid) + c.lock.Lock() + c.pendingPublishedTracks[msg.TrackPublished.Cid] = msg.TrackPublished.Track + c.lock.Unlock() + case *livekit.SignalResponse_RefreshToken: + c.lock.Lock() + c.refreshToken = msg.RefreshToken + c.lock.Unlock() + case *livekit.SignalResponse_TrackUnpublished: + sid := msg.TrackUnpublished.TrackSid + c.lock.Lock() + sender := c.trackSenders[sid] + if sender != nil { + if err := c.publisher.RemoveTrack(sender); err != nil { + logger.Errorw("Could not unpublish track", err) + } + c.publisher.Negotiate(false) + } + delete(c.trackSenders, sid) + delete(c.localTracks, sid) + c.lock.Unlock() + case *livekit.SignalResponse_Pong: + c.pongReceivedAt.Store(msg.Pong) + case *livekit.SignalResponse_SubscriptionResponse: + c.subscriptionResponse.Store(msg.SubscriptionResponse) + } + return nil +} + func (c *RTCClient) WaitUntilConnected() error { ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() @@ -486,6 +513,14 @@ func (c *RTCClient) SendPing() error { } func (c *RTCClient) SendRequest(msg *livekit.SignalRequest) error { + if c.signalRequestInterceptor != nil { + return c.signalRequestInterceptor(msg, c.sendRequest) + } else { + return c.sendRequest(msg) + } +} + +func (c *RTCClient) sendRequest(msg *livekit.SignalRequest) error { payload, err := proto.Marshal(msg) if err != nil { return err diff --git a/test/multinode_test.go b/test/multinode_test.go index 57a2ed57e..fe973aefd 100644 --- a/test/multinode_test.go +++ b/test/multinode_test.go @@ -11,6 +11,7 @@ import ( "github.com/livekit/livekit-server/pkg/rtc" "github.com/livekit/livekit-server/pkg/testutils" + "github.com/livekit/livekit-server/test/client" ) func TestMultiNodeRouting(t *testing.T) { @@ -261,3 +262,46 @@ func TestMultiNodeRevokePublishPermission(t *testing.T) { return "" }) } + +func TestCloseDisconnectedParticipantOnSignalClose(t *testing.T) { + _, _, finish := setupMultiNodeTest("TestCloseDisconnectedParticipantOnSignalClose") + defer finish() + + c1 := createRTCClient("c1", secondServerPort, nil) + waitUntilConnected(t, c1) + + c2 := createRTCClient("c2", defaultServerPort, &client.Options{ + SignalRequestInterceptor: func(msg *livekit.SignalRequest, next client.SignalRequestHandler) error { + switch msg.Message.(type) { + case *livekit.SignalRequest_Offer, *livekit.SignalRequest_Answer, *livekit.SignalRequest_Leave: + return nil + default: + return next(msg) + } + }, + SignalResponseInterceptor: func(msg *livekit.SignalResponse, next client.SignalResponseHandler) error { + switch msg.Message.(type) { + case *livekit.SignalResponse_Offer, *livekit.SignalResponse_Answer: + return nil + default: + return next(msg) + } + }, + }) + + testutils.WithTimeout(t, func() string { + if len(c1.RemoteParticipants()) != 1 { + return "c1 did not see c2 join" + } + return "" + }) + + c2.Stop() + + testutils.WithTimeout(t, func() string { + if len(c1.RemoteParticipants()) != 0 { + return "c1 did not see c2 removed" + } + return "" + }) +} From 7e6aa0042618ca2ba47d63e482ca8b50f7be43fd Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Fri, 21 Jul 2023 16:23:00 +0530 Subject: [PATCH 05/21] Remove unused fields left over from refactor (#1897) --- pkg/sfu/streamallocator/channelobserver.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/sfu/streamallocator/channelobserver.go b/pkg/sfu/streamallocator/channelobserver.go index 0e094bdad..94b888c57 100644 --- a/pkg/sfu/streamallocator/channelobserver.go +++ b/pkg/sfu/streamallocator/channelobserver.go @@ -72,10 +72,6 @@ type ChannelObserver struct { estimateTrend *TrendDetector nackTracker *NackTracker - - nackWindowStartTime time.Time - packets uint32 - repeatedNacks uint32 } func NewChannelObserver(params ChannelObserverParams, logger logger.Logger) *ChannelObserver { From 43fa6f57d1fb2b99fce6c01da743b3eb4a073b8b Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Sun, 23 Jul 2023 10:11:35 +0530 Subject: [PATCH 06/21] A very simple leaky bucket pacer. (#1899) --- pkg/sfu/pacer/base.go | 17 +++-- pkg/sfu/pacer/leaky_bucket.go | 137 ++++++++++++++++++++++++++++++++++ pkg/sfu/pacer/pacer.go | 3 + 3 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 pkg/sfu/pacer/leaky_bucket.go diff --git a/pkg/sfu/pacer/base.go b/pkg/sfu/pacer/base.go index fef7b413e..4b5da20c9 100644 --- a/pkg/sfu/pacer/base.go +++ b/pkg/sfu/pacer/base.go @@ -22,7 +22,13 @@ func NewBase(logger logger.Logger) *Base { } } -func (b *Base) SendPacket(p *Packet) error { +func (b *Base) SetInterval(_interval time.Duration) { +} + +func (b *Base) SetBitrate(_bitrate int) { +} + +func (b *Base) SendPacket(p *Packet) (int, error) { var sendingAt time.Time var err error defer func() { @@ -34,18 +40,19 @@ func (b *Base) SendPacket(p *Packet) error { sendingAt, err = b.writeRTPHeaderExtensions(p) if err != nil { b.logger.Errorw("writing rtp header extensions err", err) - return err + return 0, err } - _, err = p.WriteStream.WriteRTP(p.Header, p.Payload) + var written int + written, err = p.WriteStream.WriteRTP(p.Header, p.Payload) if err != nil { if !errors.Is(err, io.ErrClosedPipe) { b.logger.Errorw("write rtp packet failed", err) } - return err + return 0, err } - return nil + return written, nil } // writes RTP header extensions of track diff --git a/pkg/sfu/pacer/leaky_bucket.go b/pkg/sfu/pacer/leaky_bucket.go new file mode 100644 index 000000000..6e16f7f4e --- /dev/null +++ b/pkg/sfu/pacer/leaky_bucket.go @@ -0,0 +1,137 @@ +package pacer + +import ( + "sync" + "time" + + "github.com/gammazero/deque" + "github.com/livekit/protocol/logger" +) + +const ( + maxOvershootFactor = 2.0 +) + +type LeakyBucket struct { + *Base + + logger logger.Logger + + lock sync.RWMutex + packets deque.Deque[Packet] + interval time.Duration + bitrate int + isStopped bool +} + +func NewLeakyBucket(logger logger.Logger, interval time.Duration, bitrate int) *LeakyBucket { + l := &LeakyBucket{ + Base: NewBase(logger), + logger: logger, + interval: interval, + bitrate: bitrate, + } + l.packets.SetMinCapacity(9) + + go l.sendWorker() + return l +} + +func (l *LeakyBucket) SetInterval(interval time.Duration) { + l.lock.Lock() + defer l.lock.Unlock() + + l.interval = interval +} + +func (l *LeakyBucket) SetBitrate(bitrate int) { + l.lock.Lock() + defer l.lock.Unlock() + + l.bitrate = bitrate +} + +func (l *LeakyBucket) Stop() { + l.lock.Lock() + if l.isStopped { + l.lock.Unlock() + return + } + + l.isStopped = true + l.lock.Unlock() +} + +func (l *LeakyBucket) Enqueue(p Packet) { + l.lock.Lock() + defer l.lock.Unlock() + + if !l.isStopped { + l.packets.PushBack(p) + } +} + +func (l *LeakyBucket) sendWorker() { + l.lock.RLock() + interval := l.interval + bitrate := l.bitrate + l.lock.RUnlock() + + timer := time.NewTimer(interval) + overage := 0 + + for { + <-timer.C + + l.lock.RLock() + interval = l.interval + bitrate = l.bitrate + l.lock.RUnlock() + + // calculate number of bytes that can be sent in this interval + // adjusting for overage. + intervalBytes := int(interval.Seconds() * float64(bitrate) / 8.0) + maxOvershootBytes := int(float64(intervalBytes) * maxOvershootFactor) + toSendBytes := intervalBytes - overage + if toSendBytes < 0 { + // too much overage, wait for next interval + overage = -toSendBytes + timer.Reset(interval) + continue + } + + // do not allow too much overshoot in an interval + if toSendBytes > maxOvershootBytes { + toSendBytes = maxOvershootBytes + } + + for { + l.lock.Lock() + if l.isStopped { + l.lock.Unlock() + return + } + + if l.packets.Len() == 0 { + l.lock.Unlock() + // allow overshoot in next interval with shortage in this interval + overage = -toSendBytes + timer.Reset(interval) + break + } + p := l.packets.PopFront() + l.lock.Unlock() + + written, _ := l.Base.SendPacket(&p) + toSendBytes -= written + if toSendBytes < 0 { + // overage, wait for next interval + overage = -toSendBytes + timer.Reset(interval) + break + } + } + } +} + +// ------------------------------------------------ diff --git a/pkg/sfu/pacer/pacer.go b/pkg/sfu/pacer/pacer.go index 3be8a8a86..2288d8639 100644 --- a/pkg/sfu/pacer/pacer.go +++ b/pkg/sfu/pacer/pacer.go @@ -26,6 +26,9 @@ type Packet struct { type Pacer interface { Enqueue(p Packet) Stop() + + SetInterval(interval time.Duration) + SetBitrate(bitrate int) } // ------------------------------------------------ From ffd6dc221048cab7e7f271d1efb644c7ccfa9dac Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 25 Jul 2023 13:53:21 +0530 Subject: [PATCH 07/21] Packet level ddebug logs. (#1900) Only for debugging for a bit. Not for deploy. --- pkg/sfu/downtrack.go | 95 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 5 deletions(-) diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index d943b7c75..77226e7b5 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -621,11 +621,27 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { return err } + var iPID, iTL0PICIDX, iKEYIDX, iTID, oPID, oTL0PICIDX, oKEYIDX, oTID int // TOOD-REMOVE-AFTER-DEBUG var payload []byte pool := PacketFactory.Get().(*[]byte) if len(tp.codecBytes) != 0 { - incomingVP8, _ := extPkt.Payload.(buffer.VP8) - payload = d.translateVP8PacketTo(extPkt.Packet, &incomingVP8, tp.codecBytes, pool) + incomingVP8, ok := extPkt.Payload.(buffer.VP8) + if ok { + iPID = int(incomingVP8.PictureID) + iTL0PICIDX = int(incomingVP8.TL0PICIDX) + iKEYIDX = int(incomingVP8.KEYIDX) + iTID = int(incomingVP8.TID) + + var outgoingVP8 buffer.VP8 + if uerr := outgoingVP8.Unmarshal(append(tp.codecBytes, 0x0)); uerr == nil { + oPID = int(outgoingVP8.PictureID) + oTL0PICIDX = int(outgoingVP8.TL0PICIDX) + oKEYIDX = int(outgoingVP8.KEYIDX) + oTID = int(outgoingVP8.TID) + } + + payload = d.translateVP8PacketTo(extPkt.Packet, &incomingVP8, tp.codecBytes, pool) + } } if payload == nil { payload = (*pool)[:len(extPkt.Packet.Payload)] @@ -652,6 +668,28 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { return err } + if d.kind == webrtc.RTPCodecTypeVideo { + d.logger.Debugw( + "packet debug (forwarding)", + "layer", layer, + "isn", extPkt.Packet.SequenceNumber, + "its", extPkt.Packet.Timestamp, + "im", extPkt.Packet.Marker, + "osn", hdr.SequenceNumber, + "ots", hdr.Timestamp, + "om", hdr.Marker, + "len", len(payload), + "iPID", iPID, + "iTL0PICIDX", iTL0PICIDX, + "iKEYIDX", iKEYIDX, + "iTID", iTID, + "oPID", oPID, + "oTL0PICIDX", oTL0PICIDX, + "oKEYIDX", oKEYIDX, + "oTID", oTID, + ) + } + d.pacer.Enqueue(pacer.Packet{ Header: hdr, Extensions: []pacer.ExtensionData{{ID: uint8(d.dependencyDescriptorExtID), Payload: tp.ddBytes}}, @@ -735,6 +773,16 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int, paddingOnMute bool, forceMa // last byte of padding has padding size including that byte payload[RTPPaddingMaxPayloadSize-1] = byte(RTPPaddingMaxPayloadSize) + if d.kind == webrtc.RTPCodecTypeVideo { + d.logger.Debugw( + "packet debug (padding)", + "osn", hdr.SequenceNumber, + "ots", hdr.Timestamp, + "om", hdr.Marker, + "len", len(payload), + ) + } + d.pacer.Enqueue(pacer.Packet{ Header: &hdr, Payload: payload, @@ -1488,18 +1536,22 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { numRepeatedNACKs++ } + var incomingHdr rtp.Header // TODO-REMOVE-AFTER-DEBUG var pkt rtp.Packet if err = pkt.Unmarshal(pktBuff[:n]); err != nil { + d.logger.Errorw("unmarshalling rtp packet failed in retransmit", err) continue } + incomingHdr = pkt.Header pkt.Header.SequenceNumber = meta.targetSeqNo pkt.Header.Timestamp = meta.timestamp pkt.Header.SSRC = d.ssrc pkt.Header.PayloadType = d.payloadType + var iPID, iTL0PICIDX, iKEYIDX, iTID, oPID, oTL0PICIDX, oKEYIDX, oTID int // TOOD-REMOVE-AFTER-DEBUG var payload []byte pool := PacketFactory.Get().(*[]byte) - if d.mime == "video/vp8" && len(pkt.Payload) > 0 { + if d.mime == "video/vp8" && len(pkt.Payload) > 0 && len(meta.codecBytes) != 0 { var incomingVP8 buffer.VP8 if err = incomingVP8.Unmarshal(pkt.Payload); err != nil { d.logger.Errorw("unmarshalling VP8 packet err", err) @@ -1507,15 +1559,48 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { continue } - if len(meta.codecBytes) != 0 { - payload = d.translateVP8PacketTo(&pkt, &incomingVP8, meta.codecBytes, pool) + iPID = int(incomingVP8.PictureID) + iTL0PICIDX = int(incomingVP8.TL0PICIDX) + iKEYIDX = int(incomingVP8.KEYIDX) + iTID = int(incomingVP8.TID) + + var outgoingVP8 buffer.VP8 + if uerr := outgoingVP8.Unmarshal(append(meta.codecBytes, 0x0)); uerr == nil { + oPID = int(outgoingVP8.PictureID) + oTL0PICIDX = int(outgoingVP8.TL0PICIDX) + oKEYIDX = int(outgoingVP8.KEYIDX) + oTID = int(outgoingVP8.TID) } + + payload = d.translateVP8PacketTo(&pkt, &incomingVP8, meta.codecBytes, pool) } if payload == nil { payload = (*pool)[:len(pkt.Payload)] copy(payload, pkt.Payload) } + if d.kind == webrtc.RTPCodecTypeVideo { + d.logger.Debugw( + "packet debug (retransmit)", + "layer", meta.layer, + "isn", incomingHdr.SequenceNumber, + "its", incomingHdr.Timestamp, + "im", incomingHdr.Marker, + "osn", pkt.Header.SequenceNumber, + "ots", pkt.Header.Timestamp, + "om", pkt.Header.Marker, + "len", len(payload), + "iPID", iPID, + "iTL0PICIDX", iTL0PICIDX, + "iKEYIDX", iKEYIDX, + "iTID", iTID, + "oPID", oPID, + "oTL0PICIDX", oTL0PICIDX, + "oKEYIDX", oKEYIDX, + "oTID", oTID, + ) + } + d.pacer.Enqueue(pacer.Packet{ Header: &pkt.Header, Extensions: []pacer.ExtensionData{{ID: uint8(d.dependencyDescriptorExtID), Payload: meta.ddBytes}}, From 5ae1387c6812d82221a5f4d0aea2e9ea61cc8607 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 25 Jul 2023 19:00:43 +0530 Subject: [PATCH 08/21] Return a copy of down tracks from spreader. (#1902) As shadow copy can change, do not return as is. Also use the broacast function to broadcast up track changes to down tracks. --- pkg/sfu/downtrackspreader.go | 6 +++++- pkg/sfu/receiver.go | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pkg/sfu/downtrackspreader.go b/pkg/sfu/downtrackspreader.go index 04463eb8d..8d986120e 100644 --- a/pkg/sfu/downtrackspreader.go +++ b/pkg/sfu/downtrackspreader.go @@ -34,7 +34,11 @@ func (d *DownTrackSpreader) GetDownTracks() []TrackSender { d.downTrackMu.RLock() defer d.downTrackMu.RUnlock() - return d.downTracksShadow + downTracks := make([]TrackSender, 0, len(d.downTracksShadow)) + for _, dt := range d.downTracksShadow { + downTracks = append(downTracks, dt) + } + return downTracks } func (d *DownTrackSpreader) ResetAndGetDownTracks() []TrackSender { diff --git a/pkg/sfu/receiver.go b/pkg/sfu/receiver.go index 410143844..75ba72aa5 100644 --- a/pkg/sfu/receiver.go +++ b/pkg/sfu/receiver.go @@ -408,34 +408,34 @@ func (w *WebRTCReceiver) SetMaxExpectedSpatialLayer(layer int32) { // StreamTrackerManagerListener.OnAvailableLayersChanged func (w *WebRTCReceiver) OnAvailableLayersChanged() { - for _, dt := range w.downTrackSpreader.GetDownTracks() { + w.downTrackSpreader.Broadcast(func(dt TrackSender) { dt.UpTrackLayersChange() - } + }) w.connectionStats.AddLayerTransition(w.streamTrackerManager.DistanceToDesired()) } // StreamTrackerManagerListener.OnBitrateAvailabilityChanged func (w *WebRTCReceiver) OnBitrateAvailabilityChanged() { - for _, dt := range w.downTrackSpreader.GetDownTracks() { + w.downTrackSpreader.Broadcast(func(dt TrackSender) { dt.UpTrackBitrateAvailabilityChange() - } + }) } // StreamTrackerManagerListener.OnMaxPublishedLayerChanged func (w *WebRTCReceiver) OnMaxPublishedLayerChanged(maxPublishedLayer int32) { - for _, dt := range w.downTrackSpreader.GetDownTracks() { + w.downTrackSpreader.Broadcast(func(dt TrackSender) { dt.UpTrackMaxPublishedLayerChange(maxPublishedLayer) - } + }) w.connectionStats.AddLayerTransition(w.streamTrackerManager.DistanceToDesired()) } // StreamTrackerManagerListener.OnMaxTemporalLayerSeenChanged func (w *WebRTCReceiver) OnMaxTemporalLayerSeenChanged(maxTemporalLayerSeen int32) { - for _, dt := range w.downTrackSpreader.GetDownTracks() { + w.downTrackSpreader.Broadcast(func(dt TrackSender) { dt.UpTrackMaxTemporalLayerSeenChange(maxTemporalLayerSeen) - } + }) w.connectionStats.AddLayerTransition(w.streamTrackerManager.DistanceToDesired()) } From 34a7b6099134883f3b194f8dff8a0d8aa6ad3904 Mon Sep 17 00:00:00 2001 From: "taegu.kang" <115057375+tgkang-jocoos@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:12:26 +0900 Subject: [PATCH 09/21] Update config-sample.yaml (#1904) fix typo --- config-sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-sample.yaml b/config-sample.yaml index e1cd63731..bdf63e6a0 100644 --- a/config-sample.yaml +++ b/config-sample.yaml @@ -212,7 +212,7 @@ keys: # # set UDP port range for TURN relay to connect to LiveKit SFU, by default it uses a any available port # relay_range_start: 1024 # relay_range_end: 30000 -# # set external_tl to true if using a L4 load balancer to terminate TLS. when enabled, +# # set external_tls to true if using a L4 load balancer to terminate TLS. when enabled, # # LiveKit expects unencrypted traffic on tls_port, and still advertise tls_port as a TURN/TLS candidate. # external_tls: true # # needs to match tls cert domain From 0484a68342138ac6f6c07f90d8adb42875077c59 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Wed, 26 Jul 2023 13:36:58 +0530 Subject: [PATCH 10/21] Plug a couple of holes in stream transitions. (#1905) * Plug a couple of holes in stream transitions. 1. Missed negative sign meant stealing bits from other tracks was not working. 2. When a track change (mute, unmute, subscription change) cannot be allocated, explicitly pause so that stream state update happens. Refactor stream state update a bit to make it a bit cleaner. * correct comment --- pkg/sfu/forwarder.go | 4 +- pkg/sfu/forwarder_test.go | 2 +- pkg/sfu/streamallocator/streamallocator.go | 69 +++++++++++--------- pkg/sfu/streamallocator/streamstateupdate.go | 32 +++++---- pkg/sfu/streamallocator/track.go | 10 +-- 5 files changed, 67 insertions(+), 50 deletions(-) diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index 02f711d06..b8343e756 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -1013,7 +1013,7 @@ func (f *Forwarder) ProvisionalAllocateGetBestWeightedTransition() VideoTransiti bandwidthDelta := int64(math.Max(float64(0), float64(existingBandwidthNeeded-f.provisional.Bitrates[s][t]))) transitionCost := int32(0) - // LK-TODO: SVC will need a different cost transition + // SVC-TODO: SVC will need a different cost transition if targetLayer.Spatial != s { transitionCost = TransitionCostSpatial } @@ -1036,7 +1036,7 @@ func (f *Forwarder) ProvisionalAllocateGetBestWeightedTransition() VideoTransiti return VideoTransition{ From: targetLayer, To: bestLayer, - BandwidthDelta: bestBandwidthDelta, + BandwidthDelta: -bestBandwidthDelta, } } diff --git a/pkg/sfu/forwarder_test.go b/pkg/sfu/forwarder_test.go index 2da1c524b..a99095839 100644 --- a/pkg/sfu/forwarder_test.go +++ b/pkg/sfu/forwarder_test.go @@ -847,7 +847,7 @@ func TestForwarderProvisionalAllocateGetBestWeightedTransition(t *testing.T) { expectedTransition := VideoTransition{ From: f.TargetLayer(), To: buffer.VideoLayer{Spatial: 2, Temporal: 0}, - BandwidthDelta: 2, + BandwidthDelta: -2, } transition := f.ProvisionalAllocateGetBestWeightedTransition() require.Equal(t, expectedTransition, transition) diff --git a/pkg/sfu/streamallocator/streamallocator.go b/pkg/sfu/streamallocator/streamallocator.go index f0c17db9e..4e12bceec 100644 --- a/pkg/sfu/streamallocator/streamallocator.go +++ b/pkg/sfu/streamallocator/streamallocator.go @@ -79,7 +79,7 @@ func (s streamAllocatorState) String() string { case streamAllocatorStateDeficient: return "DEFICIENT" default: - return fmt.Sprintf("%d", int(s)) + return fmt.Sprintf("UNKNOWN: %d", int(s)) } } @@ -696,8 +696,8 @@ func (s *StreamAllocator) handleSignalResume(event *Event) { if track != nil { update := NewStreamStateUpdate() - if track.SetPaused(false) { - update.HandleStreamingChange(false, track) + if track.SetStreamState(StreamStateActive) { + update.HandleStreamingChange(track, StreamStateActive) } s.maybeSendUpdate(update) } @@ -840,9 +840,7 @@ func (s *StreamAllocator) allocateTrack(track *Track) { if !s.params.Config.Enabled || s.state == streamAllocatorStateStable || !track.IsManaged() { update := NewStreamStateUpdate() allocation := track.AllocateOptimal(FlagAllowOvershootWhileOptimal) - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) s.maybeSendUpdate(update) return } @@ -867,9 +865,7 @@ func (s *StreamAllocator) allocateTrack(track *Track) { allocation := track.ProvisionalAllocateCommit() update := NewStreamStateUpdate() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) s.maybeSendUpdate(update) s.adjustState() @@ -910,9 +906,7 @@ func (s *StreamAllocator) allocateTrack(track *Track) { // commit the tracks that contributed for _, t := range contributingTracks { allocation := t.ProvisionalAllocateCommit() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, t) - } + updateStreamStateChange(t, allocation, update) } // STREAM-ALLOCATOR-TODO if got too much extra, can potentially give it to some deficient track @@ -921,9 +915,11 @@ func (s *StreamAllocator) allocateTrack(track *Track) { // commit the track that needs change if enough could be acquired or pause not allowed if !s.allowPause || bandwidthAcquired >= transition.BandwidthDelta { allocation := track.ProvisionalAllocateCommit() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) + } else { + // explicitly pause to ensure stream state update happens if a track coming out of mute cannot be allocated + allocation := track.Pause() + updateStreamStateChange(track, allocation, update) } s.maybeSendUpdate(update) @@ -989,9 +985,7 @@ func (s *StreamAllocator) maybeBoostDeficientTracks() { continue } - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) availableChannelCapacity -= allocation.BandwidthDelta if availableChannelCapacity <= 0 { @@ -1053,9 +1047,7 @@ func (s *StreamAllocator) allocateAllTracks() { } allocation := track.AllocateOptimal(FlagAllowOvershootExemptTrackWhileDeficient) - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) // STREAM-ALLOCATOR-TODO: optimistic allocation before bitrate is available will return 0. How to account for that? availableChannelCapacity -= allocation.BandwidthRequested @@ -1072,9 +1064,7 @@ func (s *StreamAllocator) allocateAllTracks() { } allocation := track.Pause() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) } } else { sorted := s.getSorted() @@ -1101,9 +1091,7 @@ func (s *StreamAllocator) allocateAllTracks() { for _, track := range sorted { allocation := track.ProvisionalAllocateCommit() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) } } @@ -1225,9 +1213,7 @@ func (s *StreamAllocator) maybeProbeWithMedia() { } update := NewStreamStateUpdate() - if allocation.PauseReason == sfu.VideoPauseReasonBandwidth && track.SetPaused(true) { - update.HandleStreamingChange(true, track) - } + updateStreamStateChange(track, allocation, update) s.maybeSendUpdate(update) s.probeController.Reset() @@ -1354,3 +1340,26 @@ func (s *StreamAllocator) getTracksHistory() map[livekit.TrackID]string { } // ------------------------------------------------ + +func updateStreamStateChange(track *Track, allocation sfu.VideoAllocation, update *StreamStateUpdate) { + updated := false + streamState := StreamStateInactive + switch allocation.PauseReason { + case sfu.VideoPauseReasonMuted: + fallthrough + + case sfu.VideoPauseReasonPubMuted: + streamState = StreamStateInactive + updated = track.SetStreamState(streamState) + + case sfu.VideoPauseReasonBandwidth: + streamState = StreamStatePaused + updated = track.SetStreamState(streamState) + } + + if updated { + update.HandleStreamingChange(track, streamState) + } +} + +// ------------------------------------------------ diff --git a/pkg/sfu/streamallocator/streamstateupdate.go b/pkg/sfu/streamallocator/streamstateupdate.go index e5b3156f7..b7bca6a2d 100644 --- a/pkg/sfu/streamallocator/streamstateupdate.go +++ b/pkg/sfu/streamallocator/streamstateupdate.go @@ -1,6 +1,8 @@ package streamallocator import ( + "fmt" + "github.com/livekit/protocol/livekit" ) @@ -9,18 +11,21 @@ import ( type StreamState int const ( - StreamStateActive StreamState = iota + StreamStateInactive StreamState = iota + StreamStateActive StreamStatePaused ) func (s StreamState) String() string { switch s { + case StreamStateInactive: + return "INACTIVE" case StreamStateActive: - return "active" + return "ACTIVE" case StreamStatePaused: - return "paused" + return "PAUSED" default: - return "unknown" + return fmt.Sprintf("UNKNOWN: %d", int(s)) } } @@ -40,19 +45,22 @@ func NewStreamStateUpdate() *StreamStateUpdate { return &StreamStateUpdate{} } -func (s *StreamStateUpdate) HandleStreamingChange(isPaused bool, track *Track) { - if isPaused { - s.StreamStates = append(s.StreamStates, &StreamStateInfo{ - ParticipantID: track.PublisherID(), - TrackID: track.ID(), - State: StreamStatePaused, - }) - } else { +func (s *StreamStateUpdate) HandleStreamingChange(track *Track, streamState StreamState) { + switch streamState { + case StreamStateInactive: + // inactive is not a notification, could get into this state because of mute + case StreamStateActive: s.StreamStates = append(s.StreamStates, &StreamStateInfo{ ParticipantID: track.PublisherID(), TrackID: track.ID(), State: StreamStateActive, }) + case StreamStatePaused: + s.StreamStates = append(s.StreamStates, &StreamStateInfo{ + ParticipantID: track.PublisherID(), + TrackID: track.ID(), + State: StreamStatePaused, + }) } } diff --git a/pkg/sfu/streamallocator/track.go b/pkg/sfu/streamallocator/track.go index 4c1a125e4..7a74d605a 100644 --- a/pkg/sfu/streamallocator/track.go +++ b/pkg/sfu/streamallocator/track.go @@ -42,7 +42,7 @@ type Track struct { isDirty bool - isPaused bool + streamState StreamState } func NewTrack( @@ -61,7 +61,7 @@ func NewTrack( nackInfos: make(map[uint16]sfu.NackInfo), nackHistory: make([]string, 0, 10), receiverReportHistory: make([]string, 0, 10), - isPaused: true, + streamState: StreamStateInactive, } t.SetPriority(0) t.SetMaxLayer(downTrack.MaxLayer()) @@ -78,12 +78,12 @@ func (t *Track) SetDirty(isDirty bool) bool { return true } -func (t *Track) SetPaused(isPaused bool) bool { - if t.isPaused == isPaused { +func (t *Track) SetStreamState(streamState StreamState) bool { + if t.streamState == streamState { return false } - t.isPaused = isPaused + t.streamState = streamState return true } From 9702d3b541d8058fceb80ae681933581250b6b65 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Wed, 26 Jul 2023 15:35:07 +0530 Subject: [PATCH 11/21] A couple of more opportunities in stream allocator. (#1906) 1. When re-allocating for a track in DEFICIENT state, try to use available headroom to accommodate change before trying to steal bits from other tracks. 2. If the changing track gives back bits (because of muting or moving to a lower layer subscription), use the returned bits to try and boost deficient track(s). --- pkg/rtc/participant.go | 1 - pkg/sfu/downtrack.go | 4 + pkg/sfu/forwarder.go | 7 ++ pkg/sfu/streamallocator/streamallocator.go | 131 ++++++++++++++------- pkg/sfu/streamallocator/track.go | 4 + 5 files changed, 106 insertions(+), 41 deletions(-) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 587879833..fbc17ac6c 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -1894,7 +1894,6 @@ func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackTyp if pendingInfo == nil { track_loop: for cid, pti := range p.pendingTracks { - ti := pti.trackInfos[0] for _, c := range ti.Codecs { if c.Cid == clientId { diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 77226e7b5..f2c89ea0d 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -1137,6 +1137,10 @@ func (d *DownTrack) ProvisionalAllocatePrepare() { d.forwarder.ProvisionalAllocatePrepare(al, brs) } +func (d *DownTrack) ProvisionalAllocateReset() { + d.forwarder.ProvisionalAllocateReset() +} + func (d *DownTrack) ProvisionalAllocate(availableChannelCapacity int64, layers buffer.VideoLayer, allowPause bool, allowOvershoot bool) int64 { return d.forwarder.ProvisionalAllocate(availableChannelCapacity, layers, allowPause, allowOvershoot) } diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index b8343e756..c0471e7b3 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -747,6 +747,13 @@ func (f *Forwarder) ProvisionalAllocatePrepare(availableLayers []int32, Bitrates copy(f.provisional.availableLayers, availableLayers) } +func (f *Forwarder) ProvisionalAllocateReset() { + f.lock.Lock() + defer f.lock.Unlock() + + f.provisional.allocatedLayer = buffer.InvalidLayer +} + func (f *Forwarder) ProvisionalAllocate(availableChannelCapacity int64, layer buffer.VideoLayer, allowPause bool, allowOvershoot bool) int64 { f.lock.Lock() defer f.lock.Unlock() diff --git a/pkg/sfu/streamallocator/streamallocator.go b/pkg/sfu/streamallocator/streamallocator.go index 4e12bceec..7a9302dac 100644 --- a/pkg/sfu/streamallocator/streamallocator.go +++ b/pkg/sfu/streamallocator/streamallocator.go @@ -847,10 +847,22 @@ func (s *StreamAllocator) allocateTrack(track *Track) { // // In DEFICIENT state, - // 1. Find cooperative transition from track that needs allocation. - // 2. If track is currently streaming at minimum, do not do anything. - // 3. If that track is giving back bits, apply the transition. - // 4. If this track needs more, ask for best offer from others and try to use it. + // Two possibilities + // 1. Available headroom is enough to accommodate track that needs change. + // Note that the track could be muted, hence stopping. + // 2. Have to steal bits from other tracks currently streaming. + // + // For both cases, do + // a. Find cooperative transition from track that needs allocation. + // b. If track is currently streaming at minimum, do not do anything. + // c. If track is giving back bits, apply the transition and use bits given + // back to boost any deficient track(s). + // + // If track needs more bits, i.e. upward transition (may need resume or higher layer subscription), + // a. Try to allocate using existing headroom. This can be tried to get the best + // possible fit for the available headroom. + // b. If there is not enough headroom to allocate anything, ask for best offer from + // other tracks that are currently streaming and try to use it. // track.ProvisionalAllocatePrepare() transition := track.ProvisionalAllocateGetCooperativeTransition(FlagAllowOvershootWhileDeficient) @@ -869,18 +881,56 @@ func (s *StreamAllocator) allocateTrack(track *Track) { s.maybeSendUpdate(update) s.adjustState() - return - // STREAM-ALLOCATOR-TODO-START - // Should use the bits given back to start any paused track. + + // Use the bits given back to boost deficient track(s). // Note layer downgrade may actually have positive delta (i.e. consume more bits) - // because of when the measurement is done. Watch for that. - // STREAM_ALLOCATOR-TODO-END + // because of when the measurement is done. But, only available headroom after + // applying the transition will be used to boost deficient track(s). + s.maybeBoostDeficientTracks() + return } - // - // This track is currently not streaming and needs bits to start. - // Try to redistribute starting with tracks that are closest to their desired. - // + // this track is currently not streaming and needs bits to start. + // first try an allocation using available headroom + availableChannelCapacity := s.getAvailableHeadroom(false) + if availableChannelCapacity > 0 { + track.ProvisionalAllocateReset() // to reset allocation from co-operative transition above and try fresh + + bestLayer := buffer.InvalidLayer + + alloc_loop: + for spatial := int32(0); spatial <= buffer.DefaultMaxLayerSpatial; spatial++ { + for temporal := int32(0); temporal <= buffer.DefaultMaxLayerTemporal; temporal++ { + layer := buffer.VideoLayer{ + Spatial: spatial, + Temporal: temporal, + } + + usedChannelCapacity := track.ProvisionalAllocate(availableChannelCapacity, layer, s.allowPause, FlagAllowOvershootWhileDeficient) + if availableChannelCapacity < usedChannelCapacity { + break alloc_loop + } + + bestLayer = layer + } + } + + if bestLayer.IsValid() { + // found layer that can fit in available headroom + update := NewStreamStateUpdate() + allocation := track.ProvisionalAllocateCommit() + updateStreamStateChange(track, allocation, update) + s.maybeSendUpdate(update) + + s.adjustState() + return + } + + track.ProvisionalAllocateReset() + transition = track.ProvisionalAllocateGetCooperativeTransition(FlagAllowOvershootWhileDeficient) // get transition again to reset above allocation attempt using available headroom + } + + // if there is not enough headroom, try to redistribute starting with tracks that are closest to their desired. bandwidthAcquired := int64(0) var contributingTracks []*Track @@ -963,16 +1013,7 @@ func (s *StreamAllocator) onProbeDone(isNotFailing bool, isGoalReached bool) { } func (s *StreamAllocator) maybeBoostDeficientTracks() { - committedChannelCapacity := s.committedChannelCapacity - if s.params.Config.MinChannelCapacity > committedChannelCapacity { - committedChannelCapacity = s.params.Config.MinChannelCapacity - s.params.Logger.Debugw( - "stream allocator: overriding channel capacity", - "actual", s.committedChannelCapacity, - "override", committedChannelCapacity, - ) - } - availableChannelCapacity := committedChannelCapacity - s.getExpectedBandwidthUsage() + availableChannelCapacity := s.getAvailableHeadroom(false) if availableChannelCapacity <= 0 { return } @@ -1018,23 +1059,7 @@ func (s *StreamAllocator) allocateAllTracks() { // update := NewStreamStateUpdate() - availableChannelCapacity := s.committedChannelCapacity - if s.params.Config.MinChannelCapacity > availableChannelCapacity { - availableChannelCapacity = s.params.Config.MinChannelCapacity - s.params.Logger.Debugw( - "stream allocator: overriding channel capacity with min channel capacity", - "actual", s.committedChannelCapacity, - "override", availableChannelCapacity, - ) - } - if s.overriddenChannelCapacity > 0 { - availableChannelCapacity = s.overriddenChannelCapacity - s.params.Logger.Debugw( - "stream allocator: overriding channel capacity", - "actual", s.committedChannelCapacity, - "override", availableChannelCapacity, - ) - } + availableChannelCapacity := s.getAvailableChannelCapacity(true) // // This pass is to find out if there is any leftover channel capacity after allocating exempt tracks. @@ -1120,6 +1145,28 @@ func (s *StreamAllocator) maybeSendUpdate(update *StreamStateUpdate) { } } +func (s *StreamAllocator) getAvailableChannelCapacity(allowOverride bool) int64 { + availableChannelCapacity := s.committedChannelCapacity + if s.params.Config.MinChannelCapacity > availableChannelCapacity { + availableChannelCapacity = s.params.Config.MinChannelCapacity + s.params.Logger.Debugw( + "stream allocator: overriding channel capacity with min channel capacity", + "actual", s.committedChannelCapacity, + "override", availableChannelCapacity, + ) + } + if allowOverride && s.overriddenChannelCapacity > 0 { + availableChannelCapacity = s.overriddenChannelCapacity + s.params.Logger.Debugw( + "stream allocator: overriding channel capacity", + "actual", s.committedChannelCapacity, + "override", availableChannelCapacity, + ) + } + + return availableChannelCapacity +} + func (s *StreamAllocator) getExpectedBandwidthUsage() int64 { expected := int64(0) for _, track := range s.getTracks() { @@ -1129,6 +1176,10 @@ func (s *StreamAllocator) getExpectedBandwidthUsage() int64 { return expected } +func (s *StreamAllocator) getAvailableHeadroom(allowOverride bool) int64 { + return s.getAvailableChannelCapacity(allowOverride) - s.getExpectedBandwidthUsage() +} + func (s *StreamAllocator) getNackDelta() (uint32, uint32) { aggPacketDelta := uint32(0) aggRepeatedNackDelta := uint32(0) diff --git a/pkg/sfu/streamallocator/track.go b/pkg/sfu/streamallocator/track.go index 7a74d605a..63d201bc8 100644 --- a/pkg/sfu/streamallocator/track.go +++ b/pkg/sfu/streamallocator/track.go @@ -146,6 +146,10 @@ func (t *Track) ProvisionalAllocatePrepare() { t.downTrack.ProvisionalAllocatePrepare() } +func (t *Track) ProvisionalAllocateReset() { + t.downTrack.ProvisionalAllocateReset() +} + func (t *Track) ProvisionalAllocate(availableChannelCapacity int64, layer buffer.VideoLayer, allowPause bool, allowOvershoot bool) int64 { return t.downTrack.ProvisionalAllocate(availableChannelCapacity, layer, allowPause, allowOvershoot) } From 886e7b024c5096a790ddfeb11a775d63f3018564 Mon Sep 17 00:00:00 2001 From: Jonas Schell Date: Wed, 26 Jul 2023 12:13:52 +0200 Subject: [PATCH 12/21] update readme (#1907) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7554e2737..3692b94e5 100644 --- a/README.md +++ b/README.md @@ -295,7 +295,7 @@ LiveKit server is licensed under Apache License v2.0.
- + From 7a10f60be7daa0fc268751d7fbbdc15207e6af10 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 27 Jul 2023 10:04:04 +0530 Subject: [PATCH 13/21] Remove packet debug. (#1909) Not showing anything too useful. --- pkg/sfu/downtrack.go | 86 +------------------------------------------- pkg/sfu/forwarder.go | 14 -------- 2 files changed, 1 insertion(+), 99 deletions(-) diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index f2c89ea0d..74f47f84b 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -621,25 +621,11 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { return err } - var iPID, iTL0PICIDX, iKEYIDX, iTID, oPID, oTL0PICIDX, oKEYIDX, oTID int // TOOD-REMOVE-AFTER-DEBUG var payload []byte pool := PacketFactory.Get().(*[]byte) if len(tp.codecBytes) != 0 { incomingVP8, ok := extPkt.Payload.(buffer.VP8) if ok { - iPID = int(incomingVP8.PictureID) - iTL0PICIDX = int(incomingVP8.TL0PICIDX) - iKEYIDX = int(incomingVP8.KEYIDX) - iTID = int(incomingVP8.TID) - - var outgoingVP8 buffer.VP8 - if uerr := outgoingVP8.Unmarshal(append(tp.codecBytes, 0x0)); uerr == nil { - oPID = int(outgoingVP8.PictureID) - oTL0PICIDX = int(outgoingVP8.TL0PICIDX) - oKEYIDX = int(outgoingVP8.KEYIDX) - oTID = int(outgoingVP8.TID) - } - payload = d.translateVP8PacketTo(extPkt.Packet, &incomingVP8, tp.codecBytes, pool) } } @@ -668,28 +654,6 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { return err } - if d.kind == webrtc.RTPCodecTypeVideo { - d.logger.Debugw( - "packet debug (forwarding)", - "layer", layer, - "isn", extPkt.Packet.SequenceNumber, - "its", extPkt.Packet.Timestamp, - "im", extPkt.Packet.Marker, - "osn", hdr.SequenceNumber, - "ots", hdr.Timestamp, - "om", hdr.Marker, - "len", len(payload), - "iPID", iPID, - "iTL0PICIDX", iTL0PICIDX, - "iKEYIDX", iKEYIDX, - "iTID", iTID, - "oPID", oPID, - "oTL0PICIDX", oTL0PICIDX, - "oKEYIDX", oKEYIDX, - "oTID", oTID, - ) - } - d.pacer.Enqueue(pacer.Packet{ Header: hdr, Extensions: []pacer.ExtensionData{{ID: uint8(d.dependencyDescriptorExtID), Payload: tp.ddBytes}}, @@ -773,16 +737,6 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int, paddingOnMute bool, forceMa // last byte of padding has padding size including that byte payload[RTPPaddingMaxPayloadSize-1] = byte(RTPPaddingMaxPayloadSize) - if d.kind == webrtc.RTPCodecTypeVideo { - d.logger.Debugw( - "packet debug (padding)", - "osn", hdr.SequenceNumber, - "ots", hdr.Timestamp, - "om", hdr.Marker, - "len", len(payload), - ) - } - d.pacer.Enqueue(pacer.Packet{ Header: &hdr, Payload: payload, @@ -1540,19 +1494,16 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { numRepeatedNACKs++ } - var incomingHdr rtp.Header // TODO-REMOVE-AFTER-DEBUG var pkt rtp.Packet if err = pkt.Unmarshal(pktBuff[:n]); err != nil { d.logger.Errorw("unmarshalling rtp packet failed in retransmit", err) continue } - incomingHdr = pkt.Header pkt.Header.SequenceNumber = meta.targetSeqNo pkt.Header.Timestamp = meta.timestamp pkt.Header.SSRC = d.ssrc pkt.Header.PayloadType = d.payloadType - var iPID, iTL0PICIDX, iKEYIDX, iTID, oPID, oTL0PICIDX, oKEYIDX, oTID int // TOOD-REMOVE-AFTER-DEBUG var payload []byte pool := PacketFactory.Get().(*[]byte) if d.mime == "video/vp8" && len(pkt.Payload) > 0 && len(meta.codecBytes) != 0 { @@ -1563,19 +1514,6 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { continue } - iPID = int(incomingVP8.PictureID) - iTL0PICIDX = int(incomingVP8.TL0PICIDX) - iKEYIDX = int(incomingVP8.KEYIDX) - iTID = int(incomingVP8.TID) - - var outgoingVP8 buffer.VP8 - if uerr := outgoingVP8.Unmarshal(append(meta.codecBytes, 0x0)); uerr == nil { - oPID = int(outgoingVP8.PictureID) - oTL0PICIDX = int(outgoingVP8.TL0PICIDX) - oKEYIDX = int(outgoingVP8.KEYIDX) - oTID = int(outgoingVP8.TID) - } - payload = d.translateVP8PacketTo(&pkt, &incomingVP8, meta.codecBytes, pool) } if payload == nil { @@ -1583,28 +1521,6 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { copy(payload, pkt.Payload) } - if d.kind == webrtc.RTPCodecTypeVideo { - d.logger.Debugw( - "packet debug (retransmit)", - "layer", meta.layer, - "isn", incomingHdr.SequenceNumber, - "its", incomingHdr.Timestamp, - "im", incomingHdr.Marker, - "osn", pkt.Header.SequenceNumber, - "ots", pkt.Header.Timestamp, - "om", pkt.Header.Marker, - "len", len(payload), - "iPID", iPID, - "iTL0PICIDX", iTL0PICIDX, - "iKEYIDX", iKEYIDX, - "iTID", iTID, - "oPID", oPID, - "oTL0PICIDX", oTL0PICIDX, - "oKEYIDX", oKEYIDX, - "oTID", oTID, - ) - } - d.pacer.Enqueue(pacer.Packet{ Header: &pkt.Header, Extensions: []pacer.ExtensionData{{ID: uint8(d.dependencyDescriptorExtID), Payload: meta.ddBytes}}, @@ -1892,7 +1808,7 @@ func (d *DownTrack) packetSent(md interface{}, hdr *rtp.Header, payloadSize int, d.isNACKThrottled.Store(false) d.rtpStats.UpdateKeyFrame(1) d.logger.Debugw( - "forwarding key frame", + "forwarded key frame", "layer", spmd.layer, "rtpsn", hdr.SequenceNumber, "rtpts", hdr.Timestamp, diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index c0471e7b3..36edeb558 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -1984,20 +1984,6 @@ done: if !targetLayer.IsValid() { distance += (maxSeenLayer.Temporal + 1) } - // TODO-REMOVE-AFTER-DEBUG - logger.Debugw( - "distance to desired", - "maxSeenLauer", maxSeenLayer, - "availableLayers", availableLayers, - "brs", brs, - "targetLayer", targetLayer, - "maxLayer", maxLayer, - "adjustedMaxLayer", adjustedMaxLayer, - "maxAvailableSpatial", maxAvailableSpatial, - "maxAvailableTemporal", maxAvailableTemporal, - "distance", distance, - "distanceToDesired", float64(distance)/float64(maxSeenLayer.Temporal+1), - ) return float64(distance) / float64(maxSeenLayer.Temporal+1) } From ee1c23eb0260ae52e459f2626e6548991610e1d7 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 27 Jul 2023 11:48:22 +0530 Subject: [PATCH 14/21] Move congestion controller channel observer params to config (#1910) --- pkg/config/config.go | 42 ++++++++++++++++++---- pkg/sfu/streamallocator/channelobserver.go | 26 ++++++-------- pkg/sfu/streamallocator/streamallocator.go | 42 ++++++++-------------- 3 files changed, 60 insertions(+), 50 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index f13cd49e4..9de991d08 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -123,13 +123,25 @@ type CongestionControlProbeConfig struct { DurationIncreaseFactor float64 `yaml:"duration_increase_factor,omitempty"` } +type CongestionControlChannelObserverConfig struct { + EstimateRequiredSamples int `yaml:"estimate_required_samples,omitmpety"` + EstimateDownwardTrendThreshold float64 `yaml:"estimate_downward_trend_threshold,omitempty"` + EstimateCollapseThreshold time.Duration `yaml:"estimate_collapse_threshold,omitempty"` + EstimateValidityWindow time.Duration `yaml:"estimate_validity_window,omitempty"` + NackWindowMinDuration time.Duration `yaml:"nack_window_min_duration,omitempty"` + NackWindowMaxDuration time.Duration `yaml:"nack_window_max_duration,omitempty"` + NackRatioThreshold float64 `yaml:"nack_ratio_threshold,omitempty"` +} + type CongestionControlConfig struct { - Enabled bool `yaml:"enabled"` - AllowPause bool `yaml:"allow_pause"` - UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"` - ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"` - MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"` - ProbeConfig CongestionControlProbeConfig `yaml:"probe_config,omitempty"` + Enabled bool `yaml:"enabled"` + AllowPause bool `yaml:"allow_pause"` + UseSendSideBWE bool `yaml:"send_side_bandwidth_estimation,omitempty"` + ProbeMode CongestionControlProbeMode `yaml:"padding_mode,omitempty"` + MinChannelCapacity int64 `yaml:"min_channel_capacity,omitempty"` + ProbeConfig CongestionControlProbeConfig `yaml:"probe_config,omitempty"` + ChannelObserverProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_probe_config,omitempty"` + ChannelObserverNonProbeConfig CongestionControlChannelObserverConfig `yaml:"channel_observer_non_probe_config,omitempty"` } type AudioConfig struct { @@ -303,6 +315,24 @@ var DefaultConfig = Config{ DurationOverflowFactor: 1.25, DurationIncreaseFactor: 1.5, }, + ChannelObserverProbeConfig: CongestionControlChannelObserverConfig{ + EstimateRequiredSamples: 3, + EstimateDownwardTrendThreshold: 0.0, + EstimateCollapseThreshold: 0, + EstimateValidityWindow: 10 * time.Second, + NackWindowMinDuration: 500 * time.Millisecond, + NackWindowMaxDuration: 1 * time.Second, + NackRatioThreshold: 0.04, + }, + ChannelObserverNonProbeConfig: CongestionControlChannelObserverConfig{ + EstimateRequiredSamples: 8, + EstimateDownwardTrendThreshold: -0.5, + EstimateCollapseThreshold: 500 * time.Millisecond, + EstimateValidityWindow: 10 * time.Second, + NackWindowMinDuration: 1 * time.Second, + NackWindowMaxDuration: 2 * time.Second, + NackRatioThreshold: 0.08, + }, }, }, Audio: AudioConfig{ diff --git a/pkg/sfu/streamallocator/channelobserver.go b/pkg/sfu/streamallocator/channelobserver.go index 94b888c57..9776f8c8a 100644 --- a/pkg/sfu/streamallocator/channelobserver.go +++ b/pkg/sfu/streamallocator/channelobserver.go @@ -2,8 +2,8 @@ package streamallocator import ( "fmt" - "time" + "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/protocol/logger" ) @@ -56,14 +56,8 @@ func (c ChannelCongestionReason) String() string { // ------------------------------------------------ type ChannelObserverParams struct { - Name string - EstimateRequiredSamples int - EstimateDownwardTrendThreshold float64 - EstimateCollapseThreshold time.Duration - EstimateValidityWindow time.Duration - NackWindowMinDuration time.Duration - NackWindowMaxDuration time.Duration - NackRatioThreshold float64 + Name string + Config config.CongestionControlChannelObserverConfig } type ChannelObserver struct { @@ -81,17 +75,17 @@ func NewChannelObserver(params ChannelObserverParams, logger logger.Logger) *Cha estimateTrend: NewTrendDetector(TrendDetectorParams{ Name: params.Name + "-estimate", Logger: logger, - RequiredSamples: params.EstimateRequiredSamples, - DownwardTrendThreshold: params.EstimateDownwardTrendThreshold, - CollapseThreshold: params.EstimateCollapseThreshold, - ValidityWindow: params.EstimateValidityWindow, + RequiredSamples: params.Config.EstimateRequiredSamples, + DownwardTrendThreshold: params.Config.EstimateDownwardTrendThreshold, + CollapseThreshold: params.Config.EstimateCollapseThreshold, + ValidityWindow: params.Config.EstimateValidityWindow, }), nackTracker: NewNackTracker(NackTrackerParams{ Name: params.Name + "-nack", Logger: logger, - WindowMinDuration: params.NackWindowMinDuration, - WindowMaxDuration: params.NackWindowMaxDuration, - RatioThreshold: params.NackRatioThreshold, + WindowMinDuration: params.Config.NackWindowMinDuration, + WindowMaxDuration: params.Config.NackWindowMaxDuration, + RatioThreshold: params.Config.NackRatioThreshold, }), } } diff --git a/pkg/sfu/streamallocator/streamallocator.go b/pkg/sfu/streamallocator/streamallocator.go index 7a9302dac..30d7d8616 100644 --- a/pkg/sfu/streamallocator/streamallocator.go +++ b/pkg/sfu/streamallocator/streamallocator.go @@ -39,32 +39,6 @@ const ( // --------------------------------------------------------------------------- -var ( - ChannelObserverParamsProbe = ChannelObserverParams{ - Name: "probe", - EstimateRequiredSamples: 3, - EstimateDownwardTrendThreshold: 0.0, - EstimateCollapseThreshold: 0, - EstimateValidityWindow: 10 * time.Second, - NackWindowMinDuration: 500 * time.Millisecond, - NackWindowMaxDuration: 1 * time.Second, - NackRatioThreshold: 0.04, - } - - ChannelObserverParamsNonProbe = ChannelObserverParams{ - Name: "non-probe", - EstimateRequiredSamples: 8, - EstimateDownwardTrendThreshold: -0.5, - EstimateCollapseThreshold: 500 * time.Millisecond, - EstimateValidityWindow: 10 * time.Second, - NackWindowMinDuration: 1 * time.Second, - NackWindowMaxDuration: 2 * time.Second, - NackRatioThreshold: 0.08, - } -) - -// --------------------------------------------------------------------------- - type streamAllocatorState int const ( @@ -1193,11 +1167,23 @@ func (s *StreamAllocator) getNackDelta() (uint32, uint32) { } func (s *StreamAllocator) newChannelObserverProbe() *ChannelObserver { - return NewChannelObserver(ChannelObserverParamsProbe, s.params.Logger) + return NewChannelObserver( + ChannelObserverParams{ + Name: "probe", + Config: s.params.Config.ChannelObserverProbeConfig, + }, + s.params.Logger, + ) } func (s *StreamAllocator) newChannelObserverNonProbe() *ChannelObserver { - return NewChannelObserver(ChannelObserverParamsNonProbe, s.params.Logger) + return NewChannelObserver( + ChannelObserverParams{ + Name: "non-probe", + Config: s.params.Config.ChannelObserverNonProbeConfig, + }, + s.params.Logger, + ) } func (s *StreamAllocator) initProbe(probeGoalDeltaBps int64) { From 38c4eba5a36131a148d61ddbf797df2699f4c2df Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 27 Jul 2023 12:02:12 +0530 Subject: [PATCH 15/21] Fix spelling (#1911) --- pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 9de991d08..5a7626759 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -124,7 +124,7 @@ type CongestionControlProbeConfig struct { } type CongestionControlChannelObserverConfig struct { - EstimateRequiredSamples int `yaml:"estimate_required_samples,omitmpety"` + EstimateRequiredSamples int `yaml:"estimate_required_samples,omitempty"` EstimateDownwardTrendThreshold float64 `yaml:"estimate_downward_trend_threshold,omitempty"` EstimateCollapseThreshold time.Duration `yaml:"estimate_collapse_threshold,omitempty"` EstimateValidityWindow time.Duration `yaml:"estimate_validity_window,omitempty"` From fc7d4bd01eca3b043ae67dd2f03ac32fed6de96e Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 27 Jul 2023 16:50:18 +0530 Subject: [PATCH 16/21] E2EE trailer for server injected packets. (#1908) * Ability to use trailer with server injected frames A 32-byte trailer generated per room. Trailer appended when track encryption is enabled. * E2EE trailer for server injected packets. - Generate a 32-byte per room trailer. Too reasons for longer length o Laziness: utils generates a 32 byte string. o Longer length random string reduces chances of colliding with real data. - Trailer sent in JoinResponse - Trailer added to server injected frames (not to padding only packets) * generate * add a length check * pass trailer in as an argument --- pkg/rtc/mediatrackreceiver.go | 7 ++ pkg/rtc/mediatracksubscriptions.go | 5 ++ pkg/rtc/participant.go | 7 ++ pkg/rtc/room.go | 13 ++++ pkg/rtc/types/interfaces.go | 3 + .../typesfakes/fake_local_media_track.go | 65 +++++++++++++++++++ .../typesfakes/fake_local_participant.go | 65 +++++++++++++++++++ pkg/rtc/types/typesfakes/fake_media_track.go | 65 +++++++++++++++++++ pkg/service/roommanager.go | 1 + pkg/sfu/downtrack.go | 35 +++++++--- 10 files changed, 257 insertions(+), 9 deletions(-) diff --git a/pkg/rtc/mediatrackreceiver.go b/pkg/rtc/mediatrackreceiver.go index 8fc33f20f..a35b328a4 100644 --- a/pkg/rtc/mediatrackreceiver.go +++ b/pkg/rtc/mediatrackreceiver.go @@ -800,4 +800,11 @@ func (t *MediaTrackReceiver) GetTemporalLayerForSpatialFps(spatial int32, fps ui return buffer.DefaultMaxLayerTemporal } +func (t *MediaTrackReceiver) IsEncrypted() bool { + t.lock.RLock() + defer t.lock.RUnlock() + + return t.trackInfo.Encryption != livekit.Encryption_NONE +} + // --------------------------- diff --git a/pkg/rtc/mediatracksubscriptions.go b/pkg/rtc/mediatracksubscriptions.go index 8887176cd..2b107d9bd 100644 --- a/pkg/rtc/mediatracksubscriptions.go +++ b/pkg/rtc/mediatracksubscriptions.go @@ -98,6 +98,10 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr * for _, c := range codecs { c.RTCPFeedback = rtcpFeedback } + var trailer []byte + if t.params.MediaTrack.IsEncrypted() { + trailer = sub.GetTrailer() + } downTrack, err := sfu.NewDownTrack( codecs, wr, @@ -105,6 +109,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr * subscriberID, t.params.ReceiverConfig.PacketBufferSize, sub.GetPacer(), + trailer, LoggerWithTrack(sub.GetLogger(), trackID, t.params.IsRelayed), ) if err != nil { diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index fbc17ac6c..759b39523 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -68,6 +68,7 @@ type ParticipantParams struct { VideoConfig config.VideoConfig ProtocolVersion types.ProtocolVersion Telemetry telemetry.TelemetryService + Trailer []byte PLIThrottleConfig config.PLIThrottleConfig CongestionControlConfig config.CongestionControlConfig EnabledCodecs []*livekit.Codec @@ -224,6 +225,12 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) { return p, nil } +func (p *ParticipantImpl) GetTrailer() []byte { + trailer := make([]byte, len(p.params.Trailer)) + copy(trailer, p.params.Trailer) + return trailer +} + func (p *ParticipantImpl) GetLogger() logger.Logger { return p.params.Logger } diff --git a/pkg/rtc/room.go b/pkg/rtc/room.go index 7602659ac..a609a25d2 100644 --- a/pkg/rtc/room.go +++ b/pkg/rtc/room.go @@ -77,6 +77,8 @@ type Room struct { leftAt atomic.Int64 closed chan struct{} + trailer []byte + onParticipantChanged func(p types.LocalParticipant) onRoomUpdated func() onClose func() @@ -111,6 +113,7 @@ func NewRoom( bufferFactory: buffer.NewFactoryOfBufferFactory(config.Receiver.PacketBufferSize), batchedUpdates: make(map[livekit.ParticipantIdentity]*livekit.ParticipantInfo), closed: make(chan struct{}), + trailer: []byte(utils.RandomSecret()), } r.protoProxy = utils.NewProtoProxy[*livekit.Room](roomUpdateInterval, r.updateProto) if r.protoRoom.EmptyTimeout == 0 { @@ -139,6 +142,15 @@ func (r *Room) ID() livekit.RoomID { return livekit.RoomID(r.protoRoom.Sid) } +func (r *Room) Trailer() []byte { + r.lock.RLock() + defer r.lock.RUnlock() + + trailer := make([]byte, len(r.trailer)) + copy(trailer, r.trailer) + return trailer +} + func (r *Room) GetParticipant(identity livekit.ParticipantIdentity) types.LocalParticipant { r.lock.RLock() defer r.lock.RUnlock() @@ -821,6 +833,7 @@ func (r *Room) createJoinResponseLocked(participant types.LocalParticipant, iceS ServerInfo: r.serverInfo, ServerVersion: r.serverInfo.Version, ServerRegion: r.serverInfo.Region, + SifTrailer: r.trailer, } } diff --git a/pkg/rtc/types/interfaces.go b/pkg/rtc/types/interfaces.go index eb9336121..6a426b521 100644 --- a/pkg/rtc/types/interfaces.go +++ b/pkg/rtc/types/interfaces.go @@ -277,6 +277,7 @@ type LocalParticipant interface { ToProtoWithVersion() (*livekit.ParticipantInfo, utils.TimedVersion) // getters + GetTrailer() []byte GetLogger() logger.Logger GetAdaptiveStream() bool ProtocolVersion() ProtocolVersion @@ -449,6 +450,8 @@ type MediaTrack interface { Receivers() []sfu.TrackReceiver ClearAllReceivers(willBeResumed bool) + + IsEncrypted() bool } //counterfeiter:generate . LocalMediaTrack diff --git a/pkg/rtc/types/typesfakes/fake_local_media_track.go b/pkg/rtc/types/typesfakes/fake_local_media_track.go index f6ee5b324..0b9a4517c 100644 --- a/pkg/rtc/types/typesfakes/fake_local_media_track.go +++ b/pkg/rtc/types/typesfakes/fake_local_media_track.go @@ -128,6 +128,16 @@ type FakeLocalMediaTrack struct { iDReturnsOnCall map[int]struct { result1 livekit.TrackID } + IsEncryptedStub func() bool + isEncryptedMutex sync.RWMutex + isEncryptedArgsForCall []struct { + } + isEncryptedReturns struct { + result1 bool + } + isEncryptedReturnsOnCall map[int]struct { + result1 bool + } IsMutedStub func() bool isMutedMutex sync.RWMutex isMutedArgsForCall []struct { @@ -928,6 +938,59 @@ func (fake *FakeLocalMediaTrack) IDReturnsOnCall(i int, result1 livekit.TrackID) }{result1} } +func (fake *FakeLocalMediaTrack) IsEncrypted() bool { + fake.isEncryptedMutex.Lock() + ret, specificReturn := fake.isEncryptedReturnsOnCall[len(fake.isEncryptedArgsForCall)] + fake.isEncryptedArgsForCall = append(fake.isEncryptedArgsForCall, struct { + }{}) + stub := fake.IsEncryptedStub + fakeReturns := fake.isEncryptedReturns + fake.recordInvocation("IsEncrypted", []interface{}{}) + fake.isEncryptedMutex.Unlock() + if stub != nil { + return stub() + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeLocalMediaTrack) IsEncryptedCallCount() int { + fake.isEncryptedMutex.RLock() + defer fake.isEncryptedMutex.RUnlock() + return len(fake.isEncryptedArgsForCall) +} + +func (fake *FakeLocalMediaTrack) IsEncryptedCalls(stub func() bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = stub +} + +func (fake *FakeLocalMediaTrack) IsEncryptedReturns(result1 bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = nil + fake.isEncryptedReturns = struct { + result1 bool + }{result1} +} + +func (fake *FakeLocalMediaTrack) IsEncryptedReturnsOnCall(i int, result1 bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = nil + if fake.isEncryptedReturnsOnCall == nil { + fake.isEncryptedReturnsOnCall = make(map[int]struct { + result1 bool + }) + } + fake.isEncryptedReturnsOnCall[i] = struct { + result1 bool + }{result1} +} + func (fake *FakeLocalMediaTrack) IsMuted() bool { fake.isMutedMutex.Lock() ret, specificReturn := fake.isMutedReturnsOnCall[len(fake.isMutedArgsForCall)] @@ -1947,6 +2010,8 @@ func (fake *FakeLocalMediaTrack) Invocations() map[string][][]interface{} { defer fake.hasSdpCidMutex.RUnlock() fake.iDMutex.RLock() defer fake.iDMutex.RUnlock() + fake.isEncryptedMutex.RLock() + defer fake.isEncryptedMutex.RUnlock() fake.isMutedMutex.RLock() defer fake.isMutedMutex.RUnlock() fake.isOpenMutex.RLock() diff --git a/pkg/rtc/types/typesfakes/fake_local_participant.go b/pkg/rtc/types/typesfakes/fake_local_participant.go index b071877d9..6e3863a45 100644 --- a/pkg/rtc/types/typesfakes/fake_local_participant.go +++ b/pkg/rtc/types/typesfakes/fake_local_participant.go @@ -304,6 +304,16 @@ type FakeLocalParticipant struct { getSubscribedTracksReturnsOnCall map[int]struct { result1 []types.SubscribedTrack } + GetTrailerStub func() []byte + getTrailerMutex sync.RWMutex + getTrailerArgsForCall []struct { + } + getTrailerReturns struct { + result1 []byte + } + getTrailerReturnsOnCall map[int]struct { + result1 []byte + } HandleAnswerStub func(webrtc.SessionDescription) handleAnswerMutex sync.RWMutex handleAnswerArgsForCall []struct { @@ -2359,6 +2369,59 @@ func (fake *FakeLocalParticipant) GetSubscribedTracksReturnsOnCall(i int, result }{result1} } +func (fake *FakeLocalParticipant) GetTrailer() []byte { + fake.getTrailerMutex.Lock() + ret, specificReturn := fake.getTrailerReturnsOnCall[len(fake.getTrailerArgsForCall)] + fake.getTrailerArgsForCall = append(fake.getTrailerArgsForCall, struct { + }{}) + stub := fake.GetTrailerStub + fakeReturns := fake.getTrailerReturns + fake.recordInvocation("GetTrailer", []interface{}{}) + fake.getTrailerMutex.Unlock() + if stub != nil { + return stub() + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeLocalParticipant) GetTrailerCallCount() int { + fake.getTrailerMutex.RLock() + defer fake.getTrailerMutex.RUnlock() + return len(fake.getTrailerArgsForCall) +} + +func (fake *FakeLocalParticipant) GetTrailerCalls(stub func() []byte) { + fake.getTrailerMutex.Lock() + defer fake.getTrailerMutex.Unlock() + fake.GetTrailerStub = stub +} + +func (fake *FakeLocalParticipant) GetTrailerReturns(result1 []byte) { + fake.getTrailerMutex.Lock() + defer fake.getTrailerMutex.Unlock() + fake.GetTrailerStub = nil + fake.getTrailerReturns = struct { + result1 []byte + }{result1} +} + +func (fake *FakeLocalParticipant) GetTrailerReturnsOnCall(i int, result1 []byte) { + fake.getTrailerMutex.Lock() + defer fake.getTrailerMutex.Unlock() + fake.GetTrailerStub = nil + if fake.getTrailerReturnsOnCall == nil { + fake.getTrailerReturnsOnCall = make(map[int]struct { + result1 []byte + }) + } + fake.getTrailerReturnsOnCall[i] = struct { + result1 []byte + }{result1} +} + func (fake *FakeLocalParticipant) HandleAnswer(arg1 webrtc.SessionDescription) { fake.handleAnswerMutex.Lock() fake.handleAnswerArgsForCall = append(fake.handleAnswerArgsForCall, struct { @@ -5648,6 +5711,8 @@ func (fake *FakeLocalParticipant) Invocations() map[string][][]interface{} { defer fake.getSubscribedParticipantsMutex.RUnlock() fake.getSubscribedTracksMutex.RLock() defer fake.getSubscribedTracksMutex.RUnlock() + fake.getTrailerMutex.RLock() + defer fake.getTrailerMutex.RUnlock() fake.handleAnswerMutex.RLock() defer fake.handleAnswerMutex.RUnlock() fake.handleOfferMutex.RLock() diff --git a/pkg/rtc/types/typesfakes/fake_media_track.go b/pkg/rtc/types/typesfakes/fake_media_track.go index de0e870f4..bb0c07e31 100644 --- a/pkg/rtc/types/typesfakes/fake_media_track.go +++ b/pkg/rtc/types/typesfakes/fake_media_track.go @@ -93,6 +93,16 @@ type FakeMediaTrack struct { iDReturnsOnCall map[int]struct { result1 livekit.TrackID } + IsEncryptedStub func() bool + isEncryptedMutex sync.RWMutex + isEncryptedArgsForCall []struct { + } + isEncryptedReturns struct { + result1 bool + } + isEncryptedReturnsOnCall map[int]struct { + result1 bool + } IsMutedStub func() bool isMutedMutex sync.RWMutex isMutedArgsForCall []struct { @@ -689,6 +699,59 @@ func (fake *FakeMediaTrack) IDReturnsOnCall(i int, result1 livekit.TrackID) { }{result1} } +func (fake *FakeMediaTrack) IsEncrypted() bool { + fake.isEncryptedMutex.Lock() + ret, specificReturn := fake.isEncryptedReturnsOnCall[len(fake.isEncryptedArgsForCall)] + fake.isEncryptedArgsForCall = append(fake.isEncryptedArgsForCall, struct { + }{}) + stub := fake.IsEncryptedStub + fakeReturns := fake.isEncryptedReturns + fake.recordInvocation("IsEncrypted", []interface{}{}) + fake.isEncryptedMutex.Unlock() + if stub != nil { + return stub() + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeMediaTrack) IsEncryptedCallCount() int { + fake.isEncryptedMutex.RLock() + defer fake.isEncryptedMutex.RUnlock() + return len(fake.isEncryptedArgsForCall) +} + +func (fake *FakeMediaTrack) IsEncryptedCalls(stub func() bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = stub +} + +func (fake *FakeMediaTrack) IsEncryptedReturns(result1 bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = nil + fake.isEncryptedReturns = struct { + result1 bool + }{result1} +} + +func (fake *FakeMediaTrack) IsEncryptedReturnsOnCall(i int, result1 bool) { + fake.isEncryptedMutex.Lock() + defer fake.isEncryptedMutex.Unlock() + fake.IsEncryptedStub = nil + if fake.isEncryptedReturnsOnCall == nil { + fake.isEncryptedReturnsOnCall = make(map[int]struct { + result1 bool + }) + } + fake.isEncryptedReturnsOnCall[i] = struct { + result1 bool + }{result1} +} + func (fake *FakeMediaTrack) IsMuted() bool { fake.isMutedMutex.Lock() ret, specificReturn := fake.isMutedReturnsOnCall[len(fake.isMutedArgsForCall)] @@ -1522,6 +1585,8 @@ func (fake *FakeMediaTrack) Invocations() map[string][][]interface{} { defer fake.getTemporalLayerForSpatialFpsMutex.RUnlock() fake.iDMutex.RLock() defer fake.iDMutex.RUnlock() + fake.isEncryptedMutex.RLock() + defer fake.isEncryptedMutex.RUnlock() fake.isMutedMutex.RLock() defer fake.isMutedMutex.RUnlock() fake.isOpenMutex.RLock() diff --git a/pkg/service/roommanager.go b/pkg/service/roommanager.go index b0cefd31c..1920ecda3 100644 --- a/pkg/service/roommanager.go +++ b/pkg/service/roommanager.go @@ -351,6 +351,7 @@ func (r *RoomManager) StartSession( VideoConfig: r.config.Video, ProtocolVersion: pv, Telemetry: r.telemetry, + Trailer: room.Trailer(), PLIThrottleConfig: r.config.RTC.PLIThrottle, CongestionControlConfig: r.config.RTC.CongestionControl, EnabledCodecs: protoRoom.EnabledCodecs, diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 74f47f84b..4147b1650 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -240,6 +240,8 @@ type DownTrack struct { maxLayerNotifierCh chan struct{} + trailer []byte + cbMu sync.RWMutex onStatsUpdate func(dt *DownTrack, stat *livekit.AnalyticsStat) onMaxSubscribedLayerChanged func(dt *DownTrack, layer int32) @@ -255,6 +257,7 @@ func NewDownTrack( subID livekit.ParticipantID, mt int, pacer pacer.Pacer, + trailer []byte, logger logger.Logger, ) (*DownTrack, error) { var kind webrtc.RTPCodecType @@ -279,6 +282,7 @@ func NewDownTrack( kind: kind, codec: codecs[0].RTPCodecCapability, pacer: pacer, + trailer: trailer, maxLayerNotifierCh: make(chan struct{}, 20), } d.forwarder = NewForwarder( @@ -1273,19 +1277,30 @@ func (d *DownTrack) writeBlankFrameRTP(duration float32, generation uint32) chan return done } +func (d *DownTrack) maybeAddTrailer(buf []byte) int { + if len(buf) < len(d.trailer) { + d.logger.Warnw("trailer too big", nil, "bufLen", len(buf), "trailerLen", len(d.trailer)) + return 0 + } + + copy(buf, d.trailer) + return len(d.trailer) +} + func (d *DownTrack) getOpusBlankFrame(_frameEndNeeded bool) ([]byte, error) { // silence frame // Used shortly after muting to ensure residual noise does not keep // generating noise at the decoder after the stream is stopped // i. e. comfort noise generation actually not producing something comfortable. - payload := make([]byte, len(OpusSilenceFrame)) + payload := make([]byte, 1000) copy(payload[0:], OpusSilenceFrame) - return payload, nil + trailerLen := d.maybeAddTrailer(payload[len(OpusSilenceFrame):]) + return payload[:len(OpusSilenceFrame)+trailerLen], nil } func (d *DownTrack) getOpusRedBlankFrame(_frameEndNeeded bool) ([]byte, error) { // primary only silence frame for opus/red, there is no need to contain redundant silent frames - payload := make([]byte, len(OpusSilenceFrame)+1) + payload := make([]byte, 1000) // primary header // 0 1 2 3 4 5 6 7 @@ -1294,7 +1309,8 @@ func (d *DownTrack) getOpusRedBlankFrame(_frameEndNeeded bool) ([]byte, error) { // +-+-+-+-+-+-+-+-+ payload[0] = opusPT copy(payload[1:], OpusSilenceFrame) - return payload, nil + trailerLen := d.maybeAddTrailer(payload[1+len(OpusSilenceFrame):]) + return payload[:1+len(OpusSilenceFrame)+trailerLen], nil } func (d *DownTrack) getVP8BlankFrame(frameEndNeeded bool) ([]byte, error) { @@ -1307,17 +1323,18 @@ func (d *DownTrack) getVP8BlankFrame(frameEndNeeded bool) ([]byte, error) { // Used even when closing out a previous frame. Looks like receivers // do not care about content (it will probably end up being an undecodable // frame, but that should be okay as there are key frames following) - payload := make([]byte, len(blankVP8)+len(VP8KeyFrame8x8)) + payload := make([]byte, 1000) copy(payload[:len(blankVP8)], blankVP8) copy(payload[len(blankVP8):], VP8KeyFrame8x8) - return payload, nil + trailerLen := d.maybeAddTrailer(payload[len(blankVP8)+len(VP8KeyFrame8x8):]) + return payload[:len(blankVP8)+len(VP8KeyFrame8x8)+trailerLen], nil } func (d *DownTrack) getH264BlankFrame(_frameEndNeeded bool) ([]byte, error) { // TODO - Jie Zeng // now use STAP-A to compose sps, pps, idr together, most decoder support packetization-mode 1. // if client only support packetization-mode 0, use single nalu unit packet - buf := make([]byte, 1462) + buf := make([]byte, 1000) offset := 0 buf[0] = 0x18 // STAP-A offset++ @@ -1327,8 +1344,8 @@ func (d *DownTrack) getH264BlankFrame(_frameEndNeeded bool) ([]byte, error) { copy(buf[offset:offset+len(payload)], payload) offset += len(payload) } - payload := buf[:offset] - return payload, nil + offset += d.maybeAddTrailer(buf[offset:]) + return buf[:offset], nil } func (d *DownTrack) handleRTCP(bytes []byte) { From 887f6580ec5319b4682ee31861320c38b3489cc1 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Thu, 27 Jul 2023 17:08:14 +0530 Subject: [PATCH 17/21] Cache marker in sequencer and use it while retransmit. (#1912) With SVC codecs, input marker and fowarded marker could be different. So, cache it in sequence and use it on retransmit. @cndderrauber - this could have affected SVC under packet loss. --- pkg/sfu/downtrack.go | 24 +++++++++++--------- pkg/sfu/sequencer.go | 12 +++++++++- pkg/sfu/sequencer_test.go | 48 ++++++++++++++++++++++----------------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 4147b1650..0ad86315c 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -638,17 +638,6 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { copy(payload, extPkt.Packet.Payload) } - if d.sequencer != nil { - d.sequencer.push( - extPkt.Packet.SequenceNumber, - tp.rtp.sequenceNumber, - tp.rtp.timestamp, - int8(layer), - tp.codecBytes, - tp.ddBytes, - ) - } - hdr, err := d.getTranslatedRTPHeader(extPkt, tp) if err != nil { d.logger.Errorw("write rtp packet failed", err) @@ -658,6 +647,18 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error { return err } + if d.sequencer != nil { + d.sequencer.push( + extPkt.Packet.SequenceNumber, + tp.rtp.sequenceNumber, + tp.rtp.timestamp, + hdr.Marker, + int8(layer), + tp.codecBytes, + tp.ddBytes, + ) + } + d.pacer.Enqueue(pacer.Packet{ Header: hdr, Extensions: []pacer.ExtensionData{{ID: uint8(d.dependencyDescriptorExtID), Payload: tp.ddBytes}}, @@ -1516,6 +1517,7 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) { d.logger.Errorw("unmarshalling rtp packet failed in retransmit", err) continue } + pkt.Header.Marker = meta.marker pkt.Header.SequenceNumber = meta.targetSeqNo pkt.Header.Timestamp = meta.timestamp pkt.Header.SSRC = d.ssrc diff --git a/pkg/sfu/sequencer.go b/pkg/sfu/sequencer.go index 4a8b31f9c..333fd93ff 100644 --- a/pkg/sfu/sequencer.go +++ b/pkg/sfu/sequencer.go @@ -39,6 +39,8 @@ type packetMeta struct { // Modified timestamp for current associated // down track. timestamp uint32 + // Modified marker + marker bool // The last time this packet was nack requested. // Sometimes clients request the same packet more than once, so keep // track of the requested packets helps to avoid writing multiple times @@ -93,7 +95,14 @@ func (s *sequencer) setRTT(rtt uint32) { } } -func (s *sequencer) push(sn, offSn uint16, timeStamp uint32, layer int8, codecBytes []byte, ddBytes []byte) { +func (s *sequencer) push( + sn, offSn uint16, + timeStamp uint32, + marker bool, + layer int8, + codecBytes []byte, + ddBytes []byte, +) { s.Lock() defer s.Unlock() @@ -106,6 +115,7 @@ func (s *sequencer) push(sn, offSn uint16, timeStamp uint32, layer int8, codecBy sourceSeqNo: sn, targetSeqNo: offSn, timestamp: timeStamp, + marker: marker, layer: layer, codecBytes: append([]byte{}, codecBytes...), ddBytes: append([]byte{}, ddBytes...), diff --git a/pkg/sfu/sequencer_test.go b/pkg/sfu/sequencer_test.go index 94a74f791..87434bf03 100644 --- a/pkg/sfu/sequencer_test.go +++ b/pkg/sfu/sequencer_test.go @@ -15,11 +15,11 @@ func Test_sequencer(t *testing.T) { off := uint16(15) for i := uint16(1); i < 518; i++ { - seq.push(i, i+off, 123, 2, nil, nil) + seq.push(i, i+off, 123, true, 2, nil, nil) } // send the last two out-of-order - seq.push(519, 519+off, 123, 2, nil, nil) - seq.push(518, 518+off, 123, 2, nil, nil) + seq.push(519, 519+off, 123, false, 2, nil, nil) + seq.push(518, 518+off, 123, true, 2, nil, nil) time.Sleep(60 * time.Millisecond) req := []uint16{57, 58, 62, 63, 513, 514, 515, 516, 517} @@ -41,11 +41,11 @@ func Test_sequencer(t *testing.T) { require.Equal(t, val.layer, int8(2)) } - seq.push(521, 521+off, 123, 1, nil, nil) + seq.push(521, 521+off, 123, true, 1, nil, nil) m := seq.getPacketsMeta([]uint16{521 + off}) require.Equal(t, 1, len(m)) - seq.push(505, 505+off, 123, 1, nil, nil) + seq.push(505, 505+off, 123, false, 1, nil, nil) m = seq.getPacketsMeta([]uint16{505 + off}) require.Equal(t, 1, len(m)) } @@ -55,13 +55,15 @@ func Test_sequencer_getNACKSeqNo(t *testing.T) { seqNo []uint16 } type fields struct { - input []uint16 - padding []uint16 - offset uint16 - codecBytesOdd []byte + input []uint16 + padding []uint16 + offset uint16 + markerOdd bool + markerEven bool + codecBytesOdd []byte codecBytesEven []byte - ddBytesOdd []byte - ddBytesEven []byte + ddBytesOdd []byte + ddBytesEven []byte } tests := []struct { @@ -73,13 +75,15 @@ func Test_sequencer_getNACKSeqNo(t *testing.T) { { name: "Should get correct seq numbers", fields: fields{ - input: []uint16{2, 3, 4, 7, 8, 11}, - padding: []uint16{9, 10}, - offset: 5, - codecBytesOdd: []byte{1, 2, 3, 4}, + input: []uint16{2, 3, 4, 7, 8, 11}, + padding: []uint16{9, 10}, + offset: 5, + markerOdd: true, + markerEven: false, + codecBytesOdd: []byte{1, 2, 3, 4}, codecBytesEven: []byte{5, 6, 7}, - ddBytesOdd: []byte{8, 9, 10}, - ddBytesEven: []byte{11, 12}, + ddBytesOdd: []byte{8, 9, 10}, + ddBytesEven: []byte{11, 12}, }, args: args{ seqNo: []uint16{4 + 5, 5 + 5, 8 + 5, 9 + 5, 10 + 5, 11 + 5}, @@ -93,10 +97,10 @@ func Test_sequencer_getNACKSeqNo(t *testing.T) { n := newSequencer(5, 10, logger.GetLogger()) for _, i := range tt.fields.input { - if i % 2 == 0 { - n.push(i, i+tt.fields.offset, 123, 3, tt.fields.codecBytesEven, tt.fields.ddBytesEven) + if i%2 == 0 { + n.push(i, i+tt.fields.offset, 123, tt.fields.markerEven, 3, tt.fields.codecBytesEven, tt.fields.ddBytesEven) } else { - n.push(i, i+tt.fields.offset, 123, 3, tt.fields.codecBytesOdd, tt.fields.ddBytesOdd) + n.push(i, i+tt.fields.offset, 123, tt.fields.markerOdd, 3, tt.fields.codecBytesOdd, tt.fields.ddBytesOdd) } } for _, i := range tt.fields.padding { @@ -107,10 +111,12 @@ func Test_sequencer_getNACKSeqNo(t *testing.T) { var got []uint16 for _, sn := range g { got = append(got, sn.sourceSeqNo) - if sn.sourceSeqNo % 2 == 0 { + if sn.sourceSeqNo%2 == 0 { + require.Equal(t, tt.fields.markerEven, sn.marker) require.Equal(t, tt.fields.codecBytesEven, sn.codecBytes) require.Equal(t, tt.fields.ddBytesEven, sn.ddBytes) } else { + require.Equal(t, tt.fields.markerOdd, sn.marker) require.Equal(t, tt.fields.codecBytesOdd, sn.codecBytes) require.Equal(t, tt.fields.ddBytesOdd, sn.ddBytes) } From 981fb7cac7f65f0f5d4b141c2dd5ed78a5bfe2ea Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 27 Jul 2023 16:43:19 -0700 Subject: [PATCH 18/21] Adding license notices (#1913) * Adding license notices * remove from config --- .github/workflows/buildtest.yaml | 14 ++++++++++++++ .github/workflows/docker.yaml | 14 ++++++++++++++ .github/workflows/release.yaml | 14 ++++++++++++++ .goreleaser.yaml | 14 ++++++++++++++ Dockerfile | 14 ++++++++++++++ NOTICE | 13 +++++++++++++ bootstrap.sh | 14 ++++++++++++++ cmd/server/commands.go | 14 ++++++++++++++ cmd/server/main.go | 14 ++++++++++++++ cmd/server/main_test.go | 14 ++++++++++++++ install-livekit.sh | 14 ++++++++++++++ magefile.go | 14 ++++++++++++++ magefile_unix.go | 14 ++++++++++++++ magefile_windows.go | 14 ++++++++++++++ pkg/clientconfiguration/conf.go | 14 ++++++++++++++ pkg/clientconfiguration/conf_test.go | 14 ++++++++++++++ pkg/clientconfiguration/match.go | 14 ++++++++++++++ pkg/clientconfiguration/staticconfiguration.go | 14 ++++++++++++++ pkg/clientconfiguration/types.go | 14 ++++++++++++++ pkg/config/config.go | 14 ++++++++++++++ pkg/config/config_test.go | 14 ++++++++++++++ pkg/routing/errors.go | 14 ++++++++++++++ pkg/routing/interfaces.go | 14 ++++++++++++++ pkg/routing/localrouter.go | 14 ++++++++++++++ pkg/routing/messagechannel.go | 14 ++++++++++++++ pkg/routing/messagechannel_test.go | 14 ++++++++++++++ pkg/routing/node.go | 14 ++++++++++++++ pkg/routing/redis.go | 14 ++++++++++++++ pkg/routing/redisrouter.go | 14 ++++++++++++++ pkg/routing/selector/any.go | 14 ++++++++++++++ pkg/routing/selector/cpuload.go | 14 ++++++++++++++ pkg/routing/selector/cpuload_test.go | 14 ++++++++++++++ pkg/routing/selector/errors.go | 14 ++++++++++++++ pkg/routing/selector/interfaces.go | 14 ++++++++++++++ pkg/routing/selector/regionaware.go | 14 ++++++++++++++ pkg/routing/selector/regionaware_test.go | 14 ++++++++++++++ pkg/routing/selector/sortby_test.go | 14 ++++++++++++++ pkg/routing/selector/sysload.go | 14 ++++++++++++++ pkg/routing/selector/sysload_test.go | 14 ++++++++++++++ pkg/routing/selector/utils.go | 14 ++++++++++++++ pkg/routing/selector/utils_test.go | 14 ++++++++++++++ pkg/routing/signal.go | 14 ++++++++++++++ pkg/routing/utils.go | 14 ++++++++++++++ pkg/routing/utils_test.go | 14 ++++++++++++++ pkg/rtc/clientinfo.go | 14 ++++++++++++++ pkg/rtc/config.go | 14 ++++++++++++++ pkg/rtc/dynacastmanager.go | 14 ++++++++++++++ pkg/rtc/dynacastmanager_test.go | 14 ++++++++++++++ pkg/rtc/dynacastquality.go | 14 ++++++++++++++ pkg/rtc/errors.go | 14 ++++++++++++++ pkg/rtc/helper_test.go | 14 ++++++++++++++ pkg/rtc/mediaengine.go | 14 ++++++++++++++ pkg/rtc/mediaengine_test.go | 14 ++++++++++++++ pkg/rtc/medialossproxy.go | 14 ++++++++++++++ pkg/rtc/mediatrack.go | 14 ++++++++++++++ pkg/rtc/mediatrack_test.go | 14 ++++++++++++++ pkg/rtc/mediatrackreceiver.go | 14 ++++++++++++++ pkg/rtc/mediatracksubscriptions.go | 14 ++++++++++++++ pkg/rtc/participant.go | 14 ++++++++++++++ pkg/rtc/participant_internal_test.go | 14 ++++++++++++++ pkg/rtc/participant_sdp.go | 14 ++++++++++++++ pkg/rtc/participant_signal.go | 14 ++++++++++++++ pkg/rtc/room.go | 14 ++++++++++++++ pkg/rtc/room_egress.go | 14 ++++++++++++++ pkg/rtc/room_test.go | 14 ++++++++++++++ pkg/rtc/signalhandler.go | 14 ++++++++++++++ pkg/rtc/subscribedtrack.go | 14 ++++++++++++++ pkg/rtc/supervisor/participant_supervisor.go | 14 ++++++++++++++ pkg/rtc/supervisor/publication_monitor.go | 14 ++++++++++++++ pkg/rtc/transport.go | 14 ++++++++++++++ pkg/rtc/transport_test.go | 14 ++++++++++++++ pkg/rtc/transportmanager.go | 14 ++++++++++++++ pkg/rtc/types/interfaces.go | 14 ++++++++++++++ pkg/rtc/types/protocol_version.go | 14 ++++++++++++++ pkg/rtc/unhandlesimulcast.go | 14 ++++++++++++++ pkg/rtc/uptrackmanager.go | 14 ++++++++++++++ pkg/rtc/uptrackmanager_test.go | 14 ++++++++++++++ pkg/rtc/utils.go | 14 ++++++++++++++ pkg/rtc/utils_test.go | 14 ++++++++++++++ pkg/rtc/wrappedreceiver.go | 14 ++++++++++++++ pkg/service/auth.go | 14 ++++++++++++++ pkg/service/auth_test.go | 14 ++++++++++++++ pkg/service/egress.go | 14 ++++++++++++++ pkg/service/errors.go | 14 ++++++++++++++ pkg/service/ingress.go | 14 ++++++++++++++ pkg/service/interfaces.go | 14 ++++++++++++++ pkg/service/ioinfo.go | 14 ++++++++++++++ pkg/service/localstore.go | 14 ++++++++++++++ pkg/service/redisstore.go | 14 ++++++++++++++ pkg/service/redisstore_test.go | 14 ++++++++++++++ pkg/service/roomallocator.go | 14 ++++++++++++++ pkg/service/roomallocator_test.go | 14 ++++++++++++++ pkg/service/roommanager.go | 14 ++++++++++++++ pkg/service/roomservice.go | 14 ++++++++++++++ pkg/service/roomservice_test.go | 14 ++++++++++++++ pkg/service/rtcservice.go | 14 ++++++++++++++ pkg/service/server.go | 14 ++++++++++++++ pkg/service/signal.go | 14 ++++++++++++++ pkg/service/signal_test.go | 14 ++++++++++++++ pkg/service/turn.go | 14 ++++++++++++++ pkg/service/utils.go | 14 ++++++++++++++ pkg/service/utils_test.go | 14 ++++++++++++++ pkg/service/wire.go | 14 ++++++++++++++ pkg/service/wsprotocol.go | 14 ++++++++++++++ pkg/sfu/audio/audiolevel.go | 14 ++++++++++++++ pkg/sfu/audio/audiolevel_test.go | 14 ++++++++++++++ pkg/sfu/buffer/buffer.go | 14 ++++++++++++++ pkg/sfu/buffer/buffer_test.go | 14 ++++++++++++++ pkg/sfu/buffer/datastats.go | 14 ++++++++++++++ pkg/sfu/buffer/datastats_test.go | 14 ++++++++++++++ pkg/sfu/buffer/dependencydescriptorparser.go | 14 ++++++++++++++ pkg/sfu/buffer/factory.go | 14 ++++++++++++++ pkg/sfu/buffer/fps.go | 14 ++++++++++++++ pkg/sfu/buffer/fps_test.go | 14 ++++++++++++++ pkg/sfu/buffer/helpers.go | 14 ++++++++++++++ pkg/sfu/buffer/helpers_test.go | 14 ++++++++++++++ pkg/sfu/buffer/rtcpreader.go | 14 ++++++++++++++ pkg/sfu/buffer/rtpstats.go | 14 ++++++++++++++ pkg/sfu/buffer/rtpstats_test.go | 14 ++++++++++++++ pkg/sfu/buffer/streamstats.go | 14 ++++++++++++++ pkg/sfu/buffer/videolayer.go | 14 ++++++++++++++ pkg/sfu/buffer/videolayerutils.go | 14 ++++++++++++++ pkg/sfu/buffer/videolayerutils_test.go | 14 ++++++++++++++ pkg/sfu/codecmunger/codecmunger.go | 14 ++++++++++++++ pkg/sfu/codecmunger/null.go | 14 ++++++++++++++ pkg/sfu/codecmunger/vp8.go | 14 ++++++++++++++ pkg/sfu/codecmunger/vp8_test.go | 14 ++++++++++++++ pkg/sfu/connectionquality/connectionstats.go | 14 ++++++++++++++ pkg/sfu/connectionquality/connectionstats_test.go | 14 ++++++++++++++ pkg/sfu/connectionquality/scorer.go | 14 ++++++++++++++ pkg/sfu/dependencydescriptor/bitstreamreader.go | 14 ++++++++++++++ pkg/sfu/dependencydescriptor/bitstreamwriter.go | 14 ++++++++++++++ .../dependencydescriptorextension.go | 14 ++++++++++++++ .../dependencydescriptorextension_test.go | 14 ++++++++++++++ .../dependencydescriptorreader.go | 14 ++++++++++++++ .../dependencydescriptorwriter.go | 14 ++++++++++++++ pkg/sfu/downtrack.go | 14 ++++++++++++++ pkg/sfu/downtrackspreader.go | 14 ++++++++++++++ pkg/sfu/errors.go | 14 ++++++++++++++ pkg/sfu/forwarder.go | 14 ++++++++++++++ pkg/sfu/forwarder_test.go | 14 ++++++++++++++ pkg/sfu/helpers.go | 14 ++++++++++++++ pkg/sfu/pacer/base.go | 14 ++++++++++++++ pkg/sfu/pacer/leaky_bucket.go | 14 ++++++++++++++ pkg/sfu/pacer/no_queue.go | 14 ++++++++++++++ pkg/sfu/pacer/pacer.go | 14 ++++++++++++++ pkg/sfu/pacer/packet_time.go | 14 ++++++++++++++ pkg/sfu/pacer/pass_through.go | 14 ++++++++++++++ pkg/sfu/receiver.go | 14 ++++++++++++++ pkg/sfu/receiver_test.go | 14 ++++++++++++++ pkg/sfu/redprimaryreceiver.go | 14 ++++++++++++++ pkg/sfu/redreceiver.go | 14 ++++++++++++++ pkg/sfu/redreceiver_test.go | 14 ++++++++++++++ pkg/sfu/rtpmunger.go | 14 ++++++++++++++ pkg/sfu/rtpmunger_test.go | 14 ++++++++++++++ pkg/sfu/sequencer.go | 14 ++++++++++++++ pkg/sfu/sequencer_test.go | 14 ++++++++++++++ pkg/sfu/sfu.go | 14 ++++++++++++++ pkg/sfu/streamallocator/channelobserver.go | 14 ++++++++++++++ pkg/sfu/streamallocator/nacktracker.go | 14 ++++++++++++++ pkg/sfu/streamallocator/probe_controller.go | 14 ++++++++++++++ pkg/sfu/streamallocator/prober.go | 14 ++++++++++++++ pkg/sfu/streamallocator/ratemonitor.go | 14 ++++++++++++++ pkg/sfu/streamallocator/streamallocator.go | 14 ++++++++++++++ pkg/sfu/streamallocator/streamstateupdate.go | 14 ++++++++++++++ pkg/sfu/streamallocator/track.go | 14 ++++++++++++++ pkg/sfu/streamallocator/trenddetector.go | 14 ++++++++++++++ pkg/sfu/streamtracker/interfaces.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker_dd.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker_dd_test.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker_frame.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker_packet.go | 14 ++++++++++++++ pkg/sfu/streamtracker/streamtracker_packet_test.go | 14 ++++++++++++++ pkg/sfu/streamtrackermanager.go | 14 ++++++++++++++ pkg/sfu/testutils/data.go | 14 ++++++++++++++ pkg/sfu/utils/wraparound.go | 14 ++++++++++++++ pkg/sfu/utils/wraparound_test.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/base.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/decodetarget.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/dependencydescriptor.go | 14 ++++++++++++++ .../dependencydescriptor_test.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/framechain.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/null.go | 14 ++++++++++++++ .../videolayerselector/selectordecisioncache.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/simulcast.go | 14 ++++++++++++++ .../temporallayerselector/null.go | 14 ++++++++++++++ .../temporallayerselector/temporallayerselector.go | 14 ++++++++++++++ .../temporallayerselector/vp8.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/videolayerselector.go | 14 ++++++++++++++ pkg/sfu/videolayerselector/vp9.go | 14 ++++++++++++++ pkg/telemetry/analyticsservice.go | 14 ++++++++++++++ pkg/telemetry/events.go | 14 ++++++++++++++ pkg/telemetry/events_test.go | 14 ++++++++++++++ pkg/telemetry/prometheus/node.go | 14 ++++++++++++++ pkg/telemetry/prometheus/node_linux.go | 14 ++++++++++++++ pkg/telemetry/prometheus/node_nonlinux.go | 14 ++++++++++++++ pkg/telemetry/prometheus/packets.go | 14 ++++++++++++++ pkg/telemetry/prometheus/psrpc.go | 14 ++++++++++++++ pkg/telemetry/prometheus/quality.go | 14 ++++++++++++++ pkg/telemetry/prometheus/rooms.go | 14 ++++++++++++++ pkg/telemetry/signalanddatastats.go | 14 ++++++++++++++ pkg/telemetry/stats.go | 14 ++++++++++++++ pkg/telemetry/stats_test.go | 14 ++++++++++++++ pkg/telemetry/statsconn.go | 14 ++++++++++++++ pkg/telemetry/statsworker.go | 14 ++++++++++++++ pkg/telemetry/telemetryservice.go | 14 ++++++++++++++ pkg/testutils/timeout.go | 14 ++++++++++++++ pkg/utils/math.go | 14 ++++++++++++++ pkg/utils/opsqueue.go | 14 ++++++++++++++ test/client/client.go | 14 ++++++++++++++ test/client/trackwriter.go | 14 ++++++++++++++ test/integration_helpers.go | 14 ++++++++++++++ test/multinode_roomservice_test.go | 14 ++++++++++++++ test/multinode_test.go | 14 ++++++++++++++ test/scenarios.go | 14 ++++++++++++++ test/singlenode_test.go | 14 ++++++++++++++ test/webhook_test.go | 14 ++++++++++++++ tools/tools.go | 14 ++++++++++++++ version/version.go | 14 ++++++++++++++ 220 files changed, 3079 insertions(+) create mode 100644 NOTICE diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index fcf886631..13719e47c 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Test on: diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 03c4ea14d..e08c7f1ad 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Release to Docker # Controls when the action will run. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a93876991..7e0110d0a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Release on: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4cd59d959..f8e54c4e1 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + before: hooks: - go mod tidy diff --git a/Dockerfile b/Dockerfile index a02bbb617..f35b65ada 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM golang:1.20-alpine as builder ARG TARGETPLATFORM diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..692adc992 --- /dev/null +++ b/NOTICE @@ -0,0 +1,13 @@ +Copyright 2023 LiveKit, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/bootstrap.sh b/bootstrap.sh index 4d7085f29..3109ddc38 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + if ! command -v mage &> /dev/null then diff --git a/cmd/server/commands.go b/cmd/server/commands.go index 927668a0a..99499a50f 100644 --- a/cmd/server/commands.go +++ b/cmd/server/commands.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/cmd/server/main.go b/cmd/server/main.go index 42c3cf93f..58664107c 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/cmd/server/main_test.go b/cmd/server/main_test.go index 931692a64..dc82bf086 100644 --- a/cmd/server/main_test.go +++ b/cmd/server/main_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/install-livekit.sh b/install-livekit.sh index 3dd0f27ee..e0b243a81 100755 --- a/install-livekit.sh +++ b/install-livekit.sh @@ -1,4 +1,18 @@ #!/usr/bin/env bash +# Copyright 2023 LiveKit, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # LiveKit install script for Linux set -u diff --git a/magefile.go b/magefile.go index 1742de3df..1b3fdfa81 100644 --- a/magefile.go +++ b/magefile.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build mage // +build mage diff --git a/magefile_unix.go b/magefile_unix.go index a84892371..186f6f4d4 100644 --- a/magefile_unix.go +++ b/magefile_unix.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build mage && !windows // +build mage,!windows diff --git a/magefile_windows.go b/magefile_windows.go index 3276726bb..9e25fe722 100644 --- a/magefile_windows.go +++ b/magefile_windows.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build mage // +build mage diff --git a/pkg/clientconfiguration/conf.go b/pkg/clientconfiguration/conf.go index 916cd153f..8c37b7ba4 100644 --- a/pkg/clientconfiguration/conf.go +++ b/pkg/clientconfiguration/conf.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package clientconfiguration import ( diff --git a/pkg/clientconfiguration/conf_test.go b/pkg/clientconfiguration/conf_test.go index 46f271735..093a98f19 100644 --- a/pkg/clientconfiguration/conf_test.go +++ b/pkg/clientconfiguration/conf_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package clientconfiguration import ( diff --git a/pkg/clientconfiguration/match.go b/pkg/clientconfiguration/match.go index a060d83cc..3c3514220 100644 --- a/pkg/clientconfiguration/match.go +++ b/pkg/clientconfiguration/match.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package clientconfiguration import ( diff --git a/pkg/clientconfiguration/staticconfiguration.go b/pkg/clientconfiguration/staticconfiguration.go index 83f9c2dfb..2071d9112 100644 --- a/pkg/clientconfiguration/staticconfiguration.go +++ b/pkg/clientconfiguration/staticconfiguration.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package clientconfiguration import ( diff --git a/pkg/clientconfiguration/types.go b/pkg/clientconfiguration/types.go index 5e7a8ca2f..b014518cf 100644 --- a/pkg/clientconfiguration/types.go +++ b/pkg/clientconfiguration/types.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package clientconfiguration import ( diff --git a/pkg/config/config.go b/pkg/config/config.go index 5a7626759..6b285da12 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package config import ( diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 912aacc33..0e4719fff 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package config import ( diff --git a/pkg/routing/errors.go b/pkg/routing/errors.go index 050b6b90f..4b6af0686 100644 --- a/pkg/routing/errors.go +++ b/pkg/routing/errors.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import "errors" diff --git a/pkg/routing/interfaces.go b/pkg/routing/interfaces.go index 3bc54d9c9..7a450bd16 100644 --- a/pkg/routing/interfaces.go +++ b/pkg/routing/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/localrouter.go b/pkg/routing/localrouter.go index 0b604a73d..b0fcbbccb 100644 --- a/pkg/routing/localrouter.go +++ b/pkg/routing/localrouter.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/messagechannel.go b/pkg/routing/messagechannel.go index bf914e1aa..e761f3add 100644 --- a/pkg/routing/messagechannel.go +++ b/pkg/routing/messagechannel.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/messagechannel_test.go b/pkg/routing/messagechannel_test.go index 25bf7fdf1..5d78c2104 100644 --- a/pkg/routing/messagechannel_test.go +++ b/pkg/routing/messagechannel_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing_test import ( diff --git a/pkg/routing/node.go b/pkg/routing/node.go index e39f5ac8c..16dc769a2 100644 --- a/pkg/routing/node.go +++ b/pkg/routing/node.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/redis.go b/pkg/routing/redis.go index 054613e61..5d81ce088 100644 --- a/pkg/routing/redis.go +++ b/pkg/routing/redis.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/redisrouter.go b/pkg/routing/redisrouter.go index 5ad1a5c1a..ef679261f 100644 --- a/pkg/routing/redisrouter.go +++ b/pkg/routing/redisrouter.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/selector/any.go b/pkg/routing/selector/any.go index 399ad4947..71f09ba87 100644 --- a/pkg/routing/selector/any.go +++ b/pkg/routing/selector/any.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/cpuload.go b/pkg/routing/selector/cpuload.go index 61197907b..1cd04c4c0 100644 --- a/pkg/routing/selector/cpuload.go +++ b/pkg/routing/selector/cpuload.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/cpuload_test.go b/pkg/routing/selector/cpuload_test.go index c8afd5bcc..33bca4717 100644 --- a/pkg/routing/selector/cpuload_test.go +++ b/pkg/routing/selector/cpuload_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector_test import ( diff --git a/pkg/routing/selector/errors.go b/pkg/routing/selector/errors.go index 9c05a269c..c011f67af 100644 --- a/pkg/routing/selector/errors.go +++ b/pkg/routing/selector/errors.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import "errors" diff --git a/pkg/routing/selector/interfaces.go b/pkg/routing/selector/interfaces.go index aee027564..60d001e18 100644 --- a/pkg/routing/selector/interfaces.go +++ b/pkg/routing/selector/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/regionaware.go b/pkg/routing/selector/regionaware.go index 257862247..61f494f70 100644 --- a/pkg/routing/selector/regionaware.go +++ b/pkg/routing/selector/regionaware.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/regionaware_test.go b/pkg/routing/selector/regionaware_test.go index 1645c4526..75a5bef31 100644 --- a/pkg/routing/selector/regionaware_test.go +++ b/pkg/routing/selector/regionaware_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector_test import ( diff --git a/pkg/routing/selector/sortby_test.go b/pkg/routing/selector/sortby_test.go index 1e391c650..31de0027b 100644 --- a/pkg/routing/selector/sortby_test.go +++ b/pkg/routing/selector/sortby_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector_test import ( diff --git a/pkg/routing/selector/sysload.go b/pkg/routing/selector/sysload.go index 821f092ab..909311a0e 100644 --- a/pkg/routing/selector/sysload.go +++ b/pkg/routing/selector/sysload.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/sysload_test.go b/pkg/routing/selector/sysload_test.go index 1941d8e7c..ac7d59a25 100644 --- a/pkg/routing/selector/sysload_test.go +++ b/pkg/routing/selector/sysload_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector_test import ( diff --git a/pkg/routing/selector/utils.go b/pkg/routing/selector/utils.go index 7ab021374..2ba0b3876 100644 --- a/pkg/routing/selector/utils.go +++ b/pkg/routing/selector/utils.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector import ( diff --git a/pkg/routing/selector/utils_test.go b/pkg/routing/selector/utils_test.go index 46038be7f..4f62f6db4 100644 --- a/pkg/routing/selector/utils_test.go +++ b/pkg/routing/selector/utils_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package selector_test import ( diff --git a/pkg/routing/signal.go b/pkg/routing/signal.go index aa94b12dc..ecb1c6c7c 100644 --- a/pkg/routing/signal.go +++ b/pkg/routing/signal.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/utils.go b/pkg/routing/utils.go index 38a458b63..2e11fdbe2 100644 --- a/pkg/routing/utils.go +++ b/pkg/routing/utils.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/routing/utils_test.go b/pkg/routing/utils_test.go index 10a21a60f..8ae1e9b4c 100644 --- a/pkg/routing/utils_test.go +++ b/pkg/routing/utils_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package routing import ( diff --git a/pkg/rtc/clientinfo.go b/pkg/rtc/clientinfo.go index efef60bef..7912968b0 100644 --- a/pkg/rtc/clientinfo.go +++ b/pkg/rtc/clientinfo.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/config.go b/pkg/rtc/config.go index c47bcecbc..efe2a6a1f 100644 --- a/pkg/rtc/config.go +++ b/pkg/rtc/config.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/dynacastmanager.go b/pkg/rtc/dynacastmanager.go index 76427798a..edaadb4f2 100644 --- a/pkg/rtc/dynacastmanager.go +++ b/pkg/rtc/dynacastmanager.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/dynacastmanager_test.go b/pkg/rtc/dynacastmanager_test.go index ad7b065bb..ee1c97c70 100644 --- a/pkg/rtc/dynacastmanager_test.go +++ b/pkg/rtc/dynacastmanager_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/dynacastquality.go b/pkg/rtc/dynacastquality.go index 5be1e9976..7f0f90495 100644 --- a/pkg/rtc/dynacastquality.go +++ b/pkg/rtc/dynacastquality.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/errors.go b/pkg/rtc/errors.go index 20c41acb9..383afde0d 100644 --- a/pkg/rtc/errors.go +++ b/pkg/rtc/errors.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import "errors" diff --git a/pkg/rtc/helper_test.go b/pkg/rtc/helper_test.go index c26e7aebc..c47b5a658 100644 --- a/pkg/rtc/helper_test.go +++ b/pkg/rtc/helper_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediaengine.go b/pkg/rtc/mediaengine.go index 4178dfb15..c2866697b 100644 --- a/pkg/rtc/mediaengine.go +++ b/pkg/rtc/mediaengine.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediaengine_test.go b/pkg/rtc/mediaengine_test.go index 19f81529c..353f6f966 100644 --- a/pkg/rtc/mediaengine_test.go +++ b/pkg/rtc/mediaengine_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/medialossproxy.go b/pkg/rtc/medialossproxy.go index 4b25d479a..0ac54b7e6 100644 --- a/pkg/rtc/medialossproxy.go +++ b/pkg/rtc/medialossproxy.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediatrack.go b/pkg/rtc/mediatrack.go index 4095013fa..72f0a6f3a 100644 --- a/pkg/rtc/mediatrack.go +++ b/pkg/rtc/mediatrack.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediatrack_test.go b/pkg/rtc/mediatrack_test.go index 2eb172fdc..9a0587447 100644 --- a/pkg/rtc/mediatrack_test.go +++ b/pkg/rtc/mediatrack_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediatrackreceiver.go b/pkg/rtc/mediatrackreceiver.go index a35b328a4..cff226ca0 100644 --- a/pkg/rtc/mediatrackreceiver.go +++ b/pkg/rtc/mediatrackreceiver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/mediatracksubscriptions.go b/pkg/rtc/mediatracksubscriptions.go index 2b107d9bd..51499a5ba 100644 --- a/pkg/rtc/mediatracksubscriptions.go +++ b/pkg/rtc/mediatracksubscriptions.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 759b39523..aea4c9e94 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/participant_internal_test.go b/pkg/rtc/participant_internal_test.go index 8dce027b5..55f773879 100644 --- a/pkg/rtc/participant_internal_test.go +++ b/pkg/rtc/participant_internal_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/participant_sdp.go b/pkg/rtc/participant_sdp.go index 427c846a5..01a50b6b0 100644 --- a/pkg/rtc/participant_sdp.go +++ b/pkg/rtc/participant_sdp.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/participant_signal.go b/pkg/rtc/participant_signal.go index 305e920e5..a9ae4dfab 100644 --- a/pkg/rtc/participant_signal.go +++ b/pkg/rtc/participant_signal.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/room.go b/pkg/rtc/room.go index a609a25d2..c0fce9d25 100644 --- a/pkg/rtc/room.go +++ b/pkg/rtc/room.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/room_egress.go b/pkg/rtc/room_egress.go index 989270713..d632a007b 100644 --- a/pkg/rtc/room_egress.go +++ b/pkg/rtc/room_egress.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/room_test.go b/pkg/rtc/room_test.go index 9afba5250..0fb46b0af 100644 --- a/pkg/rtc/room_test.go +++ b/pkg/rtc/room_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/signalhandler.go b/pkg/rtc/signalhandler.go index c29baf10f..3c90209b6 100644 --- a/pkg/rtc/signalhandler.go +++ b/pkg/rtc/signalhandler.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/subscribedtrack.go b/pkg/rtc/subscribedtrack.go index 7bb8ab294..5a83e0a1f 100644 --- a/pkg/rtc/subscribedtrack.go +++ b/pkg/rtc/subscribedtrack.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/supervisor/participant_supervisor.go b/pkg/rtc/supervisor/participant_supervisor.go index 99126739c..1dc6b9d32 100644 --- a/pkg/rtc/supervisor/participant_supervisor.go +++ b/pkg/rtc/supervisor/participant_supervisor.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package supervisor import ( diff --git a/pkg/rtc/supervisor/publication_monitor.go b/pkg/rtc/supervisor/publication_monitor.go index f7af4ed23..c5c61c557 100644 --- a/pkg/rtc/supervisor/publication_monitor.go +++ b/pkg/rtc/supervisor/publication_monitor.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package supervisor import ( diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index 9b47f33d5..c3f314eec 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/transport_test.go b/pkg/rtc/transport_test.go index e7365531e..eb59df779 100644 --- a/pkg/rtc/transport_test.go +++ b/pkg/rtc/transport_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/transportmanager.go b/pkg/rtc/transportmanager.go index 78dd8dee2..3f698ebe1 100644 --- a/pkg/rtc/transportmanager.go +++ b/pkg/rtc/transportmanager.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/types/interfaces.go b/pkg/rtc/types/interfaces.go index 6a426b521..6431dc661 100644 --- a/pkg/rtc/types/interfaces.go +++ b/pkg/rtc/types/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( diff --git a/pkg/rtc/types/protocol_version.go b/pkg/rtc/types/protocol_version.go index 4c0257734..93449ae79 100644 --- a/pkg/rtc/types/protocol_version.go +++ b/pkg/rtc/types/protocol_version.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types type ProtocolVersion int diff --git a/pkg/rtc/unhandlesimulcast.go b/pkg/rtc/unhandlesimulcast.go index 0fd611443..568c7dc1b 100644 --- a/pkg/rtc/unhandlesimulcast.go +++ b/pkg/rtc/unhandlesimulcast.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/uptrackmanager.go b/pkg/rtc/uptrackmanager.go index 10e75227c..961134c83 100644 --- a/pkg/rtc/uptrackmanager.go +++ b/pkg/rtc/uptrackmanager.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/uptrackmanager_test.go b/pkg/rtc/uptrackmanager_test.go index e75d92881..46a8c96cf 100644 --- a/pkg/rtc/uptrackmanager_test.go +++ b/pkg/rtc/uptrackmanager_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/utils.go b/pkg/rtc/utils.go index 0b49d02af..b9b532d8b 100644 --- a/pkg/rtc/utils.go +++ b/pkg/rtc/utils.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/utils_test.go b/pkg/rtc/utils_test.go index 9e13e8fe2..813f910d8 100644 --- a/pkg/rtc/utils_test.go +++ b/pkg/rtc/utils_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/rtc/wrappedreceiver.go b/pkg/rtc/wrappedreceiver.go index 7028084fb..593a62487 100644 --- a/pkg/rtc/wrappedreceiver.go +++ b/pkg/rtc/wrappedreceiver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rtc import ( diff --git a/pkg/service/auth.go b/pkg/service/auth.go index c83cfbb1a..af940e83a 100644 --- a/pkg/service/auth.go +++ b/pkg/service/auth.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/auth_test.go b/pkg/service/auth_test.go index f61d9fbc0..8a70d6a18 100644 --- a/pkg/service/auth_test.go +++ b/pkg/service/auth_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service_test import ( diff --git a/pkg/service/egress.go b/pkg/service/egress.go index 29ce6f07a..1ae4b5a69 100644 --- a/pkg/service/egress.go +++ b/pkg/service/egress.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/errors.go b/pkg/service/errors.go index b856579da..a1473c3a2 100644 --- a/pkg/service/errors.go +++ b/pkg/service/errors.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/ingress.go b/pkg/service/ingress.go index 5fa7990ee..45c0bb789 100644 --- a/pkg/service/ingress.go +++ b/pkg/service/ingress.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/interfaces.go b/pkg/service/interfaces.go index e3b1bcef0..36da68fc5 100644 --- a/pkg/service/interfaces.go +++ b/pkg/service/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/ioinfo.go b/pkg/service/ioinfo.go index 612020916..b8fedd8ac 100644 --- a/pkg/service/ioinfo.go +++ b/pkg/service/ioinfo.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/localstore.go b/pkg/service/localstore.go index 53518022b..a651c24a0 100644 --- a/pkg/service/localstore.go +++ b/pkg/service/localstore.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/redisstore.go b/pkg/service/redisstore.go index 6656757da..e8fe4ecc9 100644 --- a/pkg/service/redisstore.go +++ b/pkg/service/redisstore.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/redisstore_test.go b/pkg/service/redisstore_test.go index 949480d28..32e550378 100644 --- a/pkg/service/redisstore_test.go +++ b/pkg/service/redisstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service_test import ( diff --git a/pkg/service/roomallocator.go b/pkg/service/roomallocator.go index 8c82f6754..9b38b9768 100644 --- a/pkg/service/roomallocator.go +++ b/pkg/service/roomallocator.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/roomallocator_test.go b/pkg/service/roomallocator_test.go index ddf305d66..4397e22c4 100644 --- a/pkg/service/roomallocator_test.go +++ b/pkg/service/roomallocator_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service_test import ( diff --git a/pkg/service/roommanager.go b/pkg/service/roommanager.go index 1920ecda3..fe4008cb3 100644 --- a/pkg/service/roommanager.go +++ b/pkg/service/roommanager.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/roomservice.go b/pkg/service/roomservice.go index e3859d4b3..3e8997587 100644 --- a/pkg/service/roomservice.go +++ b/pkg/service/roomservice.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/roomservice_test.go b/pkg/service/roomservice_test.go index a8706bd64..a7433a090 100644 --- a/pkg/service/roomservice_test.go +++ b/pkg/service/roomservice_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service_test import ( diff --git a/pkg/service/rtcservice.go b/pkg/service/rtcservice.go index 32dfca410..5259622bc 100644 --- a/pkg/service/rtcservice.go +++ b/pkg/service/rtcservice.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/server.go b/pkg/service/server.go index 390432116..69191ff81 100644 --- a/pkg/service/server.go +++ b/pkg/service/server.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/signal.go b/pkg/service/signal.go index 817344914..862d79e44 100644 --- a/pkg/service/signal.go +++ b/pkg/service/signal.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/signal_test.go b/pkg/service/signal_test.go index ec83c5c3e..3e202636e 100644 --- a/pkg/service/signal_test.go +++ b/pkg/service/signal_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/turn.go b/pkg/service/turn.go index 325eca32b..08d971fb4 100644 --- a/pkg/service/turn.go +++ b/pkg/service/turn.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/utils.go b/pkg/service/utils.go index 42f0c9c41..32076455f 100644 --- a/pkg/service/utils.go +++ b/pkg/service/utils.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/service/utils_test.go b/pkg/service/utils_test.go index d46cb0707..99c19ac35 100644 --- a/pkg/service/utils_test.go +++ b/pkg/service/utils_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service_test import ( diff --git a/pkg/service/wire.go b/pkg/service/wire.go index bb8451e05..955f2ecef 100644 --- a/pkg/service/wire.go +++ b/pkg/service/wire.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build wireinject // +build wireinject diff --git a/pkg/service/wsprotocol.go b/pkg/service/wsprotocol.go index 06e971719..50a4dc2fb 100644 --- a/pkg/service/wsprotocol.go +++ b/pkg/service/wsprotocol.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package service import ( diff --git a/pkg/sfu/audio/audiolevel.go b/pkg/sfu/audio/audiolevel.go index 15b549c9c..7e834fda7 100644 --- a/pkg/sfu/audio/audiolevel.go +++ b/pkg/sfu/audio/audiolevel.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package audio import ( diff --git a/pkg/sfu/audio/audiolevel_test.go b/pkg/sfu/audio/audiolevel_test.go index aadd4ca29..8b8f03eba 100644 --- a/pkg/sfu/audio/audiolevel_test.go +++ b/pkg/sfu/audio/audiolevel_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package audio import ( diff --git a/pkg/sfu/buffer/buffer.go b/pkg/sfu/buffer/buffer.go index b242662dd..4ed4c0a8b 100644 --- a/pkg/sfu/buffer/buffer.go +++ b/pkg/sfu/buffer/buffer.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/buffer_test.go b/pkg/sfu/buffer/buffer_test.go index 1e22bd991..7f1e97357 100644 --- a/pkg/sfu/buffer/buffer_test.go +++ b/pkg/sfu/buffer/buffer_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/datastats.go b/pkg/sfu/buffer/datastats.go index 880e172af..515341cc0 100644 --- a/pkg/sfu/buffer/datastats.go +++ b/pkg/sfu/buffer/datastats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/datastats_test.go b/pkg/sfu/buffer/datastats_test.go index f2369b7c5..5803fe9d9 100644 --- a/pkg/sfu/buffer/datastats_test.go +++ b/pkg/sfu/buffer/datastats_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/dependencydescriptorparser.go b/pkg/sfu/buffer/dependencydescriptorparser.go index 71b4aac2e..17ed0732d 100644 --- a/pkg/sfu/buffer/dependencydescriptorparser.go +++ b/pkg/sfu/buffer/dependencydescriptorparser.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/factory.go b/pkg/sfu/buffer/factory.go index d3436a6ca..d0a9979f8 100644 --- a/pkg/sfu/buffer/factory.go +++ b/pkg/sfu/buffer/factory.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/fps.go b/pkg/sfu/buffer/fps.go index 518b8e38c..0ba7c5764 100644 --- a/pkg/sfu/buffer/fps.go +++ b/pkg/sfu/buffer/fps.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/fps_test.go b/pkg/sfu/buffer/fps_test.go index b090d2770..4a85d2808 100644 --- a/pkg/sfu/buffer/fps_test.go +++ b/pkg/sfu/buffer/fps_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/helpers.go b/pkg/sfu/buffer/helpers.go index 01bb33403..f52464b4c 100644 --- a/pkg/sfu/buffer/helpers.go +++ b/pkg/sfu/buffer/helpers.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/helpers_test.go b/pkg/sfu/buffer/helpers_test.go index 6ce0ad860..378bfbebf 100644 --- a/pkg/sfu/buffer/helpers_test.go +++ b/pkg/sfu/buffer/helpers_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/rtcpreader.go b/pkg/sfu/buffer/rtcpreader.go index 5d322abcd..1f8f365df 100644 --- a/pkg/sfu/buffer/rtcpreader.go +++ b/pkg/sfu/buffer/rtcpreader.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/rtpstats.go b/pkg/sfu/buffer/rtpstats.go index 075fe72fe..cd9c96066 100644 --- a/pkg/sfu/buffer/rtpstats.go +++ b/pkg/sfu/buffer/rtpstats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/rtpstats_test.go b/pkg/sfu/buffer/rtpstats_test.go index 70c852e7b..c5c4138ba 100644 --- a/pkg/sfu/buffer/rtpstats_test.go +++ b/pkg/sfu/buffer/rtpstats_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/streamstats.go b/pkg/sfu/buffer/streamstats.go index 04c02a65b..cdd8e1333 100644 --- a/pkg/sfu/buffer/streamstats.go +++ b/pkg/sfu/buffer/streamstats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer type StreamStatsWithLayers struct { diff --git a/pkg/sfu/buffer/videolayer.go b/pkg/sfu/buffer/videolayer.go index eedf0b2c8..761cc1c13 100644 --- a/pkg/sfu/buffer/videolayer.go +++ b/pkg/sfu/buffer/videolayer.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import "fmt" diff --git a/pkg/sfu/buffer/videolayerutils.go b/pkg/sfu/buffer/videolayerutils.go index 32abdb45d..b18c83d84 100644 --- a/pkg/sfu/buffer/videolayerutils.go +++ b/pkg/sfu/buffer/videolayerutils.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/buffer/videolayerutils_test.go b/pkg/sfu/buffer/videolayerutils_test.go index b57bb2de0..bb103f72c 100644 --- a/pkg/sfu/buffer/videolayerutils_test.go +++ b/pkg/sfu/buffer/videolayerutils_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buffer import ( diff --git a/pkg/sfu/codecmunger/codecmunger.go b/pkg/sfu/codecmunger/codecmunger.go index eec4f2437..850cecb8d 100644 --- a/pkg/sfu/codecmunger/codecmunger.go +++ b/pkg/sfu/codecmunger/codecmunger.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package codecmunger import ( diff --git a/pkg/sfu/codecmunger/null.go b/pkg/sfu/codecmunger/null.go index f9c327a2d..32e3d9ee9 100644 --- a/pkg/sfu/codecmunger/null.go +++ b/pkg/sfu/codecmunger/null.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package codecmunger import ( diff --git a/pkg/sfu/codecmunger/vp8.go b/pkg/sfu/codecmunger/vp8.go index dbe8f0665..bb270387d 100644 --- a/pkg/sfu/codecmunger/vp8.go +++ b/pkg/sfu/codecmunger/vp8.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package codecmunger import ( diff --git a/pkg/sfu/codecmunger/vp8_test.go b/pkg/sfu/codecmunger/vp8_test.go index 93c27086c..c72965189 100644 --- a/pkg/sfu/codecmunger/vp8_test.go +++ b/pkg/sfu/codecmunger/vp8_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package codecmunger import ( diff --git a/pkg/sfu/connectionquality/connectionstats.go b/pkg/sfu/connectionquality/connectionstats.go index 4c1c9e545..565eccabb 100644 --- a/pkg/sfu/connectionquality/connectionstats.go +++ b/pkg/sfu/connectionquality/connectionstats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package connectionquality import ( diff --git a/pkg/sfu/connectionquality/connectionstats_test.go b/pkg/sfu/connectionquality/connectionstats_test.go index ff3474cda..a8aec4b81 100644 --- a/pkg/sfu/connectionquality/connectionstats_test.go +++ b/pkg/sfu/connectionquality/connectionstats_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package connectionquality import ( diff --git a/pkg/sfu/connectionquality/scorer.go b/pkg/sfu/connectionquality/scorer.go index 5391406a9..340f32368 100644 --- a/pkg/sfu/connectionquality/scorer.go +++ b/pkg/sfu/connectionquality/scorer.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package connectionquality import ( diff --git a/pkg/sfu/dependencydescriptor/bitstreamreader.go b/pkg/sfu/dependencydescriptor/bitstreamreader.go index 1ce60e390..62f4d100c 100644 --- a/pkg/sfu/dependencydescriptor/bitstreamreader.go +++ b/pkg/sfu/dependencydescriptor/bitstreamreader.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/dependencydescriptor/bitstreamwriter.go b/pkg/sfu/dependencydescriptor/bitstreamwriter.go index 0461792aa..1e5ffacbe 100644 --- a/pkg/sfu/dependencydescriptor/bitstreamwriter.go +++ b/pkg/sfu/dependencydescriptor/bitstreamwriter.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/dependencydescriptor/dependencydescriptorextension.go b/pkg/sfu/dependencydescriptor/dependencydescriptorextension.go index 7493f1bfc..b573d7d60 100644 --- a/pkg/sfu/dependencydescriptor/dependencydescriptorextension.go +++ b/pkg/sfu/dependencydescriptor/dependencydescriptorextension.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/dependencydescriptor/dependencydescriptorextension_test.go b/pkg/sfu/dependencydescriptor/dependencydescriptorextension_test.go index 6580c8842..95c3aba35 100644 --- a/pkg/sfu/dependencydescriptor/dependencydescriptorextension_test.go +++ b/pkg/sfu/dependencydescriptor/dependencydescriptorextension_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/dependencydescriptor/dependencydescriptorreader.go b/pkg/sfu/dependencydescriptor/dependencydescriptorreader.go index 68f00b863..04ae1ce7c 100644 --- a/pkg/sfu/dependencydescriptor/dependencydescriptorreader.go +++ b/pkg/sfu/dependencydescriptor/dependencydescriptorreader.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/dependencydescriptor/dependencydescriptorwriter.go b/pkg/sfu/dependencydescriptor/dependencydescriptorwriter.go index 0c4d5164f..37ce7bcf8 100644 --- a/pkg/sfu/dependencydescriptor/dependencydescriptorwriter.go +++ b/pkg/sfu/dependencydescriptor/dependencydescriptorwriter.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dependencydescriptor import ( diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 0ad86315c..16c8f4456 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/downtrackspreader.go b/pkg/sfu/downtrackspreader.go index 8d986120e..dd7ac59c6 100644 --- a/pkg/sfu/downtrackspreader.go +++ b/pkg/sfu/downtrackspreader.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/errors.go b/pkg/sfu/errors.go index 22831db4c..10743808c 100644 --- a/pkg/sfu/errors.go +++ b/pkg/sfu/errors.go @@ -1 +1,15 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu diff --git a/pkg/sfu/forwarder.go b/pkg/sfu/forwarder.go index 36edeb558..9839fd76c 100644 --- a/pkg/sfu/forwarder.go +++ b/pkg/sfu/forwarder.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/forwarder_test.go b/pkg/sfu/forwarder_test.go index a99095839..935009792 100644 --- a/pkg/sfu/forwarder_test.go +++ b/pkg/sfu/forwarder_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/helpers.go b/pkg/sfu/helpers.go index b6dcafd9f..1f4101910 100644 --- a/pkg/sfu/helpers.go +++ b/pkg/sfu/helpers.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/pacer/base.go b/pkg/sfu/pacer/base.go index 4b5da20c9..83e0efc43 100644 --- a/pkg/sfu/pacer/base.go +++ b/pkg/sfu/pacer/base.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/pacer/leaky_bucket.go b/pkg/sfu/pacer/leaky_bucket.go index 6e16f7f4e..9ac2a1350 100644 --- a/pkg/sfu/pacer/leaky_bucket.go +++ b/pkg/sfu/pacer/leaky_bucket.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/pacer/no_queue.go b/pkg/sfu/pacer/no_queue.go index b34b994ae..927236394 100644 --- a/pkg/sfu/pacer/no_queue.go +++ b/pkg/sfu/pacer/no_queue.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/pacer/pacer.go b/pkg/sfu/pacer/pacer.go index 2288d8639..48b20efea 100644 --- a/pkg/sfu/pacer/pacer.go +++ b/pkg/sfu/pacer/pacer.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/pacer/packet_time.go b/pkg/sfu/pacer/packet_time.go index 3dce57e3a..eac3866b4 100644 --- a/pkg/sfu/pacer/packet_time.go +++ b/pkg/sfu/pacer/packet_time.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/pacer/pass_through.go b/pkg/sfu/pacer/pass_through.go index ccbefbd61..8c33d808f 100644 --- a/pkg/sfu/pacer/pass_through.go +++ b/pkg/sfu/pacer/pass_through.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pacer import ( diff --git a/pkg/sfu/receiver.go b/pkg/sfu/receiver.go index 75ba72aa5..46508acb5 100644 --- a/pkg/sfu/receiver.go +++ b/pkg/sfu/receiver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/receiver_test.go b/pkg/sfu/receiver_test.go index e451c3fe3..a1f475e2a 100644 --- a/pkg/sfu/receiver_test.go +++ b/pkg/sfu/receiver_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/redprimaryreceiver.go b/pkg/sfu/redprimaryreceiver.go index 5f6fd8183..eb0965627 100644 --- a/pkg/sfu/redprimaryreceiver.go +++ b/pkg/sfu/redprimaryreceiver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/redreceiver.go b/pkg/sfu/redreceiver.go index 7a9adc700..57cf49e8b 100644 --- a/pkg/sfu/redreceiver.go +++ b/pkg/sfu/redreceiver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/redreceiver_test.go b/pkg/sfu/redreceiver_test.go index 72d8d9a0e..2aae30182 100644 --- a/pkg/sfu/redreceiver_test.go +++ b/pkg/sfu/redreceiver_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/rtpmunger.go b/pkg/sfu/rtpmunger.go index 452019507..52faa8124 100644 --- a/pkg/sfu/rtpmunger.go +++ b/pkg/sfu/rtpmunger.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/rtpmunger_test.go b/pkg/sfu/rtpmunger_test.go index b4d764ca3..63a611a1f 100644 --- a/pkg/sfu/rtpmunger_test.go +++ b/pkg/sfu/rtpmunger_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/sequencer.go b/pkg/sfu/sequencer.go index 333fd93ff..e0f89d2c7 100644 --- a/pkg/sfu/sequencer.go +++ b/pkg/sfu/sequencer.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/sequencer_test.go b/pkg/sfu/sequencer_test.go index 87434bf03..a2303742d 100644 --- a/pkg/sfu/sequencer_test.go +++ b/pkg/sfu/sequencer_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/sfu.go b/pkg/sfu/sfu.go index cd15dc01f..648c1e563 100644 --- a/pkg/sfu/sfu.go +++ b/pkg/sfu/sfu.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/streamallocator/channelobserver.go b/pkg/sfu/streamallocator/channelobserver.go index 9776f8c8a..e8c432dc8 100644 --- a/pkg/sfu/streamallocator/channelobserver.go +++ b/pkg/sfu/streamallocator/channelobserver.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/nacktracker.go b/pkg/sfu/streamallocator/nacktracker.go index 74104d625..b353781e5 100644 --- a/pkg/sfu/streamallocator/nacktracker.go +++ b/pkg/sfu/streamallocator/nacktracker.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/probe_controller.go b/pkg/sfu/streamallocator/probe_controller.go index 1d6bfd352..0d7bb52b7 100644 --- a/pkg/sfu/streamallocator/probe_controller.go +++ b/pkg/sfu/streamallocator/probe_controller.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/prober.go b/pkg/sfu/streamallocator/prober.go index be774f9b2..c30202454 100644 --- a/pkg/sfu/streamallocator/prober.go +++ b/pkg/sfu/streamallocator/prober.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Design of Prober // // Probing is used to check for existence of excess channel capacity. diff --git a/pkg/sfu/streamallocator/ratemonitor.go b/pkg/sfu/streamallocator/ratemonitor.go index 06445ea44..9c2ba243e 100644 --- a/pkg/sfu/streamallocator/ratemonitor.go +++ b/pkg/sfu/streamallocator/ratemonitor.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/streamallocator.go b/pkg/sfu/streamallocator/streamallocator.go index 30d7d8616..aa274be3e 100644 --- a/pkg/sfu/streamallocator/streamallocator.go +++ b/pkg/sfu/streamallocator/streamallocator.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/streamstateupdate.go b/pkg/sfu/streamallocator/streamstateupdate.go index b7bca6a2d..53156de3c 100644 --- a/pkg/sfu/streamallocator/streamstateupdate.go +++ b/pkg/sfu/streamallocator/streamstateupdate.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/track.go b/pkg/sfu/streamallocator/track.go index 63d201bc8..6ccae215b 100644 --- a/pkg/sfu/streamallocator/track.go +++ b/pkg/sfu/streamallocator/track.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamallocator/trenddetector.go b/pkg/sfu/streamallocator/trenddetector.go index ed0ae1d71..c54d29efa 100644 --- a/pkg/sfu/streamallocator/trenddetector.go +++ b/pkg/sfu/streamallocator/trenddetector.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamallocator import ( diff --git a/pkg/sfu/streamtracker/interfaces.go b/pkg/sfu/streamtracker/interfaces.go index a9135e631..f3ad5e699 100644 --- a/pkg/sfu/streamtracker/interfaces.go +++ b/pkg/sfu/streamtracker/interfaces.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker.go b/pkg/sfu/streamtracker/streamtracker.go index 1be7dc0fc..b45723a79 100644 --- a/pkg/sfu/streamtracker/streamtracker.go +++ b/pkg/sfu/streamtracker/streamtracker.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker_dd.go b/pkg/sfu/streamtracker/streamtracker_dd.go index 2d7301f7c..c19b3fe85 100644 --- a/pkg/sfu/streamtracker/streamtracker_dd.go +++ b/pkg/sfu/streamtracker/streamtracker_dd.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker_dd_test.go b/pkg/sfu/streamtracker/streamtracker_dd_test.go index 1c8ae8200..f638e4e2d 100644 --- a/pkg/sfu/streamtracker/streamtracker_dd_test.go +++ b/pkg/sfu/streamtracker/streamtracker_dd_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker_frame.go b/pkg/sfu/streamtracker/streamtracker_frame.go index 87273bcc1..db08d9343 100644 --- a/pkg/sfu/streamtracker/streamtracker_frame.go +++ b/pkg/sfu/streamtracker/streamtracker_frame.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker_packet.go b/pkg/sfu/streamtracker/streamtracker_packet.go index 78866e40e..e95629580 100644 --- a/pkg/sfu/streamtracker/streamtracker_packet.go +++ b/pkg/sfu/streamtracker/streamtracker_packet.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtracker/streamtracker_packet_test.go b/pkg/sfu/streamtracker/streamtracker_packet_test.go index a7beb2d3c..276483e5e 100644 --- a/pkg/sfu/streamtracker/streamtracker_packet_test.go +++ b/pkg/sfu/streamtracker/streamtracker_packet_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package streamtracker import ( diff --git a/pkg/sfu/streamtrackermanager.go b/pkg/sfu/streamtrackermanager.go index 1a5d24ffe..30ba98322 100644 --- a/pkg/sfu/streamtrackermanager.go +++ b/pkg/sfu/streamtrackermanager.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package sfu import ( diff --git a/pkg/sfu/testutils/data.go b/pkg/sfu/testutils/data.go index 2ab28767a..38640d96b 100644 --- a/pkg/sfu/testutils/data.go +++ b/pkg/sfu/testutils/data.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package testutils import ( diff --git a/pkg/sfu/utils/wraparound.go b/pkg/sfu/utils/wraparound.go index ea9a09887..299002fbf 100644 --- a/pkg/sfu/utils/wraparound.go +++ b/pkg/sfu/utils/wraparound.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package utils import ( diff --git a/pkg/sfu/utils/wraparound_test.go b/pkg/sfu/utils/wraparound_test.go index e9b6bd7a2..9e3b8e555 100644 --- a/pkg/sfu/utils/wraparound_test.go +++ b/pkg/sfu/utils/wraparound_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package utils import ( diff --git a/pkg/sfu/videolayerselector/base.go b/pkg/sfu/videolayerselector/base.go index 7323fc7ae..37b223948 100644 --- a/pkg/sfu/videolayerselector/base.go +++ b/pkg/sfu/videolayerselector/base.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/decodetarget.go b/pkg/sfu/videolayerselector/decodetarget.go index 45055ac06..7204b329f 100644 --- a/pkg/sfu/videolayerselector/decodetarget.go +++ b/pkg/sfu/videolayerselector/decodetarget.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/dependencydescriptor.go b/pkg/sfu/videolayerselector/dependencydescriptor.go index 34f8b0b55..ef63f6526 100644 --- a/pkg/sfu/videolayerselector/dependencydescriptor.go +++ b/pkg/sfu/videolayerselector/dependencydescriptor.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/dependencydescriptor_test.go b/pkg/sfu/videolayerselector/dependencydescriptor_test.go index 0a4ead314..8b4aad771 100644 --- a/pkg/sfu/videolayerselector/dependencydescriptor_test.go +++ b/pkg/sfu/videolayerselector/dependencydescriptor_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/framechain.go b/pkg/sfu/videolayerselector/framechain.go index 60cb4ea73..6dc460c28 100644 --- a/pkg/sfu/videolayerselector/framechain.go +++ b/pkg/sfu/videolayerselector/framechain.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/null.go b/pkg/sfu/videolayerselector/null.go index d1b87fb1b..644a8f957 100644 --- a/pkg/sfu/videolayerselector/null.go +++ b/pkg/sfu/videolayerselector/null.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/selectordecisioncache.go b/pkg/sfu/videolayerselector/selectordecisioncache.go index c98d13984..ea60086b0 100644 --- a/pkg/sfu/videolayerselector/selectordecisioncache.go +++ b/pkg/sfu/videolayerselector/selectordecisioncache.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/simulcast.go b/pkg/sfu/videolayerselector/simulcast.go index 06e0bad72..7d7e173a8 100644 --- a/pkg/sfu/videolayerselector/simulcast.go +++ b/pkg/sfu/videolayerselector/simulcast.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/temporallayerselector/null.go b/pkg/sfu/videolayerselector/temporallayerselector/null.go index d39cab106..51f2fb591 100644 --- a/pkg/sfu/videolayerselector/temporallayerselector/null.go +++ b/pkg/sfu/videolayerselector/temporallayerselector/null.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package temporallayerselector import ( diff --git a/pkg/sfu/videolayerselector/temporallayerselector/temporallayerselector.go b/pkg/sfu/videolayerselector/temporallayerselector/temporallayerselector.go index 8219aea2d..1d691b401 100644 --- a/pkg/sfu/videolayerselector/temporallayerselector/temporallayerselector.go +++ b/pkg/sfu/videolayerselector/temporallayerselector/temporallayerselector.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package temporallayerselector import "github.com/livekit/livekit-server/pkg/sfu/buffer" diff --git a/pkg/sfu/videolayerselector/temporallayerselector/vp8.go b/pkg/sfu/videolayerselector/temporallayerselector/vp8.go index a83765526..2d2660897 100644 --- a/pkg/sfu/videolayerselector/temporallayerselector/vp8.go +++ b/pkg/sfu/videolayerselector/temporallayerselector/vp8.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package temporallayerselector import ( diff --git a/pkg/sfu/videolayerselector/videolayerselector.go b/pkg/sfu/videolayerselector/videolayerselector.go index f17d745d1..545196eae 100644 --- a/pkg/sfu/videolayerselector/videolayerselector.go +++ b/pkg/sfu/videolayerselector/videolayerselector.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/sfu/videolayerselector/vp9.go b/pkg/sfu/videolayerselector/vp9.go index 508cdf289..62d5d35d9 100644 --- a/pkg/sfu/videolayerselector/vp9.go +++ b/pkg/sfu/videolayerselector/vp9.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package videolayerselector import ( diff --git a/pkg/telemetry/analyticsservice.go b/pkg/telemetry/analyticsservice.go index 0373c33b6..8611337f1 100644 --- a/pkg/telemetry/analyticsservice.go +++ b/pkg/telemetry/analyticsservice.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/events.go b/pkg/telemetry/events.go index b1e731bdc..35eaf668e 100644 --- a/pkg/telemetry/events.go +++ b/pkg/telemetry/events.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/events_test.go b/pkg/telemetry/events_test.go index 77529b211..e83b61ba9 100644 --- a/pkg/telemetry/events_test.go +++ b/pkg/telemetry/events_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry_test import ( diff --git a/pkg/telemetry/prometheus/node.go b/pkg/telemetry/prometheus/node.go index 5dc04a3c8..dad09977e 100644 --- a/pkg/telemetry/prometheus/node.go +++ b/pkg/telemetry/prometheus/node.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( diff --git a/pkg/telemetry/prometheus/node_linux.go b/pkg/telemetry/prometheus/node_linux.go index 9854f056e..baa6919f8 100644 --- a/pkg/telemetry/prometheus/node_linux.go +++ b/pkg/telemetry/prometheus/node_linux.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build linux // +build linux diff --git a/pkg/telemetry/prometheus/node_nonlinux.go b/pkg/telemetry/prometheus/node_nonlinux.go index 5cd36c9c1..22fc11c7b 100644 --- a/pkg/telemetry/prometheus/node_nonlinux.go +++ b/pkg/telemetry/prometheus/node_nonlinux.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build !linux package prometheus diff --git a/pkg/telemetry/prometheus/packets.go b/pkg/telemetry/prometheus/packets.go index 09525053c..3048367a8 100644 --- a/pkg/telemetry/prometheus/packets.go +++ b/pkg/telemetry/prometheus/packets.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( diff --git a/pkg/telemetry/prometheus/psrpc.go b/pkg/telemetry/prometheus/psrpc.go index 958704605..f07c90034 100644 --- a/pkg/telemetry/prometheus/psrpc.go +++ b/pkg/telemetry/prometheus/psrpc.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( diff --git a/pkg/telemetry/prometheus/quality.go b/pkg/telemetry/prometheus/quality.go index 708c654f0..481b7558f 100644 --- a/pkg/telemetry/prometheus/quality.go +++ b/pkg/telemetry/prometheus/quality.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( diff --git a/pkg/telemetry/prometheus/rooms.go b/pkg/telemetry/prometheus/rooms.go index d50ce2d15..ef320ad73 100644 --- a/pkg/telemetry/prometheus/rooms.go +++ b/pkg/telemetry/prometheus/rooms.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( diff --git a/pkg/telemetry/signalanddatastats.go b/pkg/telemetry/signalanddatastats.go index 0ff189ca7..840f126c3 100644 --- a/pkg/telemetry/signalanddatastats.go +++ b/pkg/telemetry/signalanddatastats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/stats.go b/pkg/telemetry/stats.go index 81e9c2556..79d6717cb 100644 --- a/pkg/telemetry/stats.go +++ b/pkg/telemetry/stats.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/stats_test.go b/pkg/telemetry/stats_test.go index 5dd8b82c3..1758c8b45 100644 --- a/pkg/telemetry/stats_test.go +++ b/pkg/telemetry/stats_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry_test import ( diff --git a/pkg/telemetry/statsconn.go b/pkg/telemetry/statsconn.go index 91f60af94..10ac45fb5 100644 --- a/pkg/telemetry/statsconn.go +++ b/pkg/telemetry/statsconn.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/statsworker.go b/pkg/telemetry/statsworker.go index f963097ee..b86175368 100644 --- a/pkg/telemetry/statsworker.go +++ b/pkg/telemetry/statsworker.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/telemetry/telemetryservice.go b/pkg/telemetry/telemetryservice.go index 5b4c4b9c1..c74619eda 100644 --- a/pkg/telemetry/telemetryservice.go +++ b/pkg/telemetry/telemetryservice.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package telemetry import ( diff --git a/pkg/testutils/timeout.go b/pkg/testutils/timeout.go index af70a48f9..11debef92 100644 --- a/pkg/testutils/timeout.go +++ b/pkg/testutils/timeout.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package testutils import ( diff --git a/pkg/utils/math.go b/pkg/utils/math.go index 0ac6319af..9e75c1ad8 100644 --- a/pkg/utils/math.go +++ b/pkg/utils/math.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package utils import "sort" diff --git a/pkg/utils/opsqueue.go b/pkg/utils/opsqueue.go index 473430a3a..3e992461c 100644 --- a/pkg/utils/opsqueue.go +++ b/pkg/utils/opsqueue.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package utils import ( diff --git a/test/client/client.go b/test/client/client.go index 776d356a7..70b135a6d 100644 --- a/test/client/client.go +++ b/test/client/client.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package client import ( diff --git a/test/client/trackwriter.go b/test/client/trackwriter.go index e475a2ed9..9104f9cd2 100644 --- a/test/client/trackwriter.go +++ b/test/client/trackwriter.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package client import ( diff --git a/test/integration_helpers.go b/test/integration_helpers.go index ec0ec7fb2..82f50f825 100644 --- a/test/integration_helpers.go +++ b/test/integration_helpers.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/test/multinode_roomservice_test.go b/test/multinode_roomservice_test.go index f822ebdb1..a1ec1cb8b 100644 --- a/test/multinode_roomservice_test.go +++ b/test/multinode_roomservice_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/test/multinode_test.go b/test/multinode_test.go index fe973aefd..8b1eb1d32 100644 --- a/test/multinode_test.go +++ b/test/multinode_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/test/scenarios.go b/test/scenarios.go index d5c7878e0..d72578614 100644 --- a/test/scenarios.go +++ b/test/scenarios.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/test/singlenode_test.go b/test/singlenode_test.go index fe84de51d..fe2e55b07 100644 --- a/test/singlenode_test.go +++ b/test/singlenode_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/test/webhook_test.go b/test/webhook_test.go index 22e901e88..678c48c80 100644 --- a/test/webhook_test.go +++ b/test/webhook_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package test import ( diff --git a/tools/tools.go b/tools/tools.go index 5a341066b..f77dcd861 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + //go:build tools // +build tools diff --git a/version/version.go b/version/version.go index c44e5ca30..1df2fdae5 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package version const Version = "1.4.4" From a87232f42a83868721912b714bcff93a7439d0d1 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Fri, 28 Jul 2023 14:40:33 +0800 Subject: [PATCH 19/21] Frame integrity check for svc codec (#1914) * Frame integrity check for svc codec * Fix test * Spell --- pkg/sfu/buffer/dependencydescriptorparser.go | 19 +- pkg/sfu/buffer/frameintegrity.go | 211 ++++++++++++++++++ pkg/sfu/buffer/frameintegrity_test.go | 72 ++++++ .../dependencydescriptor.go | 45 +--- .../dependencydescriptor_test.go | 4 + pkg/sfu/videolayerselector/framechain.go | 5 + 6 files changed, 317 insertions(+), 39 deletions(-) create mode 100644 pkg/sfu/buffer/frameintegrity.go create mode 100644 pkg/sfu/buffer/frameintegrity_test.go diff --git a/pkg/sfu/buffer/dependencydescriptorparser.go b/pkg/sfu/buffer/dependencydescriptorparser.go index 17ed0732d..a3a2be794 100644 --- a/pkg/sfu/buffer/dependencydescriptorparser.go +++ b/pkg/sfu/buffer/dependencydescriptorparser.go @@ -33,10 +33,12 @@ type DependencyDescriptorParser struct { onMaxLayerChanged func(int32, int32) decodeTargets []DependencyDescriptorDecodeTarget - wrapAround *utils.WrapAround[uint16, uint64] + seqWrapAround *utils.WrapAround[uint16, uint64] + frameWrapAround *utils.WrapAround[uint16, uint64] structureExtSeq uint64 activeDecodeTargetsExtSeq uint64 activeDecodeTargetsMask uint32 + frameChecker *FrameIntegrityChecker } func NewDependencyDescriptorParser(ddExtID uint8, logger logger.Logger, onMaxLayerChanged func(int32, int32)) *DependencyDescriptorParser { @@ -45,7 +47,9 @@ func NewDependencyDescriptorParser(ddExtID uint8, logger logger.Logger, onMaxLay ddExtID: ddExtID, logger: logger, onMaxLayerChanged: onMaxLayerChanged, - wrapAround: utils.NewWrapAround[uint16, uint64](), + seqWrapAround: utils.NewWrapAround[uint16, uint64](), + frameWrapAround: utils.NewWrapAround[uint16, uint64](), + frameChecker: NewFrameIntegrityChecker(180, 1024), // 2seconds for L3T3 30fps video } } @@ -55,6 +59,8 @@ type ExtDependencyDescriptor struct { DecodeTargets []DependencyDescriptorDecodeTarget StructureUpdated bool ActiveDecodeTargetsUpdated bool + Integrity bool + ExtFrameNum uint64 } func (r *DependencyDescriptorParser) Parse(pkt *rtp.Packet) (*ExtDependencyDescriptor, VideoLayer, error) { @@ -75,14 +81,19 @@ func (r *DependencyDescriptorParser) Parse(pkt *rtp.Packet) (*ExtDependencyDescr return nil, videoLayer, err } - extSeq := r.wrapAround.Update(pkt.SequenceNumber).ExtendedVal + extSeq := r.seqWrapAround.Update(pkt.SequenceNumber).ExtendedVal if ddVal.FrameDependencies != nil { videoLayer.Spatial, videoLayer.Temporal = int32(ddVal.FrameDependencies.SpatialId), int32(ddVal.FrameDependencies.TemporalId) } + extFN := r.frameWrapAround.Update(ddVal.FrameNumber).ExtendedVal + r.frameChecker.AddPacket(extSeq, extFN, &ddVal) + extDD := &ExtDependencyDescriptor{ - Descriptor: &ddVal, + Descriptor: &ddVal, + ExtFrameNum: extFN, + Integrity: r.frameChecker.FrameIntegrity(extFN), } if ddVal.AttachedStructure != nil { diff --git a/pkg/sfu/buffer/frameintegrity.go b/pkg/sfu/buffer/frameintegrity.go new file mode 100644 index 000000000..1b712652e --- /dev/null +++ b/pkg/sfu/buffer/frameintegrity.go @@ -0,0 +1,211 @@ +package buffer + +import ( + dd "github.com/livekit/livekit-server/pkg/sfu/dependencydescriptor" +) + +type FrameEntity struct { + startSeq *uint64 + endSeq *uint64 + integrity bool + + packetsConsective func(uint64, uint64) bool +} + +func (fe *FrameEntity) AddPacket(extSeq uint64, ddVal *dd.DependencyDescriptor) { + // duplicate packet + if fe.integrity { + return + } + + if fe.startSeq == nil && ddVal.FirstPacketInFrame { + fe.startSeq = &extSeq + } + if fe.endSeq == nil && ddVal.LastPacketInFrame { + fe.endSeq = &extSeq + } + + if fe.startSeq != nil && fe.endSeq != nil { + if fe.packetsConsective(*fe.startSeq, *fe.endSeq) { + fe.integrity = true + } + } +} + +func (fe *FrameEntity) Reset() { + fe.integrity = false + fe.startSeq, fe.endSeq = nil, nil +} + +func (fe *FrameEntity) Integrity() bool { + return fe.integrity +} + +// ------------------------------ + +type PacketHistory struct { + base uint64 + last uint64 + bits []uint64 + packetCount int + inited bool +} + +func NewPacketHistory(packetCount int) *PacketHistory { + packetCount = (packetCount + 63) / 64 * 64 + return &PacketHistory{ + bits: make([]uint64, packetCount/64), + packetCount: packetCount, + } +} + +func (ph *PacketHistory) AddPacket(extSeq uint64) { + if !ph.inited { + ph.inited = true + ph.base = uint64(extSeq) + // set base to extSeq-100 to avoid out-of-order packets belongs to first frame to be dropped + if ph.base > 100 { + ph.base -= 100 + } else { + ph.base = 0 + } + ph.last = uint64(extSeq) + ph.set(extSeq, true) + return + } + + if extSeq <= ph.base { + // too old + return + } + + if extSeq <= ph.last { + if ph.last-extSeq < uint64(ph.packetCount) { + ph.set(extSeq, true) + } + return + } + + for i := ph.last + 1; i < extSeq; i++ { + ph.set(i, false) + } + + ph.set(extSeq, true) + ph.last = extSeq +} + +func (ph *PacketHistory) getPos(seq uint64) (index, offset int) { + idx := (seq - ph.base) % uint64(ph.packetCount) + return int(idx >> 6), int(idx % 64) +} + +func (ph *PacketHistory) set(seq uint64, received bool) { + idx, offset := ph.getPos(seq) + if !received { + ph.bits[idx] &= ^(1 << offset) + } else { + ph.bits[idx] |= 1 << (offset) + } +} + +func (ph *PacketHistory) PacketsConsecutive(start, end uint64) bool { + if start > end { + return false + } + + if end-start >= uint64(ph.packetCount) { + return false + } + + startIndex, startOffset := ph.getPos(start) + endIndex, endOffset := ph.getPos(end) + + if startIndex == endIndex && end-start <= 64 { + testBits := uint64((1<<(endOffset-startOffset+1))-1) << startOffset + return ph.bits[startIndex]&testBits == testBits + } + + if (ph.bits[startIndex]>>(startOffset))+1 != 1<<(64-startOffset) { + return false + } + + for i := startIndex + 1; i != endIndex; i++ { + if i == len(ph.bits) { + i = 0 + if i == endIndex { + break + } + } + if ph.bits[i]+1 != 0 { + return false + } + } + + testBits := uint64((1 << (endOffset + 1)) - 1) + return ph.bits[endIndex]&testBits == testBits +} + +// ------------------------------ + +type FrameIntegrityChecker struct { + frameCount int + frames []FrameEntity + base uint64 + last uint64 + + pktHistory *PacketHistory + inited bool +} + +func NewFrameIntegrityChecker(frameCount, packetCount int) *FrameIntegrityChecker { + fc := &FrameIntegrityChecker{ + frames: make([]FrameEntity, frameCount), + pktHistory: NewPacketHistory(packetCount), + frameCount: frameCount, + } + + for i := range fc.frames { + fc.frames[i].packetsConsective = fc.pktHistory.PacketsConsecutive + fc.frames[i].Reset() + } + return fc +} + +func (fc *FrameIntegrityChecker) AddPacket(extSeq uint64, extFrameNum uint64, ddVal *dd.DependencyDescriptor) { + fc.pktHistory.AddPacket(extSeq) + + if !fc.inited { + fc.inited = true + fc.base = extFrameNum + fc.last = extFrameNum + } + + if extFrameNum < fc.base { + // frame too old + return + } + + if extFrameNum <= fc.last { + if fc.last-extFrameNum >= uint64(fc.frameCount) { + // frame too old + return + } + fc.frames[int(extFrameNum-fc.base)%fc.frameCount].AddPacket(extSeq, ddVal) + return + } + + // reset missing frames + for i := fc.last + 1; i <= extFrameNum; i++ { + fc.frames[int(i-fc.base)%fc.frameCount].Reset() + } + fc.frames[int(extFrameNum-fc.base)%fc.frameCount].AddPacket(extSeq, ddVal) + fc.last = extFrameNum +} + +func (fc *FrameIntegrityChecker) FrameIntegrity(extFrameNum uint64) bool { + if extFrameNum < fc.base || extFrameNum > fc.last || fc.last-extFrameNum >= uint64(fc.frameCount) { + return false + } + + return fc.frames[int(extFrameNum-fc.base)%fc.frameCount].Integrity() +} diff --git a/pkg/sfu/buffer/frameintegrity_test.go b/pkg/sfu/buffer/frameintegrity_test.go new file mode 100644 index 000000000..3e505efdd --- /dev/null +++ b/pkg/sfu/buffer/frameintegrity_test.go @@ -0,0 +1,72 @@ +package buffer + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/livekit/livekit-server/pkg/sfu/dependencydescriptor" +) + +func TestFrameIntegrityChecker(t *testing.T) { + fc := NewFrameIntegrityChecker(100, 1000) + + // first frame out of order + fc.AddPacket(10, 10, &dependencydescriptor.DependencyDescriptor{}) + require.False(t, fc.FrameIntegrity(10)) + fc.AddPacket(9, 10, &dependencydescriptor.DependencyDescriptor{FirstPacketInFrame: true}) + require.False(t, fc.FrameIntegrity(10)) + fc.AddPacket(11, 10, &dependencydescriptor.DependencyDescriptor{LastPacketInFrame: true}) + require.True(t, fc.FrameIntegrity(10)) + + // single packet frame + fc.AddPacket(100, 100, &dependencydescriptor.DependencyDescriptor{FirstPacketInFrame: true, LastPacketInFrame: true}) + require.True(t, fc.FrameIntegrity(100)) + require.False(t, fc.FrameIntegrity(101)) + require.False(t, fc.FrameIntegrity(99)) + + // frame too old than first frame + fc.AddPacket(99, 99, &dependencydescriptor.DependencyDescriptor{FirstPacketInFrame: true, LastPacketInFrame: true}) + + // multiple packet frame, out of order + fc.AddPacket(2001, 2001, &dependencydescriptor.DependencyDescriptor{}) + require.False(t, fc.FrameIntegrity(2001)) + require.False(t, fc.FrameIntegrity(1999)) + // out of frame count(100) + require.False(t, fc.FrameIntegrity(100)) + require.False(t, fc.FrameIntegrity(1900)) + + fc.AddPacket(2000, 2001, &dependencydescriptor.DependencyDescriptor{FirstPacketInFrame: true}) + require.False(t, fc.FrameIntegrity(2001)) + fc.AddPacket(2002, 2001, &dependencydescriptor.DependencyDescriptor{LastPacketInFrame: true}) + require.True(t, fc.FrameIntegrity(2001)) + // duplicate packet + fc.AddPacket(2001, 2001, &dependencydescriptor.DependencyDescriptor{}) + require.True(t, fc.FrameIntegrity(2001)) + + // frame too old + fc.AddPacket(900, 1900, &dependencydescriptor.DependencyDescriptor{FirstPacketInFrame: true, LastPacketInFrame: true}) + require.False(t, fc.FrameIntegrity(1900)) + + for frame := uint64(2002); frame < 2102; frame++ { + // large frame (1000 packets) out of order / retransmitted + firstFrame := uint64(3000 + (frame-2002)*1000) + lastFrame := uint64(3999 + (frame-2002)*1000) + frames := make([]uint64, 0, lastFrame-firstFrame+1) + for i := firstFrame; i <= lastFrame; i++ { + frames = append(frames, i) + } + require.False(t, fc.FrameIntegrity(frame)) + rand.Seed(int64(frame)) + rand.Shuffle(len(frames), func(i, j int) { frames[i], frames[j] = frames[j], frames[i] }) + for i, f := range frames { + fc.AddPacket(f, frame, &dependencydescriptor.DependencyDescriptor{ + FirstPacketInFrame: f == firstFrame, + LastPacketInFrame: f == lastFrame, + }) + require.Equal(t, i == len(frames)-1, fc.FrameIntegrity(frame), i) + } + require.True(t, fc.FrameIntegrity(frame)) + } +} diff --git a/pkg/sfu/videolayerselector/dependencydescriptor.go b/pkg/sfu/videolayerselector/dependencydescriptor.go index ef63f6526..555437c6d 100644 --- a/pkg/sfu/videolayerselector/dependencydescriptor.go +++ b/pkg/sfu/videolayerselector/dependencydescriptor.go @@ -20,14 +20,12 @@ import ( "github.com/livekit/livekit-server/pkg/sfu/buffer" dede "github.com/livekit/livekit-server/pkg/sfu/dependencydescriptor" - "github.com/livekit/livekit-server/pkg/sfu/utils" "github.com/livekit/protocol/logger" ) type DependencyDescriptor struct { *Base - frameNum *utils.WrapAround[uint16, uint64] decisions *SelectorDecisionCache previousActiveDecodeTargetsBitmask *uint32 @@ -43,7 +41,6 @@ type DependencyDescriptor struct { func NewDependencyDescriptor(logger logger.Logger) *DependencyDescriptor { return &DependencyDescriptor{ Base: NewBase(logger), - frameNum: utils.NewWrapAround[uint16, uint64](), decisions: NewSelectorDecisionCache(256, 80), } } @@ -51,7 +48,6 @@ func NewDependencyDescriptor(logger logger.Logger) *DependencyDescriptor { func NewDependencyDescriptorFromNull(vls VideoLayerSelector) *DependencyDescriptor { return &DependencyDescriptor{ Base: vls.(*Null).Base, - frameNum: utils.NewWrapAround[uint16, uint64](), decisions: NewSelectorDecisionCache(256, 80), } } @@ -72,8 +68,7 @@ func (d *DependencyDescriptor) Select(extPkt *buffer.ExtPacket, _layer int32) (r dd := ddwdt.Descriptor - frameNum := d.frameNum.Update(dd.FrameNumber) - extFrameNum := frameNum.ExtendedVal + extFrameNum := ddwdt.ExtFrameNum fd := dd.FrameDependencies incomingLayer := buffer.VideoLayer{ @@ -117,6 +112,8 @@ func (d *DependencyDescriptor) Select(extPkt *buffer.ExtPacket, _layer int32) (r } var dti dede.DecodeTargetIndication d.decodeTargetsLock.RLock() + + // decodeTargets be sorted from high to low, find the highest decode target that is active and integrity for _, dt := range d.decodeTargets { if !dt.Active() || dt.Layer.Spatial > d.targetLayer.Spatial || dt.Layer.Temporal > d.targetLayer.Temporal { continue @@ -133,28 +130,14 @@ func (d *DependencyDescriptor) Select(extPkt *buffer.ExtPacket, _layer int32) (r return } - // Keep forwarding the lower spatial with temporal layer 0 to keep the lower frame chain intact, - // it will cost a few extra bits as those frames might not be present in the current target - // but will make the subscriber switch to lower layer seamlessly without pli. if frameResult.TargetValid { - if highestDecodeTarget.Target == -1 { - highestDecodeTarget = dt.DependencyDescriptorDecodeTarget - dti = frameResult.DTI - } else if dt.Layer.Spatial < highestDecodeTarget.Layer.Spatial && dt.Layer.Temporal == 0 && - frameResult.DTI != dede.DecodeTargetNotPresent && frameResult.DTI != dede.DecodeTargetDiscardable { - dti = frameResult.DTI - } + highestDecodeTarget = dt.DependencyDescriptorDecodeTarget + dti = frameResult.DTI + break } } d.decodeTargetsLock.RUnlock() - // DD-TODO : we don't have a rtp queue to ensure the order of packets now, - // so we don't know packet is lost/out of order, that cause us can't detect - // frame integrity, entire frame is forwareded, whether frame chain is broken. - // So use a simple check here, assume all the reference frame is forwarded and - // only check DTI of the active decode target. - // it is not effeciency, at last we need check frame chain integrity. - if highestDecodeTarget.Target < 0 { // no active decode target, do not select // d.logger.Debugw(fmt.Sprintf("drop packet for no target found, decodeTargets %v, tagetLayer %v, incoming %v", @@ -218,6 +201,7 @@ func (d *DependencyDescriptor) Select(extPkt *buffer.ExtPacket, _layer int32) (r d.previousActiveDecodeTargetsBitmask = d.activeDecodeTargetsBitmask d.activeDecodeTargetsBitmask = buffer.GetActiveDecodeTargetBitmask(d.currentLayer, ddwdt.DecodeTargets) + d.logger.Debugw("switch to target", "highest", highestDecodeTarget.Layer, "current", d.currentLayer, "bitmask", *d.activeDecodeTargetsBitmask) } ddExtension := &dede.DependencyDescriptorExtension{ @@ -241,18 +225,9 @@ func (d *DependencyDescriptor) Select(extPkt *buffer.ExtPacket, _layer int32) (r result.DependencyDescriptorExtension = bytes } - // DD-TODO START - // Ideally should add this frame only on the last packet of the frame and if all packets of the frame have been selected. - // But, adding on any packet so that any out-of-order packets within a frame can be fowarded. - // But, that could result in decodability/chain integrity to erroneously pass (i. e. in the case of lost packet in this - // frame, this frame is not decodable and hence the chain is broken). - // - // Note that packets can get lost in the forwarded path also. That will be handled by receiver sending PLI. - // - // Within SFU, there is more work to do to ensure integrity of forwarded packets/frames to adhere to the complete design - // goal of dependency descriptor - // DD-TODO END - d.decisions.AddForwarded(extFrameNum) + if ddwdt.Integrity { + d.decisions.AddForwarded(extFrameNum) + } result.RTPMarker = extPkt.Packet.Header.Marker || (dd.LastPacketInFrame && d.currentLayer.Spatial == int32(fd.SpatialId)) result.IsSelected = true return diff --git a/pkg/sfu/videolayerselector/dependencydescriptor_test.go b/pkg/sfu/videolayerselector/dependencydescriptor_test.go index 8b4aad771..e9e158fda 100644 --- a/pkg/sfu/videolayerselector/dependencydescriptor_test.go +++ b/pkg/sfu/videolayerselector/dependencydescriptor_test.go @@ -321,6 +321,8 @@ func createDDFrames(maxLayer buffer.VideoLayer, startFrameNumber uint16) []*buff DecodeTargets: decodeTargets, StructureUpdated: true, ActiveDecodeTargetsUpdated: true, + Integrity: true, + ExtFrameNum: uint64(startFrameNumber), }, Packet: &rtp.Packet{ Header: rtp.Header{ @@ -370,6 +372,8 @@ func createDDFrames(maxLayer buffer.VideoLayer, startFrameNumber uint16) []*buff }, }, DecodeTargets: decodeTargets, + Integrity: true, + ExtFrameNum: uint64(startFrameNumber), }, Packet: &rtp.Packet{ Header: rtp.Header{ diff --git a/pkg/sfu/videolayerselector/framechain.go b/pkg/sfu/videolayerselector/framechain.go index 6dc460c28..5edddfad9 100644 --- a/pkg/sfu/videolayerselector/framechain.go +++ b/pkg/sfu/videolayerselector/framechain.go @@ -87,10 +87,15 @@ func (fc *FrameChain) OnFrame(extFrameNum uint64, fd *dd.FrameDependencyTemplate } func (fc *FrameChain) OnExpectFrameChanged(frameNum uint64, decision selectorDecision) { + if fc.broken { + return + } + for i, f := range fc.expectFrames { if f == frameNum { if decision != selectorDecisionForwarded { fc.broken = true + fc.logger.Debugw("frame chain broken", "chanIdx", fc.chainIdx, "sd", decision, "frame", frameNum) } fc.expectFrames[i] = fc.expectFrames[len(fc.expectFrames)-1] fc.expectFrames = fc.expectFrames[:len(fc.expectFrames)-1] From cfee506f51187be965f1fcc1f259bf5133554132 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:39:58 -0700 Subject: [PATCH 20/21] Update golang.org/x/exp digest to b0cb94b (#1877) Generated by renovateBot Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 34d36beea..793e9df8d 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/urfave/cli/v2 v2.25.7 github.com/urfave/negroni/v3 v3.0.0 go.uber.org/atomic v1.11.0 - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb + golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 golang.org/x/sync v0.3.0 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 417006f39..40eb15323 100644 --- a/go.sum +++ b/go.sum @@ -292,8 +292,8 @@ golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 h1:/yRP+0AN7mf5DkD3BAI6TOFnd51gEoDEb8o35jIFtgw= +golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= From b6394d5aa64c1192af149f8568f59bd0833f6889 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Sat, 29 Jul 2023 18:26:57 +0530 Subject: [PATCH 21/21] De-dupe ICE candidates, makes logging cleaner. (#1916) --- go.mod | 10 +++++----- go.sum | 24 +++++++++++------------- pkg/rtc/transport.go | 41 ++++++++++++++++++++++++----------------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index 793e9df8d..1d7e21bf7 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/jxskiss/base62 v1.1.0 github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a - github.com/livekit/protocol v1.5.10 + github.com/livekit/protocol v1.5.11-0.20230729124740-d45d830f69e2 github.com/livekit/psrpc v0.3.2 github.com/mackerelio/go-osstat v0.2.4 github.com/magefile/mage v1.15.0 @@ -26,14 +26,14 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/pion/dtls/v2 v2.2.7 - github.com/pion/ice/v2 v2.3.8 + github.com/pion/ice/v2 v2.3.9 github.com/pion/interceptor v0.1.17 github.com/pion/rtcp v1.2.10 - github.com/pion/rtp v1.7.13 + github.com/pion/rtp v1.8.0 github.com/pion/sdp/v3 v3.0.6 github.com/pion/transport/v2 v2.2.1 github.com/pion/turn/v2 v2.1.2 - github.com/pion/webrtc/v3 v3.2.11 + github.com/pion/webrtc/v3 v3.2.13 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.16.0 github.com/redis/go-redis/v9 v9.0.5 @@ -101,6 +101,6 @@ require ( golang.org/x/text v0.10.0 // indirect golang.org/x/tools v0.9.3 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.57.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 40eb15323..9a2e52f3c 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ= github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a h1:JWpPHcMFuw0fP4swE89CfMgeUXiSN5IKvCJL/5HLI3A= github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a/go.mod h1:xirUXW8xnLGmfCwUeAv/nj1VGo1OO1BmgxrYP7jK/14= -github.com/livekit/protocol v1.5.10 h1:lnaHMa27cbRkHybi/jvOVuRSaLsho2wCLRjKiC6ce2Y= -github.com/livekit/protocol v1.5.10/go.mod h1:eRzojAYSPJuNgDHMlvLji/CPauj9hrgvb6rVPUj6MoU= +github.com/livekit/protocol v1.5.11-0.20230729124740-d45d830f69e2 h1:KxQIooCpXmn+qzxQxNbxBtRXstEFd2/7ihH4Pp1dOc4= +github.com/livekit/protocol v1.5.11-0.20230729124740-d45d830f69e2/go.mod h1:3Dt53NrYnuA7pAJjAjXLJ2q5rU3JKoebvMttZPZWDH8= github.com/livekit/psrpc v0.3.2 h1:eAaJhASme33gtoBhCRLH9jsnWcdm1tHWf0WzaDk56ew= github.com/livekit/psrpc v0.3.2/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U= github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs= @@ -184,8 +184,8 @@ github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0= github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= -github.com/pion/ice/v2 v2.3.8 h1:/4vM7uFPJez3PhNhlqUcJhboYaDNWo+R8oAuMj2cKsA= -github.com/pion/ice/v2 v2.3.8/go.mod h1:DoMA9FvsfNTBVnjyRf2t4EhUkSp9tNrH77fMtPFYygQ= +github.com/pion/ice/v2 v2.3.9 h1:7yZpHf3PhPxJGT4JkMj1Y8Rl5cQ6fB709iz99aeMd/U= +github.com/pion/ice/v2 v2.3.9/go.mod h1:lT3kv5uUIlHfXHU/ZRD7uKD/ufM202+eTa3C/umgGf4= github.com/pion/interceptor v0.1.17 h1:prJtgwFh/gB8zMqGZoOgJPHivOwVAp61i2aG61Du/1w= github.com/pion/interceptor v0.1.17/go.mod h1:SY8kpmfVBvrbUzvj2bsXz7OJt5JvmVNZ+4Kjq7FcwrI= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= @@ -196,8 +196,9 @@ github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= -github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= +github.com/pion/rtp v1.8.0 h1:SYD7040IR+NqrGBOc2GDU5iDjAR+0m5rnX/EWCUMNhw= +github.com/pion/rtp v1.8.0/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= github.com/pion/sctp v1.8.7 h1:JnABvFakZueGAn4KU/4PSKg+GWbF6QWbKTWZOSGJjXw= github.com/pion/sctp v1.8.7/go.mod h1:g1Ul+ARqZq5JEmoFy87Q/4CePtKnTJ1QCL9dBBdN6AU= @@ -205,8 +206,6 @@ github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= github.com/pion/srtp/v2 v2.0.15 h1:+tqRtXGsGwHC0G0IUIAzRmdkHvriF79IHVfZGfHrQoA= github.com/pion/srtp/v2 v2.0.15/go.mod h1:b/pQOlDrbB0HEH5EUAQXzSYxikFbNcNuKmF8tM0hCtw= -github.com/pion/stun v0.4.0/go.mod h1:QPsh1/SbXASntw3zkkrIk3ZJVKz4saBY2G7S10P3wCw= -github.com/pion/stun v0.6.0/go.mod h1:HPqcfoeqQn9cuaet7AOmB5e5xkObu9DwBdurwLKO9oA= github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= @@ -216,11 +215,10 @@ github.com/pion/transport/v2 v2.1.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlD github.com/pion/transport/v2 v2.2.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlDuQdctTThQ= github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= -github.com/pion/turn/v2 v2.1.0/go.mod h1:yrT5XbXSGX1VFSF31A3c1kCNB5bBZgk/uu5LET162qs= github.com/pion/turn/v2 v2.1.2 h1:wj0cAoGKltaZ790XEGW9HwoUewqjliwmhtxCuB2ApyM= github.com/pion/turn/v2 v2.1.2/go.mod h1:1kjnPkBcex3dhCU2Am+AAmxDcGhLX3WnMfmkNpvSTQU= -github.com/pion/webrtc/v3 v3.2.11 h1:lfGKYZcG7ghCTQWn+zsD+icIIWL3qIfclEjBGk537+s= -github.com/pion/webrtc/v3 v3.2.11/go.mod h1:fejQio1v8tKG4ntq4u8H4uDHsCNX6eX7bT093t4H+0E= +github.com/pion/webrtc/v3 v3.2.13 h1://ltbnahZewBWHvQYunlyLVWrHrsoyxYDfi3Ux6V4Gk= +github.com/pion/webrtc/v3 v3.2.13/go.mod h1:KS57v8u+fNMYAVM6gNsceIHtciyHlnfPNXU/7klJMFU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -289,7 +287,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 h1:/yRP+0AN7mf5DkD3BAI6TOFnd51gEoDEb8o35jIFtgw= @@ -385,6 +382,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -411,8 +409,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/pkg/rtc/transport.go b/pkg/rtc/transport.go index c3f314eec..0eaabd1ed 100644 --- a/pkg/rtc/transport.go +++ b/pkg/rtc/transport.go @@ -38,6 +38,7 @@ import ( "github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger/pionlogger" lksdp "github.com/livekit/protocol/sdp" + "github.com/livekit/protocol/utils" "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/rtc/types" @@ -65,6 +66,8 @@ const ( minConnectTimeoutAfterICE = 10 * time.Second maxConnectTimeoutAfterICE = 20 * time.Second // max duration for waiting pc to connect after ICE is connected + maxICECandidates = 20 + shortConnectionThreshold = 90 * time.Second ) @@ -227,10 +230,10 @@ type PCTransport struct { pendingRestartIceOffer *webrtc.SessionDescription // for cleaner logging - allowedLocalCandidates []string - allowedRemoteCandidates []string - filteredLocalCandidates []string - filteredRemoteCandidates []string + allowedLocalCandidates *utils.DedupedSlice[string] + allowedRemoteCandidates *utils.DedupedSlice[string] + filteredLocalCandidates *utils.DedupedSlice[string] + filteredRemoteCandidates *utils.DedupedSlice[string] } type TransportParams struct { @@ -371,6 +374,10 @@ func NewPCTransport(params TransportParams) (*PCTransport, error) { eventCh: make(chan event, 50), previousTrackDescription: make(map[string]*trackDescription), canReuseTransceiver: true, + allowedLocalCandidates: utils.NewDedupedSlice[string](maxICECandidates), + allowedRemoteCandidates: utils.NewDedupedSlice[string](maxICECandidates), + filteredLocalCandidates: utils.NewDedupedSlice[string](maxICECandidates), + filteredRemoteCandidates: utils.NewDedupedSlice[string](maxICECandidates), } if params.IsSendSide { t.streamAllocator = streamallocator.NewStreamAllocator(streamallocator.StreamAllocatorParams{ @@ -1167,7 +1174,7 @@ func (t *PCTransport) GetICEConnectionType() types.ICEConnectionType { // Pion would have created a prflx candidate with the same address as the relay candidate. // to report an accurate connection type, we'll compare to see if existing relay candidates match t.lock.RLock() - allowedRemoteCandidates := t.allowedRemoteCandidates + allowedRemoteCandidates := t.allowedRemoteCandidates.Get() t.lock.RUnlock() for _, ci := range allowedRemoteCandidates { @@ -1487,12 +1494,12 @@ func (t *PCTransport) clearLocalDescriptionSent() { t.cacheLocalCandidates = true t.cachedLocalCandidates = nil - t.allowedLocalCandidates = nil + t.allowedLocalCandidates.Clear() t.lock.Lock() - t.allowedRemoteCandidates = nil + t.allowedRemoteCandidates.Clear() t.lock.Unlock() - t.filteredLocalCandidates = nil - t.filteredRemoteCandidates = nil + t.filteredLocalCandidates.Clear() + t.filteredRemoteCandidates.Clear() } func (t *PCTransport) handleLocalICECandidate(e *event) error { @@ -1502,7 +1509,7 @@ func (t *PCTransport) handleLocalICECandidate(e *event) error { if t.preferTCP.Load() && c != nil && c.Protocol != webrtc.ICEProtocolTCP { cstr := c.String() t.params.Logger.Debugw("filtering out local candidate", "candidate", cstr) - t.filteredLocalCandidates = append(t.filteredLocalCandidates, cstr) + t.filteredLocalCandidates.Add(cstr) filtered = true } @@ -1511,7 +1518,7 @@ func (t *PCTransport) handleLocalICECandidate(e *event) error { } if c != nil { - t.allowedLocalCandidates = append(t.allowedLocalCandidates, c.String()) + t.allowedLocalCandidates.Add(c.String()) } if t.cacheLocalCandidates { t.cachedLocalCandidates = append(t.cachedLocalCandidates, c) @@ -1531,7 +1538,7 @@ func (t *PCTransport) handleRemoteICECandidate(e *event) error { filtered := false if t.preferTCP.Load() && !strings.Contains(c.Candidate, "tcp") { t.params.Logger.Debugw("filtering out remote candidate", "candidate", c.Candidate) - t.filteredRemoteCandidates = append(t.filteredRemoteCandidates, c.Candidate) + t.filteredRemoteCandidates.Add(c.Candidate) filtered = true } @@ -1540,7 +1547,7 @@ func (t *PCTransport) handleRemoteICECandidate(e *event) error { } t.lock.Lock() - t.allowedRemoteCandidates = append(t.allowedRemoteCandidates, c.Candidate) + t.allowedRemoteCandidates.Add(c.Candidate) t.lock.Unlock() if t.pc.RemoteDescription() == nil { @@ -1558,10 +1565,10 @@ func (t *PCTransport) handleRemoteICECandidate(e *event) error { func (t *PCTransport) handleLogICECandidates(e *event) error { t.params.Logger.Infow( "ice candidates", - "lc", t.allowedLocalCandidates, - "rc", t.allowedRemoteCandidates, - "lc (filtered)", t.filteredLocalCandidates, - "rc (filtered)", t.filteredRemoteCandidates, + "lc", t.allowedLocalCandidates.Get(), + "rc", t.allowedRemoteCandidates.Get(), + "lc (filtered)", t.filteredLocalCandidates.Get(), + "rc (filtered)", t.filteredRemoteCandidates.Get(), ) return nil
LiveKit Ecosystem
Client SDKsComponents · JavaScript · Rust · iOS/macOS · Android · Flutter · Unity (web) · Python · React Native (beta)
Client SDKsComponents · JavaScript · iOS/macOS · Android · Flutter · React Native · Rust · Python · Unity (web) · Unity (beta)
Server SDKsNode.js · Golang · Ruby · Java/Kotlin · PHP (community) · Python (community)
ServicesLivekit server · Egress · Ingress
ResourcesDocs · Example apps · Cloud · Self-hosting · CLI