mirror of
https://github.com/livekit/livekit.git
synced 2026-05-25 16:24:57 +00:00
updates
This commit is contained in:
@@ -288,17 +288,6 @@ func (r *Room) Join(participant types.LocalParticipant, requestSource routing.Me
|
||||
return ErrMaxParticipantsExceeded
|
||||
}
|
||||
}
|
||||
if r.protoRoom.AppMode == livekit.AppMode_AM_LIVESTREAM && participant.IsPublisher() {
|
||||
numPublishers := 0
|
||||
for _, p := range r.participants {
|
||||
if p.CanPublish() {
|
||||
numPublishers++
|
||||
}
|
||||
}
|
||||
if numPublishers >= LiveStreamPublisherLimit {
|
||||
return ErrMaxPublishersExceeded
|
||||
}
|
||||
}
|
||||
|
||||
if r.FirstJoinedAt() == 0 {
|
||||
r.joinedAt.Store(time.Now().Unix())
|
||||
@@ -1024,37 +1013,6 @@ func (r *Room) sendParticipantUpdates(updates []*livekit.ParticipantInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
if r.protoRoom.AppMode == livekit.AppMode_AM_LIVESTREAM {
|
||||
otherUpdates := make([]*livekit.ParticipantInfo, 0, len(updates))
|
||||
publisherUpdates := make([]*livekit.ParticipantInfo, 0, len(updates))
|
||||
for _, u := range updates {
|
||||
if u.Permission.CanPublish {
|
||||
publisherUpdates = append(publisherUpdates, u)
|
||||
} else {
|
||||
otherUpdates = append(otherUpdates, u)
|
||||
}
|
||||
}
|
||||
|
||||
if len(otherUpdates) > 0 {
|
||||
// non-publishers are only sent to admins
|
||||
for _, op := range r.GetParticipants() {
|
||||
if op.IsAdmin() {
|
||||
err := op.SendParticipantUpdate(otherUpdates)
|
||||
if err != nil {
|
||||
r.Logger.Errorw("could not send update to participant", err,
|
||||
"participant", op.Identity(), "pID", op.ID())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(publisherUpdates) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
updates = publisherUpdates
|
||||
}
|
||||
|
||||
for _, op := range r.GetParticipants() {
|
||||
err := op.SendParticipantUpdate(updates)
|
||||
if err != nil {
|
||||
|
||||
+10
-22
@@ -198,6 +198,9 @@ func LoggerWithCodecMime(l logger.Logger, mime string) logger.Logger {
|
||||
}
|
||||
|
||||
func UpdateRoomFromRequest(rm *livekit.Room, internal *livekit.RoomInternal, req *livekit.CreateRoomRequest) *livekit.RoomInternal {
|
||||
if internal == nil {
|
||||
internal = &livekit.RoomInternal{}
|
||||
}
|
||||
if req.EmptyTimeout > 0 {
|
||||
rm.EmptyTimeout = req.EmptyTimeout
|
||||
}
|
||||
@@ -208,32 +211,17 @@ func UpdateRoomFromRequest(rm *livekit.Room, internal *livekit.RoomInternal, req
|
||||
rm.Metadata = req.Metadata
|
||||
}
|
||||
if req.Egress != nil && req.Egress.Tracks != nil {
|
||||
internal = &livekit.RoomInternal{TrackEgress: req.Egress.Tracks}
|
||||
internal.TrackEgress = req.Egress.Tracks
|
||||
}
|
||||
if req.AppMode != nil {
|
||||
rm.AppMode = *req.AppMode
|
||||
if rm.AppMode == livekit.AppMode_AM_LIVESTREAM {
|
||||
rm.PlayoutDelay = &livekit.PlayoutDelay{
|
||||
Enabled: true,
|
||||
// 150ms by default in livestream mode
|
||||
Min: 150,
|
||||
}
|
||||
}
|
||||
}
|
||||
if rm.AppMode == livekit.AppMode_AM_DEFAULT {
|
||||
if rm.MaxParticipants == 0 || rm.MaxParticipants > 3000 {
|
||||
rm.MaxParticipants = 3000
|
||||
}
|
||||
}
|
||||
if req.MinPlayoutDelay > 0 {
|
||||
rm.PlayoutDelay = &livekit.PlayoutDelay{
|
||||
if req.MinPlayoutDelay > 0 || req.MaxPlayoutDelay > 0 {
|
||||
internal.PlayoutDelay = &livekit.PlayoutDelay{
|
||||
Enabled: true,
|
||||
Min: req.MinPlayoutDelay,
|
||||
Max: req.MaxPlayoutDelay,
|
||||
}
|
||||
} else {
|
||||
rm.PlayoutDelay = &livekit.PlayoutDelay{
|
||||
Enabled: false,
|
||||
}
|
||||
}
|
||||
if req.SyncStreams {
|
||||
internal.SyncStreams = true
|
||||
}
|
||||
if len(req.EnabledCodecs) > 0 {
|
||||
rm.EnabledCodecs = req.EnabledCodecs
|
||||
|
||||
Reference in New Issue
Block a user