WebRTC: merge ICE sessions in into a single ICE session for all tracks
This commit is contained in:
parent
729b75ac2a
commit
a5d092c768
3 changed files with 23 additions and 18 deletions
|
@ -803,8 +803,8 @@ namespace SDP{
|
|||
return (m != NULL) ? true : false;
|
||||
}
|
||||
|
||||
bool Answer::enableVideo(const std::string &codecName){
|
||||
if (!enableMedia("video", codecName, answerVideoMedia, answerVideoFormat)){
|
||||
bool Answer::enableVideo(const std::string &codecName, SDP::Session &sdpSession){
|
||||
if (!enableMedia("video", codecName, answerVideoMedia, answerVideoFormat, sdpSession)){
|
||||
DONTEVEN_MSG("Failed to enable video.");
|
||||
return false;
|
||||
}
|
||||
|
@ -812,8 +812,8 @@ namespace SDP{
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Answer::enableAudio(const std::string &codecName){
|
||||
if (!enableMedia("audio", codecName, answerAudioMedia, answerAudioFormat)){
|
||||
bool Answer::enableAudio(const std::string &codecName, SDP::Session &sdpSession){
|
||||
if (!enableMedia("audio", codecName, answerAudioMedia, answerAudioFormat, sdpSession)){
|
||||
DONTEVEN_MSG("Not enabling audio.");
|
||||
return false;
|
||||
}
|
||||
|
@ -821,8 +821,8 @@ namespace SDP{
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Answer::enableMeta(const std::string &codecName){
|
||||
if (!enableMedia("meta", codecName, answerMetaMedia, answerMetaFormat)){
|
||||
bool Answer::enableMeta(const std::string &codecName, SDP::Session &sdpSession){
|
||||
if (!enableMedia("meta", codecName, answerMetaMedia, answerMetaFormat, sdpSession)){
|
||||
DONTEVEN_MSG("Not enabling meta.");
|
||||
return false;
|
||||
}
|
||||
|
@ -1100,7 +1100,7 @@ namespace SDP{
|
|||
// support; we select the first
|
||||
// one that we find.
|
||||
bool Answer::enableMedia(const std::string &type, const std::string &codecList,
|
||||
SDP::Media &outMedia, SDP::MediaFormat &outFormat){
|
||||
SDP::Media &outMedia, SDP::MediaFormat &outFormat, SDP::Session &sdpSession){
|
||||
Media *media = sdpOffer.getMediaForType(type);
|
||||
if (!media){
|
||||
INFO_MSG("Cannot enable %s codec; offer doesn't have %s media.", codecList.c_str(), type.c_str());
|
||||
|
@ -1168,8 +1168,13 @@ namespace SDP{
|
|||
outMedia = *media;
|
||||
outFormat = *format;
|
||||
outFormat.rtcpFormats.clear();
|
||||
outFormat.icePwd = generateIcePwd();
|
||||
outFormat.iceUFrag = generateIceUFrag();
|
||||
if (!sdpSession.icePwd.size()){
|
||||
sdpSession.icePwd = generateIcePwd();
|
||||
sdpSession.iceUFrag = generateIceUFrag();
|
||||
}
|
||||
outFormat.icePwd = sdpSession.icePwd;
|
||||
outFormat.iceUFrag = sdpSession.iceUFrag;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ namespace SDP{
|
|||
bool parseOffer(const std::string &sdp);
|
||||
bool hasVideo(); ///< Check if the offer has video.
|
||||
bool hasAudio(); ///< Check if the offer has audio.
|
||||
bool enableVideo(const std::string &codecName);
|
||||
bool enableAudio(const std::string &codecName);
|
||||
bool enableMeta(const std::string &codecName);
|
||||
bool enableVideo(const std::string &codecName, SDP::Session &sdpSession);
|
||||
bool enableAudio(const std::string &codecName, SDP::Session &sdpSession);
|
||||
bool enableMeta(const std::string &codecName, SDP::Session &sdpSession);
|
||||
void setCandidate(const std::string &ip, uint16_t port);
|
||||
void setFingerprint(const std::string &fingerprintSha); ///< Set the SHA265 that represents the
|
||||
///< certificate that is used with DTLS.
|
||||
|
@ -178,7 +178,7 @@ namespace SDP{
|
|||
|
||||
private:
|
||||
bool enableMedia(const std::string &type, const std::string &codecName, SDP::Media &outMedia,
|
||||
SDP::MediaFormat &outFormat);
|
||||
SDP::MediaFormat &outFormat, SDP::Session &sdpSession);
|
||||
void addLine(const std::string fmt, ...);
|
||||
std::string generateSessionId();
|
||||
std::string generateIceUFrag(); ///< Generates the `ice-ufrag` value.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue