Browse Source

check localDescription and remoteDescription using mSessionId.

xicilion 1 year ago
parent
commit
4a83d74a5d
3 changed files with 5 additions and 5 deletions
  1. 1 0
      include/rtc/description.hpp
  2. 2 0
      src/description.cpp
  3. 2 5
      src/impl/peerconnection.cpp

+ 1 - 0
include/rtc/description.hpp

@@ -59,6 +59,7 @@ public:
 	string typeString() const;
 	Role role() const;
 	string bundleMid() const;
+	string sessionId() const;
 	std::vector<string> iceOptions() const;
 	optional<string> iceUfrag() const;
 	optional<string> icePwd() const;

+ 2 - 0
src/description.cpp

@@ -201,6 +201,8 @@ string Description::bundleMid() const {
 	return "0";
 }
 
+string Description::sessionId() const { return mSessionId; }
+
 optional<string> Description::iceUfrag() const { return mIceUfrag; }
 
 std::vector<string> Description::iceOptions() const { return mIceOptions; }

+ 2 - 5
src/impl/peerconnection.cpp

@@ -858,11 +858,8 @@ void PeerConnection::validateRemoteDescription(const Description &description) {
 	if (activeMediaCount == 0)
 		throw std::invalid_argument("Remote description has no active media");
 
-	// In the WebRTC Direct protocol, we need to allow local and remote to use the same ufrag and pwd.
-	// if (auto local = localDescription(); local && local->iceUfrag() && local->icePwd())
-	// 	if (*description.iceUfrag() == *local->iceUfrag() &&
-	// 	    *description.icePwd() == *local->icePwd())
-	// 		throw std::logic_error("Got the local description as remote description");
+	if (auto local = localDescription(); local && local->sessionId() == description.sessionId())
+		throw std::logic_error("Got the local description as remote description");
 
 	PLOG_VERBOSE << "Remote description looks valid";
 }