Преглед изворни кода

Merge pull request #17 from murat-dogan/master

Fix logic error: If we pass Relay Type then it is a TURN Server
Paul-Louis Ageneau пре 5 година
родитељ
комит
901700177b
3 измењених фајлова са 8 додато и 7 уклоњено
  1. 2 2
      include/rtc/configuration.hpp
  2. 3 3
      src/configuration.cpp
  3. 3 2
      test/main.cpp

+ 2 - 2
include/rtc/configuration.hpp

@@ -35,8 +35,8 @@ struct IceServer {
 	IceServer(const string &host_);
 	IceServer(const string &hostname_, uint16_t port_);
 	IceServer(const string &hostname_, const string &service_);
-	IceServer(const string &hostname_, const string &service_, Type type_, string username_,
-	          string password_, RelayType relayType_);
+	IceServer(const string &hostname_, const string &service_, string username_, string password_,
+	          RelayType relayType_);
 
 	string hostname;
 	string service;

+ 3 - 3
src/configuration.cpp

@@ -38,9 +38,9 @@ IceServer::IceServer(const string &hostname_, uint16_t port_)
 IceServer::IceServer(const string &hostname_, const string &service_)
     : hostname(hostname_), service(service_), type(Type::Stun) {}
 
-IceServer::IceServer(const string &hostname_, const string &service_, Type type_, string username_,
+IceServer::IceServer(const string &hostname_, const string &service_, string username_,
                      string password_, RelayType relayType_)
-    : hostname(hostname_), service(service_), type(type_), username(username_), password(password_),
-      relayType(relayType_) {}
+    : hostname(hostname_), service(service_), type(Type::Turn), username(username_),
+      password(password_), relayType(relayType_) {}
 
 } // namespace rtc

+ 3 - 2
test/main.cpp

@@ -33,8 +33,9 @@ int main(int argc, char **argv) {
 	// config.iceServers.emplace_back("stun.l.google.com:19302");
 	// config.enableIceTcp = true;
 
-	// IceServer turnServer("TURN_SERVER_URL", "PORT_NO", IceServer::Type::TURN, "USERNAME",
-	//                      "PASSWORD", IceServer::RelayType::RELAY_TYPE_TURN_TLS);
+	// Add TURN Server Example
+	// IceServer turnServer("TURN_SERVER_URL", "PORT_NO", "USERNAME", "PASSWORD", 
+	//							IceServer::RelayType::TurnTls);
 	// config.iceServers.push_back(turnServer);
 
 	auto pc1 = std::make_shared<PeerConnection>(config);