mediasoup-client
Advanced tools
Comparing version 3.6.77 to 3.6.78
@@ -374,2 +374,9 @@ "use strict"; | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -387,2 +394,9 @@ async setRtpEncodingParameters(localId, params) { | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -389,0 +403,0 @@ async getSenderStats(localId) { |
@@ -394,2 +394,9 @@ "use strict"; | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -407,2 +414,9 @@ async setRtpEncodingParameters(localId, params) { | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -409,0 +423,0 @@ async getSenderStats(localId) { |
@@ -414,2 +414,9 @@ "use strict"; | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -427,2 +434,9 @@ async setRtpEncodingParameters(localId, params) { | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -429,0 +443,0 @@ async getSenderStats(localId) { |
@@ -391,2 +391,9 @@ "use strict"; | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -404,2 +411,9 @@ async setRtpEncodingParameters(localId, params) { | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -406,0 +420,0 @@ async getSenderStats(localId) { |
@@ -368,2 +368,9 @@ "use strict"; | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setMaxSpatialLayer() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setMaxSpatialLayer() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -381,2 +388,9 @@ async setRtpEncodingParameters(localId, params) { | ||
await transceiver.sender.setParameters(parameters); | ||
this._remoteSdp.muxMediaSectionSimulcast(localId, parameters.encodings); | ||
const offer = await this._pc.createOffer(); | ||
logger.debug('setRtpEncodingParameters() | calling pc.setLocalDescription() [offer:%o]', offer); | ||
await this._pc.setLocalDescription(offer); | ||
const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() }; | ||
logger.debug('setRtpEncodingParameters() | calling pc.setRemoteDescription() [answer:%o]', answer); | ||
await this._pc.setRemoteDescription(answer); | ||
} | ||
@@ -383,0 +397,0 @@ async getSenderStats(localId) { |
@@ -40,2 +40,3 @@ import { IceParameters, IceCandidate, DtlsParameters, DtlsRole, PlainRtpParameters } from '../../Transport'; | ||
resume(): void; | ||
muxSimulcastStreams(encodings: RTCRtpEncodingParameters[]): void; | ||
} | ||
@@ -42,0 +43,0 @@ export declare class OfferMediaSection extends MediaSection { |
@@ -27,2 +27,3 @@ "use strict"; | ||
exports.OfferMediaSection = exports.AnswerMediaSection = exports.MediaSection = void 0; | ||
const sdpTransform = __importStar(require("sdp-transform")); | ||
const utils = __importStar(require("../../utils")); | ||
@@ -291,2 +292,25 @@ class MediaSection { | ||
} | ||
muxSimulcastStreams(encodings) { | ||
var _a; | ||
if (!this._mediaObject.simulcast || !this._mediaObject.simulcast.list1) { | ||
return; | ||
} | ||
const layers = {}; | ||
for (const encoding of encodings) { | ||
if (encoding.rid) { | ||
layers[encoding.rid] = encoding; | ||
} | ||
} | ||
const raw = this._mediaObject.simulcast.list1; | ||
// NOTE: Ignore bug in @types/sdp-transform. | ||
// Ongoing PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64119 | ||
// @ts-ignore | ||
const simulcastStreams = sdpTransform.parseSimulcastStreamList(raw); | ||
for (const simulcastStream of simulcastStreams) { | ||
for (const simulcastFormat of simulcastStream) { | ||
simulcastFormat.paused = !((_a = layers[simulcastFormat.scid]) === null || _a === void 0 ? void 0 : _a.active); | ||
} | ||
} | ||
this._mediaObject.simulcast.list1 = simulcastStreams.map((simulcastFormats) => simulcastFormats.map((f) => `${f.paused ? '~' : ''}${f.scid}`).join(',')).join(';'); | ||
} | ||
} | ||
@@ -293,0 +317,0 @@ exports.AnswerMediaSection = AnswerMediaSection; |
@@ -58,2 +58,3 @@ import { MediaSection } from './MediaSection'; | ||
closeMediaSection(mid: string): boolean; | ||
muxMediaSectionSimulcast(mid: string, encodings: RTCRtpEncodingParameters[]): void; | ||
planBStopReceiving({ mid, offerRtpParameters }: { | ||
@@ -60,0 +61,0 @@ mid: string; |
@@ -203,8 +203,9 @@ "use strict"; | ||
} | ||
muxMediaSectionSimulcast(mid, encodings) { | ||
const mediaSection = this._findMediaSection(mid); | ||
mediaSection.muxSimulcastStreams(encodings); | ||
this._replaceMediaSection(mediaSection); | ||
} | ||
planBStopReceiving({ mid, offerRtpParameters }) { | ||
const idx = this._midToIndex.get(mid); | ||
if (idx === undefined) { | ||
throw new Error(`no media section found with mid '${mid}'`); | ||
} | ||
const mediaSection = this._mediaSections[idx]; | ||
const mediaSection = this._findMediaSection(mid); | ||
mediaSection.planBStopReceiving({ offerRtpParameters }); | ||
@@ -211,0 +212,0 @@ this._replaceMediaSection(mediaSection); |
@@ -21,4 +21,4 @@ "use strict"; | ||
if (ssrcs.has(ssrc)) { | ||
// Remove both the SSRC and RTX SSRC from the set so later we know that they | ||
// are already handled. | ||
// Remove both the SSRC and RTX SSRC from the set so later we know | ||
// that they are already handled. | ||
ssrcs.delete(ssrc); | ||
@@ -30,4 +30,4 @@ ssrcs.delete(rtxSsrc); | ||
} | ||
// If the set of SSRCs is not empty it means that RTX is not being used, so take | ||
// media SSRCs from there. | ||
// If the set of SSRCs is not empty it means that RTX is not being used, so | ||
// take media SSRCs from there. | ||
for (const ssrc of ssrcs) { | ||
@@ -34,0 +34,0 @@ // Add to the map. |
@@ -11,3 +11,3 @@ import debug from 'debug'; | ||
*/ | ||
export declare const version = "3.6.77"; | ||
export declare const version = "3.6.78"; | ||
/** | ||
@@ -14,0 +14,0 @@ * Expose Device class and detectDevice() helper. |
@@ -40,3 +40,3 @@ "use strict"; | ||
*/ | ||
exports.version = '3.6.77'; | ||
exports.version = '3.6.78'; | ||
/** | ||
@@ -43,0 +43,0 @@ * Expose parseScalabilityMode() function. |
{ | ||
"name": "mediasoup-client", | ||
"version": "3.6.77", | ||
"version": "3.6.78", | ||
"description": "mediasoup client side JavaScript library", | ||
@@ -78,8 +78,8 @@ "contributors": [ | ||
"@types/sdp-transform": "^2.4.5", | ||
"@typescript-eslint/eslint-plugin": "^5.50.0", | ||
"@typescript-eslint/parser": "^5.50.0", | ||
"eslint": "^8.33.0", | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/parser": "^5.52.0", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"fake-mediastreamtrack": "^1.1.6", | ||
"jest": "^29.4.1", | ||
"jest": "^29.4.2", | ||
"open-cli": "^7.1.0", | ||
@@ -86,0 +86,0 @@ "ts-jest": "^29.0.5", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
697785
118
15162