1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

Fix bug when client DTLS is passive. 4.0.82

This commit is contained in:
winlin 2021-03-08 10:41:42 +08:00
parent fc4f539907
commit 43028c99c8
5 changed files with 14 additions and 7 deletions

View file

@ -186,6 +186,7 @@ Other documents:
## V4 changes
* v4.0, 2021-03-08, Fix bug when client DTLS is passive. 4.0.82
* v4.0, 2021-03-03, Fix [#2106][bug #2106], [#2011][bug #2011], RTMP/AAC transcode to Opus bug. 4.0.81
* v4.0, 2021-03-02, Refine build script for FFmpeg and SRTP. 4.0.80
* v4.0, 2021-03-02, Upgrade libsrtp from 2.0.0 to 2.3.0, with source code. 4.0.79

View file

@ -1920,7 +1920,7 @@ srs_error_t SrsRtcConnection::initialize(SrsRequest* r, bool dtls, bool srtp, st
}
}
SrsSessionConfig* cfg = &local_sdp.session_config_;
SrsSessionConfig* cfg = &local_sdp.session_negotiate_;
if ((err = transport_->initialize(cfg)) != srs_success) {
return srs_error_wrap(err, "init");
}

View file

@ -37,7 +37,7 @@ const std::string kTWCCExt = "http://www.ietf.org/id/draft-holmer-rmcat-transpor
// TDOO: FIXME: Rename it, and add utest.
extern std::vector<std::string> split_str(const std::string& str, const std::string& delim);
struct SrsSessionConfig
class SrsSessionConfig
{
public:
std::string dtls_role;
@ -237,6 +237,7 @@ public:
SrsSessionInfo session_info_;
SrsSessionConfig session_config_;
SrsSessionConfig session_negotiate_;
std::vector<std::string> groups_;
std::string group_policy_;

View file

@ -590,18 +590,23 @@ srs_error_t SrsRtcServer::do_create_session(
srs_trace("RTC: Use candidates %s", srs_join_vector_string(candidate_ips, ", ").c_str());
}
// Setup the negotiate DTLS by config.
local_sdp.session_negotiate_ = local_sdp.session_config_;
// Setup the negotiate DTLS role.
if (remote_sdp.get_dtls_role() == "active") {
local_sdp.set_dtls_role("passive");
local_sdp.session_negotiate_.dtls_role = "passive";
} else if (remote_sdp.get_dtls_role() == "passive") {
local_sdp.set_dtls_role("active");
local_sdp.session_negotiate_.dtls_role = "active";
} else if (remote_sdp.get_dtls_role() == "actpass") {
local_sdp.set_dtls_role(local_sdp.session_config_.dtls_role);
local_sdp.session_negotiate_.dtls_role = local_sdp.session_config_.dtls_role;
} else {
// @see: https://tools.ietf.org/html/rfc4145#section-4.1
// The default value of the setup attribute in an offer/answer exchange
// is 'active' in the offer and 'passive' in the answer.
local_sdp.set_dtls_role("passive");
local_sdp.session_negotiate_.dtls_role = "passive";
}
local_sdp.set_dtls_role(local_sdp.session_negotiate_.dtls_role);
session->set_remote_sdp(remote_sdp);
// We must setup the local SDP, then initialize the session object.

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP
#define SRS_VERSION4_REVISION 81
#define SRS_VERSION4_REVISION 82
#endif