Skip to content

Commit 479a0a2

Browse files
authored
Read capapbilites from RtcRTPReceiver instead of from sender (#1088)
* Read capapbilites from RtcRTPReceiver instead of from sender * Create lovely-cups-tell.md * Add comments
1 parent df5c375 commit 479a0a2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/lovely-cups-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-client": patch
3+
---
4+
5+
Read capapbilites from RtcRTPReceiver instead of from sender

src/room/RTCEngine.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,13 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
669669
kind: Track.Kind,
670670
videoCodec: VideoCodec,
671671
) {
672-
if (!('getCapabilities' in RTCRtpSender)) {
672+
if (!('getCapabilities' in RTCRtpReceiver)) {
673673
return;
674674
}
675-
const cap = RTCRtpSender.getCapabilities(kind);
675+
// when setting codec preferences, the capabilites need to be read from the RTCRtpReceiver
676+
const cap = RTCRtpReceiver.getCapabilities(kind);
676677
if (!cap) return;
677-
this.log.debug('get sender capabilities', { ...this.logContext, cap });
678+
this.log.debug('get receiver capabilities', { ...this.logContext, cap });
678679
const matched: RTCRtpCodecCapability[] = [];
679680
const partialMatched: RTCRtpCodecCapability[] = [];
680681
const unmatched: RTCRtpCodecCapability[] = [];

0 commit comments

Comments
 (0)