service: start room composite egress configured in a room preset (#4926)

* service: start room composite egress configured in a room preset

StandardRoomAllocator.CreateRoom merged a room preset into a copy of the
request and discarded it. RoomInternal has no field for room composite
egress, and getOrCreateRoom started it from the caller's original request,
so a room composite egress from a preset was never started.

RoomAllocator.CreateRoom now also returns the request with the preset
applied, and getOrCreateRoom starts the egress from it.

* service: return ErrEgressNotConnected instead of calling a nil egress launcher

getOrCreateRoom started a room composite egress without checking that an
egress launcher exists. RoomService.CreateRoom rejects egress on the request
when there is none, but not egress from a room preset or a token's roomConfig.
This commit is contained in:
Martin Njalale
2026-09-30 13:25:24 +02:00
committed by GitHub
parent aa08becc6a
commit 2fab31691b
6 changed files with 255 additions and 28 deletions
+8 -1
View File
@@ -656,7 +656,9 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, createRoom *livekit.C
}
// create new room, get details first
ri, internal, created, err := r.roomAllocator.CreateRoom(ctx, createRoom, true)
// createRoom is reassigned to the request with the room preset applied, so that a room
// composite egress from the preset, which RoomInternal has no field for, is started
ri, internal, createRoom, created, err := r.roomAllocator.CreateRoom(ctx, createRoom, true)
if err != nil {
return nil, err
}
@@ -733,6 +735,11 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, createRoom *livekit.C
prometheus.RoomStarted()
if created && createRoom.GetEgress().GetRoom() != nil {
if r.egressLauncher == nil {
newRoom.Release()
return nil, ErrEgressNotConnected
}
// ensure room name matches
createRoom.Egress.Room.RoomName = createRoom.Name
_, err = r.egressLauncher.StartEgress(ctx, &rpc.StartEgressRequest{