Skip to content

Commit

Permalink
Fix Simulcast with new SDP parser (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Dec 11, 2017
1 parent ac9b138 commit dd6cc6c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
17 changes: 12 additions & 5 deletions erizo/src/erizo/SdpInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,19 @@ namespace erizo {
}
if (parts[1] == kSimulcastGroup) {
ELOG_DEBUG("Detected SIM group, size: %lu", parts.size());
std::vector<uint32_t> old_video_ssrc_list;
if (video_ssrc_list.size() > 0) {
old_video_ssrc_list = video_ssrc_list;
video_ssrc_list.clear();
}
std::for_each(parts.begin() + 2, parts.end(), [this] (std::string &part){
uint32_t parsed_ssrc = strtoul(part.c_str(), nullptr, 10);
ELOG_DEBUG("maybeAddSsrc video SIM, ssrc %u", parsed_ssrc);
maybeAddSsrcToList(parsed_ssrc);
});

uint32_t parsed_ssrc = strtoul(part.c_str(), nullptr, 10);
ELOG_DEBUG("maybeAddSsrc video SIM, ssrc %u", parsed_ssrc);
maybeAddSsrcToList(parsed_ssrc);
});
for (uint32_t ssrc : old_video_ssrc_list) {
maybeAddSsrcToList(ssrc);
}
} else if (parts[1] == kFidGroup) {
int number_of_ssrcs = parts.size() - 2;
if (number_of_ssrcs != 2) {
Expand Down
12 changes: 9 additions & 3 deletions erizo_controller/common/semanticSdp/MediaInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const Direction = require('./Direction');
const DirectionWay = require('./DirectionWay');

class MediaInfo {
constructor(id, type) {
constructor(id, port, type) {
this.id = id;
this.type = type;
this.port = port;
this.direction = Direction.SENDRECV;
this.extensions = new Map();
this.codecs = new Map();
Expand All @@ -19,7 +20,7 @@ class MediaInfo {
}

clone() {
const cloned = new MediaInfo(this.id, this.type);
const cloned = new MediaInfo(this.id, this.port, this.type);
cloned.setDirection(this.direction);
cloned.setBitrate(this.bitrate);
cloned.setConnection(this.connection);
Expand Down Expand Up @@ -53,6 +54,7 @@ class MediaInfo {
plain() {
const plain = {
id: this.id,
port: this.port,
type: this.type,
connection: this.connection,
direction: Direction.toString(this.direction),
Expand Down Expand Up @@ -89,6 +91,10 @@ class MediaInfo {
return this.type;
}

getPort() {
return this.port;
}

getId() {
return this.id;
}
Expand Down Expand Up @@ -202,7 +208,7 @@ class MediaInfo {
}

answer(supported) {
const answer = new MediaInfo(this.id, this.type);
const answer = new MediaInfo(this.id, this.port, this.type);

answer.setDirection(Direction.reverse(this.direction));

Expand Down
5 changes: 3 additions & 2 deletions erizo_controller/common/semanticSdp/SDPInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class SDPInfo {
this.medias.forEach((media) => {
const md = {
type: media.getType(),
port: 9,
port: media.getPort(),
protocol: 'UDP/TLS/RTP/SAVPF',
fmtp: [],
rtp: [],
Expand Down Expand Up @@ -751,7 +751,8 @@ SDPInfo.process = (sdp) => {
sdp.media.forEach((md) => {
const media = md.type;
const mid = md.mid;
const mediaInfo = new MediaInfo(mid, media);
const port = md.port;
const mediaInfo = new MediaInfo(mid, port, media);
mediaInfo.setXGoogleFlag(md.xGoogleFlag);
mediaInfo.rtcp = md.rtcp;
mediaInfo.setConnection(md.connection);
Expand Down

0 comments on commit dd6cc6c

Please sign in to comment.