Răsfoiți Sursa

Merge pull request #4 from paullouisageneau/dtls-on-connected

Do not wait for ICE Ready
Paul-Louis Ageneau 5 ani în urmă
părinte
comite
ac6cae8fc4
2 a modificat fișierele cu 11 adăugiri și 11 ștergeri
  1. 1 1
      src/icetransport.hpp
  2. 10 10
      src/peerconnection.cpp

+ 1 - 1
src/icetransport.hpp

@@ -41,7 +41,7 @@ public:
 		Disconnected = NICE_COMPONENT_STATE_DISCONNECTED,
 		Connecting = NICE_COMPONENT_STATE_CONNECTING,
 		Connected = NICE_COMPONENT_STATE_CONNECTED,
-		Ready = NICE_COMPONENT_STATE_READY,
+		Completed = NICE_COMPONENT_STATE_READY,
 		Failed = NICE_COMPONENT_STATE_FAILED
 	};
 

+ 10 - 10
src/peerconnection.cpp

@@ -141,7 +141,7 @@ void PeerConnection::initIceTransport(Description::Role role) {
 	    [this, weak_this = weak_ptr<PeerConnection>{shared_from_this()}](IceTransport::State state) {
         auto strong_this = weak_this.lock();
         if (!strong_this) return;
-        
+
 		    switch (state) {
 		    case IceTransport::State::Connecting:
 			    changeState(State::Connecting);
@@ -149,7 +149,7 @@ void PeerConnection::initIceTransport(Description::Role role) {
 		    case IceTransport::State::Failed:
 			    changeState(State::Failed);
 			    break;
-		    case IceTransport::State::Ready:
+		    case IceTransport::State::Connected:
 			    initDtlsTransport();
 			    break;
 		    default:
@@ -160,7 +160,7 @@ void PeerConnection::initIceTransport(Description::Role role) {
 	    [this, weak_this = weak_ptr<PeerConnection>{shared_from_this()}](IceTransport::GatheringState state) {
         auto strong_this = weak_this.lock();
         if (!strong_this) return;
-        
+
 		    switch (state) {
 		    case IceTransport::GatheringState::InProgress:
 			    changeGatheringState(GatheringState::InProgress);
@@ -183,7 +183,7 @@ void PeerConnection::initDtlsTransport() {
 	    [this, weak_this = weak_ptr<PeerConnection>{shared_from_this()}](DtlsTransport::State state) {
         auto strong_this = weak_this.lock();
         if (!strong_this) return;
-        
+
 		    switch (state) {
 		    case DtlsTransport::State::Connected:
 			    initSctpTransport();
@@ -205,7 +205,7 @@ void PeerConnection::initSctpTransport() {
 	    [this, weak_this = weak_ptr<PeerConnection>{shared_from_this()}](SctpTransport::State state) {
         auto strong_this = weak_this.lock();
         if (!strong_this) return;
-        
+
 		    switch (state) {
 		    case SctpTransport::State::Connected:
 			    changeState(State::Connected);
@@ -227,7 +227,7 @@ void PeerConnection::initSctpTransport() {
 bool PeerConnection::checkFingerprint(weak_ptr<PeerConnection> weak_this, const std::string &fingerprint) const {
   auto strong_this = weak_this.lock();
   if (!strong_this) return false;
-  
+
 	if (auto expectedFingerprint =
 	        mRemoteDescription ? mRemoteDescription->fingerprint() : nullopt) {
 		return *expectedFingerprint == fingerprint;
@@ -238,7 +238,7 @@ bool PeerConnection::checkFingerprint(weak_ptr<PeerConnection> weak_this, const
 void PeerConnection::forwardMessage(weak_ptr<PeerConnection> weak_this, message_ptr message) {
   auto strong_this = weak_this.lock();
   if (!strong_this) return;
-  
+
 	if (!mIceTransport || !mSctpTransport)
 		throw std::logic_error("Got a DataChannel message without transport");
 
@@ -310,7 +310,7 @@ void PeerConnection::processLocalDescription(Description description) {
 void PeerConnection::processLocalCandidate(weak_ptr<PeerConnection> weak_this, Candidate candidate) {
   auto strong_this = weak_this.lock();
   if (!strong_this) return;
-  
+
 	if (!mLocalDescription)
 		throw std::logic_error("Got a local candidate without local description");
 
@@ -323,10 +323,10 @@ void PeerConnection::processLocalCandidate(weak_ptr<PeerConnection> weak_this, C
 void PeerConnection::triggerDataChannel(weak_ptr<PeerConnection> weak_this, weak_ptr<DataChannel> weakDataChannel) {
   auto strong_this = weak_this.lock();
   if (!strong_this) return;
-  
+
   auto dataChannel = weakDataChannel.lock();
   if (!dataChannel) return;
-  
+
 	if (mDataChannelCallback)
 		mDataChannelCallback(dataChannel);
 }