Skip to content

Commit

Permalink
Read capapbilites from RtcRTPReceiver instead of from sender (#1088)
Browse files Browse the repository at this point in the history
* Read capapbilites from RtcRTPReceiver instead of from sender

* Create lovely-cups-tell.md

* Add comments
  • Loading branch information
lukasIO authored and davidzhao committed Mar 23, 2024
1 parent f75c9fb commit 0953a61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-cups-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Read capapbilites from RtcRTPReceiver instead of from sender
7 changes: 4 additions & 3 deletions src/room/RTCEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,13 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
kind: Track.Kind,
videoCodec: VideoCodec,
) {
if (!('getCapabilities' in RTCRtpSender)) {
if (!('getCapabilities' in RTCRtpReceiver)) {
return;
}
const cap = RTCRtpSender.getCapabilities(kind);
// when setting codec preferences, the capabilites need to be read from the RTCRtpReceiver
const cap = RTCRtpReceiver.getCapabilities(kind);
if (!cap) return;
this.log.debug('get sender capabilities', { ...this.logContext, cap });
this.log.debug('get receiver capabilities', { ...this.logContext, cap });
const matched: RTCRtpCodecCapability[] = [];
const partialMatched: RTCRtpCodecCapability[] = [];
const unmatched: RTCRtpCodecCapability[] = [];
Expand Down

0 comments on commit 0953a61

Please sign in to comment.