Skip to content
Merged
Show file tree
Hide file tree
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
843 changes: 431 additions & 412 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@
"@eslint/js": "^10.0.1",
"@types/jest": "^30.0.0",
"@types/sdp-transform": "^3.0.0",
"eslint": "^10.12.0",
"eslint": "^10.13.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "^29.16.6",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-jest": "^29.17.0",
"eslint-plugin-prettier": "^5.5.7",
"globals": "^17.13.0",
"jest": "^30.5.2",
"knip": "^6.40.0",
"knip": "^6.42.0",
"open-cli": "^9.0.0",
"prettier": "^3.9.9",
"ts-jest": "^29.4.14",
"prettier": "^3.9.10",
"ts-jest": "^29.4.15",
"typescript": "^6.0.3",
"typescript-eslint": "^8.71.1"
"typescript-eslint": "^8.71.2"
}
}
7 changes: 0 additions & 7 deletions src/RtpParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,6 @@ export type RtpEncodingParameters = {
* the RTX SSRC.
*/
rtx?: { ssrc: number };
/**
* It indicates whether discontinuous RTP transmission will be used. Useful
* for audio (if the codec supports it) and for video screen sharing (when
* static content is being transmitted, this option disables the RTP
* inactivity checks in mediasoup). Default false.
*/
dtx?: boolean;
/**
* Number of spatial and temporal layers in the RTP stream (e.g. 'L1T3').
* See webrtc-svc.
Expand Down
3 changes: 0 additions & 3 deletions src/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,6 @@ export class Transport<
if (encoding.active === false) {
normalizedEncoding.active = false;
}
if (typeof encoding.dtx === 'boolean') {
normalizedEncoding.dtx = encoding.dtx;
}
if (typeof encoding.scalabilityMode === 'string') {
normalizedEncoding.scalabilityMode = encoding.scalabilityMode;
}
Expand Down
17 changes: 10 additions & 7 deletions src/handlers/Chrome111.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,17 @@ export class Chrome111
});
}

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
const transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});
let transceiver: RTCRtpTransceiver | undefined;

try {
transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

if (this._forcedRtpExtensions) {
ortcUtils.applyForcedRtpExtensions(
transceiver,
Expand Down Expand Up @@ -540,7 +543,7 @@ export class Chrome111
} catch (error2) {}
}

transceiver.stop();
transceiver?.stop();
} catch (error3) {}

throw error;
Expand Down
17 changes: 10 additions & 7 deletions src/handlers/Chrome74.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,17 @@ export class Chrome74
});
}

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
const transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});
let transceiver: RTCRtpTransceiver | undefined;

try {
transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

if (this._forcedRtpExtensions) {
ortcUtils.applyForcedRtpExtensions(
transceiver,
Expand Down Expand Up @@ -570,7 +573,7 @@ export class Chrome74
} catch (error2) {}
}

transceiver.stop();
transceiver?.stop();
} catch (error3) {}

throw error;
Expand Down
25 changes: 13 additions & 12 deletions src/handlers/Firefox120.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,19 +383,20 @@ export class Firefox120
});
}

// NOTE: Firefox fails sometimes to properly anticipate the closed media
// section that it should use, so don't reuse closed media sections.
// https://github.com/versatica/mediasoup-client/issues/104
//
// const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

const transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});
let transceiver: RTCRtpTransceiver | undefined;

try {
transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});

// NOTE: Firefox fails sometimes to properly anticipate the closed media
// section that it should use, so don't reuse closed media sections.
// https://github.com/versatica/mediasoup-client/issues/104
// const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

if (this._forcedRtpExtensions) {
ortcUtils.applyForcedRtpExtensions(
transceiver,
Expand Down Expand Up @@ -559,7 +560,7 @@ export class Firefox120
} catch (error2) {}
}

transceiver.stop();
transceiver?.stop();
} catch (error3) {}

throw error;
Expand Down
17 changes: 10 additions & 7 deletions src/handlers/ReactNative106.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,17 @@ export class ReactNative106
});
}

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
const transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});
let transceiver: RTCRtpTransceiver | undefined;

try {
transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

if (this._forcedRtpExtensions) {
ortcUtils.applyForcedRtpExtensions(
transceiver,
Expand Down Expand Up @@ -597,7 +600,7 @@ export class ReactNative106
} catch (error2) {}
}

transceiver.stop();
transceiver?.stop();
} catch (error3) {}

throw error;
Expand Down
17 changes: 10 additions & 7 deletions src/handlers/Safari12.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,17 @@ export class Safari12
});
}

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
const transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});
let transceiver: RTCRtpTransceiver | undefined;

try {
transceiver = this._pc.addTransceiver(track, {
direction: 'sendonly',
streams: [this._sendStream],
sendEncodings: encodings,
});

const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();

if (this._forcedRtpExtensions) {
ortcUtils.applyForcedRtpExtensions(
transceiver,
Expand Down Expand Up @@ -546,7 +549,7 @@ export class Safari12
} catch (error2) {}
}

transceiver.stop();
transceiver?.stop();
} catch (error3) {}

throw error;
Expand Down
5 changes: 0 additions & 5 deletions src/ortc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,11 +955,6 @@ function validateAndNormalizeRtpEncodingParameters(
}
}

// dtx is optional. If unset set it to false.
if (!encoding.dtx || typeof encoding.dtx !== 'boolean') {
encoding.dtx = false;
}

// scalabilityMode is optional.
if (
encoding.scalabilityMode &&
Expand Down
6 changes: 3 additions & 3 deletions src/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ test('transport.produce() succeeds', async () => {
expect(Array.isArray(encodings)).toBe(true);
expect(encodings!.length).toBe(1);
expect(typeof encodings![0]).toBe('object');
expect(Object.keys(encodings![0]!)).toEqual(['ssrc', 'dtx']);
expect(Object.keys(encodings![0]!)).toEqual(['ssrc']);
expect(typeof encodings![0]!.ssrc).toBe('number');

rtcp = audioProducer.rtpParameters.rtcp;
Expand Down Expand Up @@ -719,7 +719,7 @@ test('transport.consume() succeeds', async () => {
expect(Array.isArray(encodings)).toBe(true);
expect(encodings!.length).toBe(1);
expect(typeof encodings![0]).toBe('object');
expect(Object.keys(encodings![0]!)).toEqual(['ssrc', 'dtx']);
expect(Object.keys(encodings![0]!)).toEqual(['ssrc']);
expect(typeof encodings![0]!.ssrc).toBe('number');

rtcp = audioConsumer.rtpParameters.rtcp;
Expand Down Expand Up @@ -812,7 +812,7 @@ test('transport.consume() succeeds', async () => {
expect(Array.isArray(encodings)).toBe(true);
expect(encodings!.length).toBe(1);
expect(typeof encodings![0]).toBe('object');
expect(Object.keys(encodings![0]!)).toEqual(['ssrc', 'rtx', 'dtx']);
expect(Object.keys(encodings![0]!)).toEqual(['ssrc', 'rtx']);
expect(typeof encodings![0]!.ssrc).toBe('number');
expect(typeof encodings![0]!.rtx).toBe('object');
expect(Object.keys(encodings![0]!.rtx!)).toEqual(['ssrc']);
Expand Down
Loading