Skip to content

Commit

Permalink
refactor(core): propagate opts and mediaTypes to processAnswer
Browse files Browse the repository at this point in the history
  • Loading branch information
prlanzarin committed Sep 10, 2021
1 parent 8a5bbcd commit aa99b7a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lib/mcs-core/lib/model/sdp-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ module.exports = class SDPSession extends MediaSession {
});
}

// FIXME Man... this SUCKS
renegotiateStreams () {
return new Promise(async (resolve, reject) => {
try {
Expand All @@ -324,7 +325,13 @@ module.exports = class SDPSession extends MediaSession {
mediaId: videoMedia.id,
descriptor: this.remoteDescriptor.mainVideoSdp,
});
await videoAdapter.processAnswer(videoMedia.adapterElementId, this.remoteDescriptor.mainVideoSdp);

await videoAdapter.processAnswer(
videoMedia.adapterElementId,
this.remoteDescriptor.mainVideoSdp,
{ mediaTypes: videoMedia.mediaTypes, ...this._options }
);

videoMedia.remoteDescriptor = this.remoteDescriptor.mainVideoSdp;
} catch (e) {
this._handleError(e);
Expand All @@ -341,7 +348,12 @@ module.exports = class SDPSession extends MediaSession {
});
const adescBody = SdpWrapper.removeSessionDescription(this.remoteDescriptor.audioSdp);
const mainWithInvalidVideo = this.remoteDescriptor.sessionDescriptionHeader + adescBody;
await audioAdapter.processAnswer(audioMedia.adapterElementId, mainWithInvalidVideo);
await audioAdapter.processAnswer(
audioMedia.adapterElementId,
mainWithInvalidVideo,
{ mediaTypes: audioMedia.mediaTypes, ...this._options }
);

audioMedia.remoteDescriptor = this.remoteDescriptor.audioSdp;
}
catch (e) {
Expand Down Expand Up @@ -369,7 +381,13 @@ module.exports = class SDPSession extends MediaSession {
mediaId: contentMedia.id,
descriptor: this.remoteDescriptor.contentVideoSdp,
});
await contentAdapter.processAnswer(contentMedia.adapterElementId, this.remoteDescriptor.contentVideoSdp);

await contentAdapter.processAnswer(
contentMedia.adapterElementId,
this.remoteDescriptor.contentVideoSdp,
{ mediaTypes: contentMedia.mediaTypes, ...this._options }
);

contentMedia.remoteDescriptor = this.remoteDescriptor.contentVideoSdp;
} else if (!this.localDescriptor || !this.localDescriptor.contentVideoSdp) {
// This is a renegotiation for a new content media for us as ANSWERERS
Expand Down

0 comments on commit aa99b7a

Please sign in to comment.