- link Opus codec always

This commit is contained in:
2026-01-29 15:14:57 +03:00
parent bbf854a17a
commit 155c6fd691
6 changed files with 4 additions and 22 deletions

View File

@@ -10,7 +10,6 @@ set (E engine)
option (USE_AMR_CODEC "Use AMR codec. Requires libraries." ON) option (USE_AMR_CODEC "Use AMR codec. Requires libraries." ON)
option (USE_EVS_CODEC "Use EVS codec." ON) option (USE_EVS_CODEC "Use EVS codec." ON)
option (USE_OPUS_CODEC "Use Opus codec." ON)
option (USE_MUSL "Build with MUSL library" OFF) option (USE_MUSL "Build with MUSL library" OFF)
# PIC code by default # PIC code by default
@@ -308,10 +307,6 @@ set (RTPHONE_SOURCES
${L}/ice/md5_impl.h ${L}/ice/md5_impl.h
) )
if (USE_OPUS_CODEC)
set (DEFINES ${DEFINES} -DUSE_OPUS_CODEC)
endif()
add_library (rtphone STATIC ${RTPHONE_SOURCES}) add_library (rtphone STATIC ${RTPHONE_SOURCES})
add_subdirectory(${L}/resiprocate) add_subdirectory(${L}/resiprocate)

View File

@@ -87,7 +87,6 @@
#define MT_EVS_CODECNAME "EVS" #define MT_EVS_CODECNAME "EVS"
// OPUS codec defines // OPUS codec defines
// #define USE_OPUS_CODEC
#define MT_OPUS_CODEC_PT 106 #define MT_OPUS_CODEC_PT 106
// ILBC codec defines // ILBC codec defines

View File

@@ -63,11 +63,8 @@ if (USE_EVS_CODEC)
list (APPEND LIBS_CODEC evs_codec) list (APPEND LIBS_CODEC evs_codec)
endif() endif()
if (USE_OPUS_CODEC)
message("Media: Opus codec will be included.") message("Media: Opus codec will be included.")
target_compile_definitions(media_lib PUBLIC USE_OPUS_CODEC)
list (APPEND LIBS_CODEC opus) list (APPEND LIBS_CODEC opus)
endif()
if(CMAKE_SYSTEM MATCHES "Linux*" OR CMAKE_SYSTEM MATCHES "Darwin*") if(CMAKE_SYSTEM MATCHES "Linux*" OR CMAKE_SYSTEM MATCHES "Darwin*")
target_compile_definitions(media_lib PUBLIC HAVE_NETINET_IN_H) target_compile_definitions(media_lib PUBLIC HAVE_NETINET_IN_H)

View File

@@ -222,7 +222,6 @@ int G729Codec::plc(int lostFrames, void* output, int outputCapacity)
return 0; return 0;
} }
#if defined(USE_OPUS_CODEC)
// -------------- Opus ------------------- // -------------- Opus -------------------
#define OPUS_CODEC_NAME "OPUS" #define OPUS_CODEC_NAME "OPUS"
#define OPUS_CODEC_RATE 16000 #define OPUS_CODEC_RATE 16000
@@ -592,9 +591,6 @@ int OpusCodec::plc(int lostPackets, void* output, int outputCapacity)
} }
return ((char*)data_output - (char*)output) * sizeof(opus_int16); return ((char*)data_output - (char*)output) * sizeof(opus_int16);
} }
#endif
// -------------- ILBC ------------------- // -------------- ILBC -------------------
#define ILBC_CODEC_NAME "ILBC" #define ILBC_CODEC_NAME "ILBC"

View File

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

View File

@@ -326,12 +326,10 @@ void CodecList::init(const Settings& settings)
{ {
mFactoryList.clear(); mFactoryList.clear();
mSettings = settings; mSettings = settings;
#if defined(USE_OPUS_CODEC)
for (auto spec: settings.mOpusSpec) for (auto spec: settings.mOpusSpec)
{ {
mFactoryList.push_back(std::make_shared<OpusCodec::OpusFactory>(spec.mRate, spec.mChannels, spec.mPayloadType)); mFactoryList.push_back(std::make_shared<OpusCodec::OpusFactory>(spec.mRate, spec.mChannels, spec.mPayloadType));
} }
#endif
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI) #if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI)