- more changes for sevana enabled builds

This commit is contained in:
Dmytro Bogovych 2020-06-27 13:40:01 +03:00
parent 0f4cedb949
commit 7b78c3ce73
3 changed files with 23 additions and 23 deletions

View File

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

View File

@ -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<sevana::aqua>();
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*>(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<MT::SevanaAqua*>(userTag);
// auto* sa = reinterpret_cast<sevana::aqua*>(userTag);
switch (direction)
{

View File

@ -41,7 +41,7 @@ protected:
#if defined(USE_AQUA_LIBRARY)
// Keys are the same as used in mSessionMap
typedef std::map<int, std::shared_ptr<sevana::aqua> AquaMap;
typedef std::map<int, std::shared_ptr<sevana::aqua>> AquaMap;
AquaMap mAquaMap;
ByteBuffer mAquaIncoming, mAquaOutgoing;
#endif