- fixes for minimalistic builds (without AMR / EVS / Opus codecs)

This commit is contained in:
Dmytro Bogovych 2021-01-21 13:53:25 +02:00
parent 1007d752bc
commit 33465c33a1
3 changed files with 17 additions and 13 deletions

View File

@ -57,10 +57,10 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (rtphone_libs libs) set (rtphone_libs libs)
set (rtphone_engine engine) set (rtphone_engine engine)
set (USE_AMR_CODEC OFF CACHE BOOL "Use AMR codec. Requires libraries." OFF) set (USE_AMR_CODEC FALSE CACHED BOOL "Use AMR codec. Requires libraries.")
set (USE_EVS_CODEC OFF CACHE BOOL "Use EVS codec." OFF) set (USE_EVS_CODEC FALSE CACHED BOOL "Use EVS codec." )
set (USE_OPUS_CODEC OFF CACHE BOOL "Use Opus codec." OFF) set (USE_OPUS_CODEC FALSE CACHED BOOL "Use Opus codec." )
set (USE_SEVANA_LIB OFF CACHE BOOL "Build with Sevana libraries" OFF) set (USE_SEVANA_LIB FALSE CACHED BOOL "Build with Sevana libraries" )
# PIC code by default # PIC code by default
set (CMAKE_POSITION_INDEPENDENT_CODE ON) set (CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -86,6 +86,7 @@ if (CMAKE_SYSTEM MATCHES "Darwin*")
endif() endif()
if (USE_SEVANA_LIB) if (USE_SEVANA_LIB)
message("Use Sevana libraries")
add_definitions( -DUSE_AQUA_LIBRARY -DUSE_PVQA_LIBRARY) add_definitions( -DUSE_AQUA_LIBRARY -DUSE_PVQA_LIBRARY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa/include)
endif() endif()

View File

@ -8,10 +8,10 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_POSITION_INDEPENDENT_CODE ON) set (CMAKE_POSITION_INDEPENDENT_CODE ON)
# Set of variables to control references to codecs # Set of variables to control references to codecs
set (USE_AMR_CODEC OFF CACHE BOOL "Use AMR codec. Requires libraries." OFF) set (USE_AMR_CODEC OFF CACHE BOOL "Use AMR codec. Requires libraries.")
set (USE_EVS_CODEC OFF CACHE BOOL "Use EVS codec." OFF) set (USE_EVS_CODEC OFF CACHE BOOL "Use EVS codec." )
set (USE_OPUS_CODEC OFF CACHE BOOL "Use Opus codec." OFF) set (USE_OPUS_CODEC OFF CACHE BOOL "Use Opus codec." )
set (USE_SEVANA_LIB OFF CACHE BOOL "Build with Sevana libraries" OFF) set (USE_SEVANA_LIB OFF CACHE BOOL "Build with Sevana libraries" )
set (SOURCES set (SOURCES
MT_Statistics.cpp MT_Statistics.cpp
@ -46,16 +46,19 @@ set (SOURCES
) )
if (USE_AMR_CODEC) if (USE_AMR_CODEC)
message("AMR NB and WB codecs will be included.")
add_definitions(-DUSE_AMR_CODEC) add_definitions(-DUSE_AMR_CODEC)
set(SOURCES ${SOURCES} MT_AmrCodec.cpp MT_AmrCodec.h) set(SOURCES ${SOURCES} MT_AmrCodec.cpp MT_AmrCodec.h)
endif() endif()
if (USE_EVS_CODEC) if (USE_EVS_CODEC)
message("EVS codec will be included.")
add_definitions (-DUSE_EVS_CODEC) add_definitions (-DUSE_EVS_CODEC)
set (SOURCES ${SOURCES} MT_EvsCodec.cpp MT_EvsCodec.h) set (SOURCES ${SOURCES} MT_EvsCodec.cpp MT_EvsCodec.h)
endif() endif()
if (USE_OPUS_CODEC) if (USE_OPUS_CODEC)
message("Opus codec will be included.")
add_definitions(-DUSE_OPUS_CODEC) add_definitions(-DUSE_OPUS_CODEC)
endif() endif()

View File

@ -1,4 +1,4 @@
/* Copyright(C) 2007-2018 VoIPobjects (voipobjects.com) /* Copyright(C) 2007-2021 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -13,7 +13,7 @@
#include "../audio/Audio_Interface.h" #include "../audio/Audio_Interface.h"
#include "../audio/Audio_Resampler.h" #include "../audio/Audio_Resampler.h"
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) #if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) && defined(USE_AMR_CODEC)
# include "MT_AmrCodec.h" # include "MT_AmrCodec.h"
#endif #endif
@ -49,8 +49,8 @@ int RtpBuffer::Packet::rate() const
// ------------ RtpBuffer ---------------- // ------------ RtpBuffer ----------------
RtpBuffer::RtpBuffer(Statistics& stat) RtpBuffer::RtpBuffer(Statistics& stat)
:mStat(stat), mSsrc(0), mHigh(RTP_BUFFER_HIGH), mLow(RTP_BUFFER_LOW), mPrebuffer(RTP_BUFFER_PREBUFFER), :mStat(stat), mSsrc(0), mHigh(RTP_BUFFER_HIGH), mLow(RTP_BUFFER_LOW), mPrebuffer(RTP_BUFFER_PREBUFFER),
mFirstPacketWillGo(true), mFirstPacketWillGo(true), mReturnedCounter(0), mAddCounter(0),
mReturnedCounter(0), mAddCounter(0), mFetchedPacket(std::shared_ptr<RTPPacket>(), 0, 0) mFetchedPacket(std::shared_ptr<RTPPacket>(), 0, 0)
{ {
} }
@ -694,7 +694,7 @@ float AudioReceiver::calculatePvqaMos(int rate, std::string& report)
void AudioReceiver::processStatisticsWithAmrCodec(Codec* c) void AudioReceiver::processStatisticsWithAmrCodec(Codec* c)
{ {
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) #if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_WIN) && !defined(TARGET_RPI) && defined(USE_AMR_CODEC)
AmrNbCodec* nb = dynamic_cast<AmrNbCodec*>(c); AmrNbCodec* nb = dynamic_cast<AmrNbCodec*>(c);
AmrWbCodec* wb = dynamic_cast<AmrWbCodec*>(c); AmrWbCodec* wb = dynamic_cast<AmrWbCodec*>(c);