- exclude AMR / GSM EFR / EVS / Opus codecs from the default build - to make the new basic builds easier to port to new platforms / projects

This commit is contained in:
Dmytro Bogovych 2021-01-20 21:06:17 +02:00
parent 4d8a167899
commit 24270bac97
5 changed files with 42 additions and 19 deletions

View File

@ -59,6 +59,7 @@ set (rtphone_engine engine)
option (USE_AMR_CODEC "Use AMR codec. Requires libraries." OFF)
option (USE_EVS_CODEC "Use EVS codec." OFF)
option (USE_OPUS_CODEC "Use Opus codec." OFF)
option (USE_SEVANA_LIB "Build with Sevana libraries" OFF)
# PIC code by default
@ -103,7 +104,6 @@ set (RTPHONE_SOURCES
${rtphone_engine}/media/MT_AudioStream.cpp
${rtphone_engine}/media/MT_AudioReceiver.cpp
${rtphone_engine}/media/MT_AudioCodec.cpp
${rtphone_engine}/media/MT_AmrCodec.cpp
${rtphone_engine}/media/MT_EvsCodec.cpp
${rtphone_engine}/media/MT_CngHelper.cpp
${rtphone_engine}/agent/Agent_Impl.cpp
@ -115,9 +115,7 @@ set (RTPHONE_SOURCES
${rtphone_engine}/endpoint/EP_NetworkQueue.cpp
${rtphone_engine}/endpoint/EP_Observer.cpp
${rtphone_engine}/endpoint/EP_Session.cpp
)
set (RTPHONE_HEADERS
${rtphone_engine}/media/MT_Statistics.h
${rtphone_engine}/media/MT_WebRtc.h
${rtphone_engine}/media/MT_Stream.h
@ -131,7 +129,7 @@ set (RTPHONE_HEADERS
${rtphone_engine}/media/MT_AudioStream.h
${rtphone_engine}/media/MT_AudioReceiver.h
${rtphone_engine}/media/MT_AudioCodec.h
${rtphone_engine}/media/MT_AmrCodec.h
${rtphone_engine}/media/MT_EvsCodec.h
${rtphone_engine}/media/MT_CngHelper.h
${rtphone_engine}/agent/Agent_Impl.h
@ -145,13 +143,31 @@ set (RTPHONE_HEADERS
${rtphone_engine}/endpoint/EP_Session.h
)
add_library (rtphone STATIC ${RTPHONE_SOURCES} ${RTPHONE_HEADERS})
if (USE_AMR_CODEC)
add_definitions(-DUSE_AMR_CODEC)
set(RTPHONE_SOURCES ${RTPHONE_SOURCES} ${rtphone_engine}/media/MT_AmrCodec.cpp ${rtphone_engine}/media/MT_AmrCodec.h)
endif()
if (USE_EVS_CODEC)
add_definitions(-DUSE_EVS_CODEC)
set(RTPHONE_SOURCES ${RTPHONE_SOURCES} ${rtphone_engine}/media/MT_EvsCodec.cpp ${rtphone_engine}/media/MT_EvsCodec.h)
endif()
if (USE_OPUS_CODEC)
add_definitions(-DUSE_OPUS_CODEC)
endif()
add_library (rtphone STATIC ${RTPHONE_SOURCES})
add_subdirectory(${rtphone_libs}/resiprocate)
add_subdirectory(${rtphone_libs}/ice)
add_subdirectory(${rtphone_libs}/jrtplib/src)
add_subdirectory(${rtphone_libs}/libg729)
add_subdirectory(${rtphone_libs}/libevs)
if (USE_EVS_CODEC)
add_subdirectory(${rtphone_libs}/libevs)
endif()
add_subdirectory(${rtphone_libs}/libgsm)
add_subdirectory(${rtphone_libs}/gsmhr)
add_subdirectory(${rtphone_libs}/g722)
@ -176,10 +192,6 @@ if (USE_AMR_CODEC)
set (LIBS ${LIBS})
endif (USE_AMR_CODEC)
if (USE_EVS_CODEC)
add_definitions(-DUSE_EVS_CODEC)
endif()
target_link_libraries(rtphone
ice_stack jrtplib g729_codec gsm_codec
gsmhr_codec g722_codec srtp resiprocate
@ -187,7 +199,6 @@ target_link_libraries(rtphone
audio_lib
webrtc
speexdsp
# opus
uuid
${OPENSSL_SSL}
${OPENSSL_CRYPTO}

View File

@ -226,7 +226,7 @@ int G729Codec::plc(int lostFrames, void* output, int outputCapacity)
return 0;
}
#if defined(USE_OPUS_CODEC)
// -------------- Opus -------------------
#define OPUS_CODEC_NAME "OPUS"
#define OPUS_CODEC_RATE 16000
@ -526,6 +526,8 @@ int OpusCodec::plc(int lostFrames, void* output, int outputCapacity)
}
return lostFrames * pcmLength();
}
#endif
// -------------- ILBC -------------------

View File

@ -24,7 +24,9 @@ extern "C"
#include "libg729/g729_typedef.h"
#include "libg729/g729_ld8a.h"
#include "opus.h"
#if defined(USE_OPUS_CODEC)
# include "opus.h"
#endif
namespace MT
{
@ -64,6 +66,7 @@ public:
int plc(int lostFrames, void* output, int outputCapacity) override;
};
#if defined(USE_OPUS_CODEC)
class OpusCodec: public Codec
{
protected:
@ -120,6 +123,7 @@ public:
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
int plc(int lostFrames, void* output, int outputCapacity);
};
#endif
class IlbcCodec: public Codec
{

View File

@ -1,4 +1,4 @@
/* Copyright(C) 2007-2020 VoIPobjects (voipobjects.com)
/* Copyright(C) 2007-2021 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -9,8 +9,13 @@
#include "MT_AudioCodec.h"
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI)
# include "MT_AmrCodec.h"
# include "MT_EvsCodec.h"
# if defined(USE_AMR_CODEC)
# include "MT_AmrCodec.h"
# endif
# if defined(USE_EVS_CODEC)
# include "MT_EvsCodec.h"
# endif
#endif
#include "helper/HL_String.h"
@ -91,7 +96,7 @@ CodecList::CodecList(const Settings& settings)
:mSettings(settings)
{
//mFactoryList.push_back(new OpusCodec::OpusFactory(16000, 1));
#if !defined(TARGET_ANDROID)
#if !defined(TARGET_ANDROID) && defined(USE_OPUS_CODEC)
if (settings.mOpusSpec.empty())
{
mFactoryList.push_back(new OpusCodec::OpusFactory(48000, 2, MT_OPUS_CODEC_PT));
@ -106,6 +111,7 @@ CodecList::CodecList(const Settings& settings)
#endif
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI)
#if defined(USE_AMR_CODEC)
for (int pt: mSettings.mAmrWbPayloadType)
mFactoryList.push_back(new AmrWbCodec::CodecFactory({mSettings.mWrapIuUP, false, pt}));
for (int pt: mSettings.mAmrWbOctetPayloadType)
@ -117,6 +123,7 @@ CodecList::CodecList(const Settings& settings)
mFactoryList.push_back(new AmrNbCodec::CodecFactory({mSettings.mWrapIuUP, true, pt}));
mFactoryList.push_back(new GsmEfrCodec::GsmEfrFactory(mSettings.mWrapIuUP, mSettings.mGsmEfrPayloadType));
#endif
#endif
//mFactoryList.push_back(new IsacCodec::IsacFactory16K(mSettings.mIsac16KPayloadType));
@ -131,7 +138,7 @@ CodecList::CodecList(const Settings& settings)
mFactoryList.push_back(new GsmHrCodec::GsmHrFactory(mSettings.mGsmHrPayloadType));
#endif
#if !defined(TARGET_ANDROID)
#if !defined(TARGET_ANDROID) && defined(USE_EVS_CODEC)
for (auto& spec: settings.mEvsSpec)
{
EVSCodec::StreamParameters evs_params;

View File

@ -17,7 +17,6 @@
namespace MT {
class EVSCodec : public Codec
{
public: