Skip to content

Commit

Permalink
Fix screen sharing on Firefox 113 (#3282)
Browse files Browse the repository at this point in the history
`getCapabilities` exists now(?), but `setCodecPreferences` doesn't,
which means it would throw an error and fail the call.

Signed-off-by: Tulir Asokan <tulir@maunium.net>
  • Loading branch information
tulir authored Apr 15, 2023
1 parent de3d5ea commit 87398ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
* [96685:23:0518/162603.933430:ERROR:sdp_offer_answer.cc(4302)] Failed to set local video description recv parameters for m-section with mid='2'. (INVALID_PARAMETER)
*/
private getRidOfRTXCodecs(): void {
// RTCRtpReceiver.getCapabilities and RTCRtpSender.getCapabilities don't seem to be supported on FF
// RTCRtpReceiver.getCapabilities and RTCRtpSender.getCapabilities don't seem to be supported on FF before v113
if (!RTCRtpReceiver.getCapabilities || !RTCRtpSender.getCapabilities) return;

const recvCodecs = RTCRtpReceiver.getCapabilities("video")!.codecs;
Expand All @@ -2332,7 +2332,8 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
const screenshareVideoTransceiver = this.transceivers.get(
getTransceiverKey(SDPStreamMetadataPurpose.Screenshare, "video"),
);
if (screenshareVideoTransceiver) screenshareVideoTransceiver.setCodecPreferences(codecs);
// setCodecPreferences isn't supported on FF (as of v113)
screenshareVideoTransceiver?.setCodecPreferences?.(codecs);
}

private onNegotiationNeeded = async (): Promise<void> => {
Expand Down

0 comments on commit 87398ac

Please sign in to comment.