Skip to content

Commit e94db91

Browse files
committed
fix(place/meet): improve routing when joining and unjoining
1 parent e4b77f3 commit e94db91

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

drivers/place/meet.cr

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ class Place::Meet < PlaceOS::Driver
250250
@local_preview_outputs.each { |device| sys[device].power true } # Power on preview displays
251251
apply_master_audio_default
252252
apply_camera_defaults
253-
apply_default_routes
253+
# the reason for this as when linking, the current routes are applied to the remote room
254+
apply_default_routes unless linked?
254255
apply_mic_defaults
255256

256257
if first_output = @tabs.first?.try &.inputs.first
@@ -1395,8 +1396,11 @@ class Place::Meet < PlaceOS::Driver
13951396
select_lighting_scene(@light_scenes.keys.first)
13961397
end
13971398

1398-
# send the current input to the remote rooms
1399-
if @auto_route_on_join && master
1399+
if !mode.linked?
1400+
# unroute on unlink
1401+
unroute_all
1402+
elsif @auto_route_on_join && master
1403+
# send the current input to the remote rooms
14001404
begin
14011405
if selected_inp = status?(String, :selected_input)
14021406
@outputs.each do |outp|
@@ -1495,19 +1499,25 @@ class Place::Meet < PlaceOS::Driver
14951499
if mode = @join_modes[selected]
14961500
this_room = config.control_system.not_nil!.id
14971501
if mode.room_ids.includes? this_room
1498-
mode.room_ids.compact_map do |room|
1502+
remotes = mode.room_ids.compact_map do |room|
14991503
next if room == this_room
15001504
RemoteSystem.new(room, system(room).get("System", 1))
15011505
end
1502-
else
1503-
[] of RemoteSystem
1506+
return remotes
15041507
end
1505-
else
1506-
[] of RemoteSystem
15071508
end
1508-
else
1509-
[] of RemoteSystem
15101509
end
1510+
[] of RemoteSystem
1511+
end
1512+
1513+
def linked? : Bool
1514+
if selected = @join_selected
1515+
if mode = @join_modes[selected]
1516+
this_room = config.control_system.not_nil!.id
1517+
return mode.room_ids.includes?(this_room)
1518+
end
1519+
end
1520+
false
15111521
end
15121522

15131523
# cache the proxies for performance reasons

0 commit comments

Comments
 (0)