Browse Source

Replaced compilation flag USE_JUICE with USE_NICE

Paul-Louis Ageneau 5 years ago
parent
commit
54dbb360b7
6 changed files with 17 additions and 17 deletions
  1. 4 4
      CMakeLists.txt
  2. 2 2
      Makefile
  3. 2 2
      src/icetransport.cpp
  4. 3 3
      src/icetransport.hpp
  5. 4 4
      src/peerconnection.cpp
  6. 2 2
      src/sctptransport.cpp

+ 4 - 4
CMakeLists.txt

@@ -194,14 +194,14 @@ endif()
 
 if (USE_NICE OR NOT USE_JUICE)
 	find_package(LibNice REQUIRED)
-	target_compile_definitions(datachannel PRIVATE USE_JUICE=0)
-	target_compile_definitions(datachannel-static PRIVATE USE_JUICE=0)
+	target_compile_definitions(datachannel PRIVATE USE_NICE=1)
+	target_compile_definitions(datachannel-static PRIVATE USE_NICE=1)
 	target_link_libraries(datachannel PRIVATE LibNice::LibNice)
 	target_link_libraries(datachannel-static PRIVATE LibNice::LibNice)
 else()
 	add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
-	target_compile_definitions(datachannel PRIVATE USE_JUICE=1)
-	target_compile_definitions(datachannel-static PRIVATE USE_JUICE=1)
+	target_compile_definitions(datachannel PRIVATE USE_NICE=0)
+	target_compile_definitions(datachannel-static PRIVATE USE_NICE=0)
 	target_link_libraries(datachannel PRIVATE LibJuice::LibJuiceStatic)
 	target_link_libraries(datachannel-static PRIVATE LibJuice::LibJuiceStatic)
 endif()

+ 2 - 2
Makefile

@@ -27,10 +27,10 @@ endif
 
 USE_NICE ?= 0
 ifneq ($(USE_NICE), 0)
-        CPPFLAGS+=-DUSE_JUICE=0
+        CPPFLAGS+=-DUSE_NICE=1
         LIBS+=glib-2.0 gobject-2.0 nice
 else
-        CPPFLAGS+=-DUSE_JUICE=1
+        CPPFLAGS+=-DUSE_NICE=0
         INCLUDES+=-I$(JUICE_DIR)/include
         LOCALLIBS+=libjuice.a
 ifneq ($(USE_GNUTLS), 0)

+ 2 - 2
src/icetransport.cpp

@@ -42,7 +42,7 @@ using std::shared_ptr;
 using std::weak_ptr;
 using std::chrono::system_clock;
 
-#if USE_JUICE
+#if !USE_NICE
 
 namespace rtc {
 
@@ -269,7 +269,7 @@ void IceTransport::LogCallback(juice_log_level_t level, const char *message) {
 
 } // namespace rtc
 
-#else // USE_JUICE == 0
+#else // USE_NICE == 1
 
 namespace rtc {
 

+ 3 - 3
src/icetransport.hpp

@@ -26,7 +26,7 @@
 #include "peerconnection.hpp"
 #include "transport.hpp"
 
-#if USE_JUICE
+#if !USE_NICE
 #include <juice/juice.h>
 #else
 #include <nice/agent.h>
@@ -63,7 +63,7 @@ public:
 	bool stop() override;
 	bool send(message_ptr message) override; // false if dropped
 
-#if !USE_JUICE
+#if USE_NICE
 	bool getSelectedCandidatePair(CandidateInfo *local, CandidateInfo *remote);
 #endif
 
@@ -85,7 +85,7 @@ private:
 	candidate_callback mCandidateCallback;
 	gathering_state_callback mGatheringStateChangeCallback;
 
-#if USE_JUICE
+#if !USE_NICE
 	std::unique_ptr<juice_agent_t, void (*)(juice_agent_t *)> mAgent;
 	string mStunHostname;
 	string mStunService;

+ 4 - 4
src/peerconnection.cpp

@@ -669,12 +669,12 @@ void PeerConnection::resetCallbacks() {
 
 bool PeerConnection::getSelectedCandidatePair([[maybe_unused]] CandidateInfo *local,
                                               [[maybe_unused]] CandidateInfo *remote) {
-#if USE_JUICE
-	PLOG_WARNING << "getSelectedCandidatePair() is not implemented for libjuice";
-	return false;
-#else
+#if USE_NICE
 	auto iceTransport = std::atomic_load(&mIceTransport);
 	return iceTransport->getSelectedCandidatePair(local, remote);
+#else
+	PLOG_WARNING << "getSelectedCandidatePair() is only implemented with libnice as ICE backend";
+	return false;
 #endif
 }
 

+ 2 - 2
src/sctptransport.cpp

@@ -24,7 +24,7 @@
 #include <thread>
 #include <vector>
 
-#ifdef USE_JUICE
+#if !USE_NICE
 #ifndef __APPLE__
 // libjuice enables Linux path MTU discovery or sets the DF flag
 #define USE_PMTUD 1
@@ -32,7 +32,7 @@
 // Setting the DF flag is not available on Mac OS
 #define USE_PMTUD 0
 #endif
-#else
+#else // USE_NICE == 1
 #ifdef __linux__
 // Linux UDP does path MTU discovery by default (setting DF and returning EMSGSIZE)
 // It should be safe to enable discovery for SCTP.