Skip to content

Commit e64cb2f

Browse files
authored
Add fallback to unmunged sdp offer (#386)
* add fallback to unmunged sdp offer * changeset
1 parent c11d99d commit e64cb2f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.changeset/spotty-guests-type.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'livekit-client': patch
3+
---
4+
5+
Add fallback to unmunged sdp offer

src/room/PCTransport.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,18 @@ export default class PCTransport {
134134
}
135135
});
136136

137-
offer.sdp = write(sdpParsed);
138137
this.trackBitrates = [];
139-
140-
await this.pc.setLocalDescription(offer);
138+
const originalSdp = offer.sdp;
139+
try {
140+
offer.sdp = write(sdpParsed);
141+
await this.pc.setLocalDescription(offer);
142+
} catch (e: unknown) {
143+
log.warn('not able to set desired local description, falling back to unmodified offer', {
144+
error: e,
145+
});
146+
offer.sdp = originalSdp;
147+
await this.pc.setLocalDescription(offer);
148+
}
141149
this.onOffer(offer);
142150
}
143151

0 commit comments

Comments
 (0)