Skip to content

Commit

Permalink
Ensure we use Setup actpass role when setting remote offers in Erizo …
Browse files Browse the repository at this point in the history
…Client (#1464)
  • Loading branch information
jcague authored Oct 1, 2019
1 parent 0694784 commit 1a4e0a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions erizo_controller/erizoClient/src/webrtc-stacks/BaseStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ const BaseStack = (specInput) => {
latestSessionVersion = sessionVersion;

SdpHelpers.setMaxBW(remoteSdp, specBase);

// Hack to ensure that the offer has the right setup.
remoteSdp.medias.forEach((media) => {
if (media.getSetup() !== Setup.ACTPASS) {
media.setSetup(Setup.ACTPASS);
}
});

msg.sdp = remoteSdp.toString();
that.remoteSdp = remoteSdp;
const rejectMessage = [];
Expand Down
13 changes: 12 additions & 1 deletion erizo_controller/erizoJS/models/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const addon = require('./../../../erizoAPI/build/Release/addon');
const logger = require('./../../common/logger').logger;
const SessionDescription = require('./SessionDescription');
const SemanticSdp = require('./../../common/semanticSdp/SemanticSdp');
const Setup = require('./../../common/semanticSdp/Setup');
const Helpers = require('./Helpers');

const log = logger.getLogger('Connection');
Expand Down Expand Up @@ -198,6 +199,7 @@ class Connection extends events.EventEmitter {
log.debug('message: _resendLastAnswer, this.wrtc or this.wrtc.localDescription are not present');
return Promise.reject('fail');
}
const isOffer = this.options.createOffer || forceOffer;
return this.wrtc.getLocalDescription().then((localDescription) => {
if (!localDescription) {
log.error('message: _resendLastAnswer, Cannot get local description');
Expand All @@ -211,10 +213,19 @@ class Connection extends events.EventEmitter {
return Promise.reject('retry');
}
this.sessionVersion += 1;

if (isOffer) {
sdp.medias.forEach((media) => {
if (media.getSetup() !== Setup.ACTPASS) {
media.setSetup(Setup.ACTPASS);
}
});
}

let message = sdp.toString();
message = message.replace(this.options.privateRegexp, this.options.publicIP);

const info = { type: this.options.createOffer || forceOffer ? 'offer' : 'answer', sdp: message };
const info = { type: isOffer ? 'offer' : 'answer', sdp: message };
log.debug(`message: _resendLastAnswer sending event, type: ${info.type}, streamId: ${streamId}`);
this._onStatusEvent(info, evt);
return Promise.resolve();
Expand Down

0 comments on commit 1a4e0a4

Please sign in to comment.