From e98dd3e2922c111a3eaa5c47f0e4350e1cca676f Mon Sep 17 00:00:00 2001 From: xicilion Date: Sat, 11 May 2024 03:33:55 +0800 Subject: [PATCH 1/3] Disable comparing local and remote iceUfrag and icePwd in validateRemoteDescription. --- src/impl/peerconnection.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/impl/peerconnection.cpp b/src/impl/peerconnection.cpp index 3133fe328..d6bcdb1e1 100644 --- a/src/impl/peerconnection.cpp +++ b/src/impl/peerconnection.cpp @@ -858,10 +858,11 @@ void PeerConnection::validateRemoteDescription(const Description &description) { if (activeMediaCount == 0) throw std::invalid_argument("Remote description has no active media"); - 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"); + // 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"); PLOG_VERBOSE << "Remote description looks valid"; } From 4a83d74a5d17778079182e0529b0eb54336b2dbe Mon Sep 17 00:00:00 2001 From: xicilion Date: Sun, 12 May 2024 20:59:15 +0800 Subject: [PATCH 2/3] check localDescription and remoteDescription using mSessionId. --- include/rtc/description.hpp | 1 + src/description.cpp | 2 ++ src/impl/peerconnection.cpp | 7 ++----- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/rtc/description.hpp b/include/rtc/description.hpp index ac24f4306..dbb832dba 100644 --- a/include/rtc/description.hpp +++ b/include/rtc/description.hpp @@ -59,6 +59,7 @@ class RTC_CPP_EXPORT Description { string typeString() const; Role role() const; string bundleMid() const; + string sessionId() const; std::vector iceOptions() const; optional iceUfrag() const; optional icePwd() const; diff --git a/src/description.cpp b/src/description.cpp index c6aafb2f8..e590bef55 100644 --- a/src/description.cpp +++ b/src/description.cpp @@ -201,6 +201,8 @@ string Description::bundleMid() const { return "0"; } +string Description::sessionId() const { return mSessionId; } + optional Description::iceUfrag() const { return mIceUfrag; } std::vector Description::iceOptions() const { return mIceOptions; } diff --git a/src/impl/peerconnection.cpp b/src/impl/peerconnection.cpp index d6bcdb1e1..8c57b8bca 100644 --- a/src/impl/peerconnection.cpp +++ b/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"; } From 430b4ab2d3d95108e3726e5d60551b0925e25dec Mon Sep 17 00:00:00 2001 From: xicilion Date: Fri, 24 May 2024 20:45:45 +0800 Subject: [PATCH 3/3] Disable the check for local and remote iceUfrag and icePwd in validateRemoteDescription. --- include/rtc/description.hpp | 1 - src/description.cpp | 2 -- src/impl/peerconnection.cpp | 3 --- 3 files changed, 6 deletions(-) diff --git a/include/rtc/description.hpp b/include/rtc/description.hpp index dbb832dba..ac24f4306 100644 --- a/include/rtc/description.hpp +++ b/include/rtc/description.hpp @@ -59,7 +59,6 @@ class RTC_CPP_EXPORT Description { string typeString() const; Role role() const; string bundleMid() const; - string sessionId() const; std::vector iceOptions() const; optional iceUfrag() const; optional icePwd() const; diff --git a/src/description.cpp b/src/description.cpp index e590bef55..c6aafb2f8 100644 --- a/src/description.cpp +++ b/src/description.cpp @@ -201,8 +201,6 @@ string Description::bundleMid() const { return "0"; } -string Description::sessionId() const { return mSessionId; } - optional Description::iceUfrag() const { return mIceUfrag; } std::vector Description::iceOptions() const { return mIceOptions; } diff --git a/src/impl/peerconnection.cpp b/src/impl/peerconnection.cpp index 8c57b8bca..7dbe3e38b 100644 --- a/src/impl/peerconnection.cpp +++ b/src/impl/peerconnection.cpp @@ -858,9 +858,6 @@ void PeerConnection::validateRemoteDescription(const Description &description) { if (activeMediaCount == 0) throw std::invalid_argument("Remote description has no active media"); - 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"; }