Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate SDPInfo in ErizoJS #1105

Merged
merged 4 commits into from
Jan 2, 2018
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
6 changes: 5 additions & 1 deletion erizo/src/erizo/SdpInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ namespace erizo {
} else {
ELOG_DEBUG("invalid rid syntax: missing delimiter");
}
} else if ((mtype == AUDIO_TYPE)) {
} else if (mtype == AUDIO_TYPE) {
ELOG_DEBUG("audio shouldn't have simulcast rid! - ignoring this sdp line");
}
}
Expand Down Expand Up @@ -943,6 +943,10 @@ namespace erizo {
}
} // sdp lines loop

return postProcessInfo();
}

bool SdpInfo::postProcessInfo() {
// If there is no video or audio credentials we use the ones we have
if (iceVideoUsername_.empty() && iceAudioUsername_.empty()) {
ELOG_ERROR("No valid credentials for ICE")
Expand Down
16 changes: 9 additions & 7 deletions erizo/src/erizo/SdpInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ class SdpInfo {
void updateSupportedExtensionMap(const std::vector<ExtMap> &ext_map);
bool isValidExtension(std::string uri);

bool postProcessInfo();

/**
* @return A vector containing the simulcast RID informations
*/
Expand Down Expand Up @@ -314,13 +316,6 @@ class SdpInfo {
int audioSdpMLine;
int videoCodecs, audioCodecs;
unsigned int videoBandwidth;

private:
bool processSdp(const std::string& sdp, const std::string& media);
bool processCandidate(const std::vector<std::string>& pieces, MediaType mediaType, std::string sdp);
std::string stringifyCandidate(const CandidateInfo & candidate);
void gen_random(char* s, int len);
void maybeAddSsrcToList(uint32_t ssrc);
std::vector<CandidateInfo> candidateVector_;
std::vector<CryptoInfo> cryptoVector_;
std::vector<RtpMap> internalPayloadVector_;
Expand All @@ -329,6 +324,13 @@ class SdpInfo {
std::map<unsigned int, RtpMap> payload_parsed_map_;
std::vector<ExtMap> supported_ext_map_;
std::vector<Rid> rids_;

private:
bool processSdp(const std::string& sdp, const std::string& media);
bool processCandidate(const std::vector<std::string>& pieces, MediaType mediaType, std::string sdp);
std::string stringifyCandidate(const CandidateInfo & candidate);
void gen_random(char* s, int len);
void maybeAddSsrcToList(uint32_t ssrc);
};
} // namespace erizo
#endif // ERIZO_SRC_ERIZO_SDPINFO_H_
17 changes: 16 additions & 1 deletion erizo/src/erizo/WebRtcConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ void WebRtcConnection::removeMediaStream(const std::string& stream_id) {
media_stream_.reset();
}

bool WebRtcConnection::setRemoteSdpInfo(std::shared_ptr<SdpInfo> sdp) {
ELOG_DEBUG("%s message: setting remote SDPInfo", toLog());

if (!sending_) {
return true;
}

remote_sdp_ = sdp;
return processRemoteSdp();
}

bool WebRtcConnection::setRemoteSdp(const std::string &sdp) {
ELOG_DEBUG("%s message: setting remote SDP", toLog());

Expand All @@ -172,7 +183,11 @@ bool WebRtcConnection::setRemoteSdp(const std::string &sdp) {
}

remote_sdp_->initWithSdp(sdp, "");
return processRemoteSdp();
}

bool WebRtcConnection::processRemoteSdp() {
ELOG_DEBUG("%s message: processing remote SDP", toLog());
bundle_ = remote_sdp_->isBundle;
local_sdp_->setOfferSdp(remote_sdp_);
extension_processor_.setSdpInfo(local_sdp_);
Expand Down Expand Up @@ -238,10 +253,10 @@ bool WebRtcConnection::setRemoteSdp(const std::string &sdp) {
}
}
}

if (trickle_enabled_) {
std::string object = this->getLocalSdp();
if (conn_event_listener_) {
ELOG_DEBUG("%s message: Sending SDP", toLog());
conn_event_listener_->notifyEvent(CONN_SDP, object);
}
}
Expand Down
4 changes: 3 additions & 1 deletion erizo/src/erizo/WebRtcConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class WebRtcConnection: public TransportListener, public LogContext,
bool init();
void close();
void syncClose();

bool setRemoteSdpInfo(std::shared_ptr<SdpInfo> sdp);
/**
* Sets the SDP of the remote peer.
* @param sdp The SDP.
Expand Down Expand Up @@ -148,7 +150,7 @@ class WebRtcConnection: public TransportListener, public LogContext,
}

private:
// Utils
bool processRemoteSdp();
std::string getJSONCandidate(const std::string& mid, const std::string& sdp);
void trackTransportInfo();

Expand Down
Loading