From 54dbb360b7c5da8f72992babbde890ea3507ae9d Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Thu, 16 Jul 2020 17:08:12 +0200 Subject: [PATCH] Replaced compilation flag USE_JUICE with USE_NICE --- CMakeLists.txt | 8 ++++---- Makefile | 4 ++-- src/icetransport.cpp | 4 ++-- src/icetransport.hpp | 6 +++--- src/peerconnection.cpp | 8 ++++---- src/sctptransport.cpp | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 630065e..bc1414e 100644 --- a/CMakeLists.txt +++ b/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() diff --git a/Makefile b/Makefile index b5633f7..6de37a0 100644 --- a/Makefile +++ b/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) diff --git a/src/icetransport.cpp b/src/icetransport.cpp index 3f44372..d9f08d8 100644 --- a/src/icetransport.cpp +++ b/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 { diff --git a/src/icetransport.hpp b/src/icetransport.hpp index ce0d3a4..96c4f81 100644 --- a/src/icetransport.hpp +++ b/src/icetransport.hpp @@ -26,7 +26,7 @@ #include "peerconnection.hpp" #include "transport.hpp" -#if USE_JUICE +#if !USE_NICE #include #else #include @@ -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 mAgent; string mStunHostname; string mStunService; diff --git a/src/peerconnection.cpp b/src/peerconnection.cpp index 1b799b5..58a0940 100644 --- a/src/peerconnection.cpp +++ b/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 } diff --git a/src/sctptransport.cpp b/src/sctptransport.cpp index 160f75d..96f6e39 100644 --- a/src/sctptransport.cpp +++ b/src/sctptransport.cpp @@ -24,7 +24,7 @@ #include #include -#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.