reduce reliance of funk, fixed bug getting subscribed tracks
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/thoas/go-funk"
|
||||
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
)
|
||||
|
||||
@@ -58,7 +56,11 @@ func (p *LocalRoomStore) GetRoom(idOrName string) (*livekit.Room, error) {
|
||||
func (p *LocalRoomStore) ListRooms() ([]*livekit.Room, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
return funk.Values(p.rooms).([]*livekit.Room), nil
|
||||
rooms := make([]*livekit.Room, 0, len(p.rooms))
|
||||
for _, r := range p.rooms {
|
||||
rooms = append(rooms, r)
|
||||
}
|
||||
return rooms, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) DeleteRoom(idOrName string) error {
|
||||
@@ -115,8 +117,10 @@ func (p *LocalRoomStore) ListParticipants(roomName string) ([]*livekit.Participa
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
items := funk.Values(roomParticipants).([]*livekit.ParticipantInfo)
|
||||
// TODO: should short this to something reasonable
|
||||
items := make([]*livekit.ParticipantInfo, 0, len(roomParticipants))
|
||||
for _, p := range roomParticipants {
|
||||
items = append(items, p)
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/thoas/go-funk"
|
||||
"github.com/livekit/protocol/utils"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
"github.com/livekit/livekit-server/pkg/logger"
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/rtc"
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -162,7 +161,10 @@ func (r *RoomManager) CleanupRooms() error {
|
||||
|
||||
func (r *RoomManager) CloseIdleRooms() {
|
||||
r.lock.RLock()
|
||||
rooms := funk.Values(r.rooms).([]*rtc.Room)
|
||||
rooms := make([]*rtc.Room, 0, len(r.rooms))
|
||||
for _, rm := range r.rooms {
|
||||
rooms = append(rooms, rm)
|
||||
}
|
||||
r.lock.RUnlock()
|
||||
|
||||
for _, room := range rooms {
|
||||
@@ -347,7 +349,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.Partici
|
||||
if subTrack.ID() != sid {
|
||||
continue
|
||||
}
|
||||
subTrack.SetMuted(msg.TrackSetting.Mute)
|
||||
subTrack.SetMuted(msg.TrackSetting.Disabled)
|
||||
subTrack.SetVideoQuality(msg.TrackSetting.Quality)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user