Skip to content

Commit

Permalink
fix: prevent monitoring leak when stopOnUnpublish is false (#1348)
Browse files Browse the repository at this point in the history
* fix: prevent monitoring leak when stopOnUnpublish is false

* changeset
  • Loading branch information
davidzhao authored Dec 7, 2024
1 parent 8b63132 commit 1b0591b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-laws-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

fix: prevent monitoring leak when stopOnUnpublish is false
2 changes: 2 additions & 0 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
if (shouldStopTracks) {
pub.track?.detach();
pub.track?.stop();
} else {
pub.track?.stopMonitor();
}
});

Expand Down
2 changes: 2 additions & 0 deletions src/room/participant/LocalParticipant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,8 @@ export default class LocalParticipant extends Participant {
}
if (stopOnUnpublish) {
track.stop();
} else {
track.stopMonitor();
}

let negotiationNeeded = false;
Expand Down

0 comments on commit 1b0591b

Please sign in to comment.