fix participant, ensure room name matches (#2660)
This commit is contained in:
@@ -16,6 +16,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/livekit/protocol/livekit"
|
"github.com/livekit/protocol/livekit"
|
||||||
@@ -62,7 +63,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
|
|||||||
// find existing room and update it
|
// find existing room and update it
|
||||||
var created bool
|
var created bool
|
||||||
rm, internal, err := r.roomStore.LoadRoom(ctx, livekit.RoomName(req.Name), true)
|
rm, internal, err := r.roomStore.LoadRoom(ctx, livekit.RoomName(req.Name), true)
|
||||||
if err == ErrRoomNotFound {
|
if errors.Is(err, ErrRoomNotFound) {
|
||||||
created = true
|
created = true
|
||||||
rm = &livekit.Room{
|
rm = &livekit.Room{
|
||||||
Sid: utils.NewGuid(utils.RoomPrefix),
|
Sid: utils.NewGuid(utils.RoomPrefix),
|
||||||
@@ -88,8 +89,13 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
|
|||||||
if req.Metadata != "" {
|
if req.Metadata != "" {
|
||||||
rm.Metadata = req.Metadata
|
rm.Metadata = req.Metadata
|
||||||
}
|
}
|
||||||
if req.Egress != nil && req.Egress.Tracks != nil {
|
if req.Egress != nil {
|
||||||
internal.TrackEgress = req.Egress.Tracks
|
if req.Egress.Participant != nil {
|
||||||
|
internal.ParticipantEgress = req.Egress.Participant
|
||||||
|
}
|
||||||
|
if req.Egress.Tracks != nil {
|
||||||
|
internal.TrackEgress = req.Egress.Tracks
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if req.MinPlayoutDelay > 0 || req.MaxPlayoutDelay > 0 {
|
if req.MinPlayoutDelay > 0 || req.MaxPlayoutDelay > 0 {
|
||||||
internal.PlayoutDelay = &livekit.PlayoutDelay{
|
internal.PlayoutDelay = &livekit.PlayoutDelay{
|
||||||
@@ -108,7 +114,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
|
|||||||
|
|
||||||
// check if room already assigned
|
// check if room already assigned
|
||||||
existing, err := r.router.GetNodeForRoom(ctx, livekit.RoomName(rm.Name))
|
existing, err := r.router.GetNodeForRoom(ctx, livekit.RoomName(rm.Name))
|
||||||
if err != routing.ErrNotFound && err != nil {
|
if !errors.Is(err, routing.ErrNotFound) && err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomReq
|
|||||||
})
|
})
|
||||||
|
|
||||||
if req.Egress != nil && req.Egress.Room != nil {
|
if req.Egress != nil && req.Egress.Room != nil {
|
||||||
|
// ensure room name matches
|
||||||
|
req.Egress.Room.RoomName = req.Name
|
||||||
_, err = s.egressLauncher.StartEgress(ctx, &rpc.StartEgressRequest{
|
_, err = s.egressLauncher.StartEgress(ctx, &rpc.StartEgressRequest{
|
||||||
Request: &rpc.StartEgressRequest_RoomComposite{
|
Request: &rpc.StartEgressRequest_RoomComposite{
|
||||||
RoomComposite: req.Egress.Room,
|
RoomComposite: req.Egress.Room,
|
||||||
|
|||||||
Reference in New Issue
Block a user