Skip to content

Commit 5aeba0b

Browse files
authored
remove published tracks when the room is closed (#677)
1 parent 3268aba commit 5aeba0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

livekit/src/room/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,11 @@ impl RoomSession {
906906
async fn close(&self, reason: DisconnectReason) -> RoomResult<()> {
907907
let Some(handle) = self.handle.lock().await.take() else { Err(RoomError::AlreadyClosed)? };
908908

909+
// remove published tracks
910+
for (sid, _) in self.local_participant.track_publications().iter() {
911+
let _ = self.local_participant.unpublish_track(sid).await;
912+
}
913+
909914
self.rtc_engine.close(reason).await;
910915
self.e2ee_manager.cleanup();
911916

0 commit comments

Comments
 (0)