Skip to content

Commit 0953a61

Browse files
lukasIOdavidzhao
authored andcommitted
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 f75c9fb commit 0953a61

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
@@ -653,12 +653,13 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
653653
kind: Track.Kind,
654654
videoCodec: VideoCodec,
655655
) {
656-
if (!('getCapabilities' in RTCRtpSender)) {
656+
if (!('getCapabilities' in RTCRtpReceiver)) {
657657
return;
658658
}
659-
const cap = RTCRtpSender.getCapabilities(kind);
659+
// when setting codec preferences, the capabilites need to be read from the RTCRtpReceiver
660+
const cap = RTCRtpReceiver.getCapabilities(kind);
660661
if (!cap) return;
661-
this.log.debug('get sender capabilities', { ...this.logContext, cap });
662+
this.log.debug('get receiver capabilities', { ...this.logContext, cap });
662663
const matched: RTCRtpCodecCapability[] = [];
663664
const partialMatched: RTCRtpCodecCapability[] = [];
664665
const unmatched: RTCRtpCodecCapability[] = [];

0 commit comments

Comments
 (0)