From 7b78c3ce73dce501c60c95126c902c74aa236d98 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Sat, 27 Jun 2020 13:40:01 +0300 Subject: [PATCH] - more changes for sevana enabled builds --- src/CMakeLists.txt | 12 ++++++++++-- src/engine/agent/Agent_Impl.cpp | 32 ++++++++++++-------------------- src/engine/agent/Agent_Impl.h | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 76132e73..b13616d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,9 +57,11 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON) set (rtphone_libs libs) set (rtphone_engine engine) -option (USE_AMR_CODEC "Use AMR codec. Requires libraries." OFF) -option (USE_EVS_CODEC "Use EVS codec." OFF) +option (USE_AMR_CODEC "Use AMR codec. Requires libraries." OFF) +option (USE_EVS_CODEC "Use EVS codec." OFF) +option (USE_SEVANA_LIB "Build with Sevana libraries" OFF) +# PIC code by default set (CMAKE_POSITION_INDEPENDENT_CODE ON) if (NOT DEFINED LIB_PLATFORM) @@ -82,6 +84,11 @@ if (CMAKE_SYSTEM MATCHES "Darwin*") add_definitions (-DTARGET_OSX) endif() +if (USE_SEVANA_LIB) + add_definitions( -DUSE_AQUA_LIBRARY -DUSE_PVQA_LIBRARY) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa/include) +endif() + set (RTPHONE_SOURCES ${rtphone_engine}/media/MT_Statistics.cpp ${rtphone_engine}/media/MT_WebRtc.cpp @@ -203,4 +210,5 @@ target_include_directories(rtphone ${CMAKE_CURRENT_SOURCE_DIR}/libs/json ) +# For MSVC static builds configure_msvc_runtime() diff --git a/src/engine/agent/Agent_Impl.cpp b/src/engine/agent/Agent_Impl.cpp index a4306a3d..e3234a62 100644 --- a/src/engine/agent/Agent_Impl.cpp +++ b/src/engine/agent/Agent_Impl.cpp @@ -163,7 +163,7 @@ void AgentImpl::processConfig(Json::Value &d, Json::Value &answer) #if !defined(TARGET_ANDROID) && defined(USE_AQUA_LIBRARY) std::string aquaLicense = d["aqua-license"].asString(); if (!aquaLicense.empty()) - sevana::aqua::initializeLibrary(aquaLicense); + sevana::aqua::initialize(aquaLicense.c_str(), aquaLicense.size()); #endif std::string transport = d["transport"].asString(); @@ -333,13 +333,13 @@ void AgentImpl::processStartSession(Json::Value& request, Json::Value& answer) #if defined(USE_AQUA_LIBRARY) std::string temp_path = request["aqua_temp_path"].asString(); - std::string config = "-avlp on -smtnrm on -decor off -mprio off -npnt auto -voip off -enorm off -g711 on -spfrcor off -grad off -tmc on -miter 1 -trim a 10"; - if (temp_path.size()) - config += " -fau " + temp_path; + std::string config = "-avlp on -smtnrm on -decor off -mprio off -npnt auto -voip off -enorm off -g711 on -spfrcor off -grad off -tmc on -miter 1 -trim a 10 -output json"; + /*if (temp_path.size()) + config += " -fau " + temp_path; */ auto qc = std::make_shared(); - qc->setTempPath(temp_path); - qc->configureWith(MT::SevanaAqua::parseConfig(config)); + //qc->setTempPath(temp_path); + qc->configure_with(sevana::aqua::parse(config)); mAquaMap[sessionIter->first] = qc; dynamic_cast(audioProvider.get())->configureMediaObserver(this, (void*)qc.get()); @@ -551,24 +551,16 @@ void AgentImpl::processGetMediaStats(Json::Value& request, Json::Value& answer) while (wasRead == 1024); } } - MT::PSevanaAqua sa = mAquaMap[sessionIter->first]; - MT::SevanaAqua::AudioBuffer test(mAquaIncoming.data(), mAquaIncoming.size()), + + auto sa = mAquaMap[sessionIter->first]; + sevana::aqua::audio_buffer test(mAquaIncoming.data(), mAquaIncoming.size()), reference(referenceAudio.data(), referenceAudio.size()); test.mRate = AUDIO_SAMPLERATE; reference.mRate = AUDIO_SAMPLERATE; test.mChannels = AUDIO_CHANNELS; reference.mChannels = AUDIO_CHANNELS; - MT::SevanaAqua::CompareResult r = sa->compare(reference, test); + auto r = sa->compare(reference, test); answer["aqua_mos"] = r.mMos; - - if (r.mFaults) - { - Json::Value json(r.mReport); - Json::Value faults = r.mFaults->toJson(); - json["faults"] = faults; - answer["aqua_report"] = json.toStyledString(); - } - else - answer["aqua_report"] = r.mReport; + answer["aqua_report"] = r.mFaultsText; } #endif @@ -745,7 +737,7 @@ void AgentImpl::onMedia(const void* data, int length, MT::Stream::MediaDirection mOutgoingAudioDump->write(data, length);*/ // User tag points to accumulator object which includes - MT::SevanaAqua* sa = reinterpret_cast(userTag); + // auto* sa = reinterpret_cast(userTag); switch (direction) { diff --git a/src/engine/agent/Agent_Impl.h b/src/engine/agent/Agent_Impl.h index 06ca722d..fc6bbf96 100644 --- a/src/engine/agent/Agent_Impl.h +++ b/src/engine/agent/Agent_Impl.h @@ -41,7 +41,7 @@ protected: #if defined(USE_AQUA_LIBRARY) // Keys are the same as used in mSessionMap - typedef std::map AquaMap; + typedef std::map> AquaMap; AquaMap mAquaMap; ByteBuffer mAquaIncoming, mAquaOutgoing; #endif