Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-cases-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Ignore engine closed events for data track packets which are in flight / un delivered on engine close
12 changes: 11 additions & 1 deletion src/room/RTCEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,17 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
// buffer status to not be low before continuing.
switch (bufferStatusLowBehavior) {
case 'wait':
await this.waitForBufferStatusLow(kind);
try {
await this.waitForBufferStatusLow(kind);
} catch (err) {
// Swallow engine closed errors - if there are lossy packets waiting for the buffer
// status to go low and the engine closes, these packets should just be silently
// dropped.
if (err instanceof UnexpectedConnectionState && err.message === 'engine closed') {
return;
}
throw err;
}
break;
case 'drop':
// this.log.warn(`dropping lossy data channel message`, this.logContext);
Expand Down
Loading