Replaced compilation flag USE_JUICE with USE_NICE

This commit is contained in:
Paul-Louis Ageneau
2020-07-16 17:08:12 +02:00
parent 803a2076ae
commit 54dbb360b7
6 changed files with 17 additions and 17 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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