Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/handlers/ortc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ import type {

const logger = new Logger('ortc/utils');

/**
* RTP header extensions that are mandatory to negotiate (since BUNDLE is always
* offered) and hence cannot be disabled via the RTP header extension control
* API.
*
* @see https://www.rfc-editor.org/rfc/rfc8834#name-header-extensions
*/
const MandatoryRtpExtensionUris: Set<RtpHeaderExtensionUri> = new Set([
'urn:ietf:params:rtp-hdrext:sdes:mid',
]);

/**
* This function adds RTCP NACK support for OPUS codec in given capabilities.
*/
Expand Down Expand Up @@ -75,7 +86,12 @@ export function applyForcedRtpExtensions(
const uri = extenCap.uri as RtpHeaderExtensionUri;
const enabled: boolean | undefined = forcedRtpExtensions[uri];

if (enabled === true) {
// NOTE: This is a workaround to avoid a potential bug in libwebrtc:
// - https://github.com/versatica/mediasoup-client/issues/394
// - https://issues.webrtc.org/issues/576082210
if (MandatoryRtpExtensionUris.has(uri)) {
extenCap.direction = 'sendrecv';
} else if (enabled === true) {
extenCap.direction = 'sendrecv';
} else if (enabled === false) {
extenCap.direction = 'stopped';
Expand Down
Loading