File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,21 @@ impl VideoAllocator {
4949 }
5050
5151 pub fn remove_track ( & mut self , track_id : & Arc < TrackId > ) {
52- if self . tracks . remove ( track_id) . is_some ( ) {
52+ if let Some ( track ) = self . tracks . remove ( track_id) {
5353 tracing:: info!(
5454 track = %track_id,
5555 "video track removed"
5656 ) ;
57+
58+ let Some ( assigned_mid) = track. assigned_mid else {
59+ return ;
60+ } ;
61+
62+ let Some ( slot) = self . slots . iter_mut ( ) . find ( |s| s. mid == assigned_mid) else {
63+ return ;
64+ } ;
65+
66+ slot. stop ( ) ;
5767 self . rebalance ( ) ;
5868 }
5969 }
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ impl actor::Actor<RoomMessageSet> for RoomActor {
122122 if let Some ( participant_handle) = self . state . participants . get_mut ( & participant_id) {
123123 // if it's closed, then the participant has exited
124124 let _ = participant_handle. handle . terminate ( ) . await ;
125+ self . handle_participant_left ( participant_id) . await ;
125126 }
126127 }
127128 RoomMessage :: PublishTrack ( track_handle) => {
You can’t perform that action at this time.
0 commit comments