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)
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()

View File

@ -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)

View File

@ -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 {

View File

@ -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;

View File

@ -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
}

View File

@ -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.