From 21fb865d80b59dc1cbdc3173b7eba5881af5c86d Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Tue, 30 May 2023 18:26:20 +0300 Subject: [PATCH] - remove references to Sevana libraries --- src/engine/agent/Agent_Impl.cpp | 76 +----------------------------- src/engine/endpoint/EP_Session.cpp | 29 ++++-------- 2 files changed, 11 insertions(+), 94 deletions(-) diff --git a/src/engine/agent/Agent_Impl.cpp b/src/engine/agent/Agent_Impl.cpp index d7cba6cf..62ccb51e 100644 --- a/src/engine/agent/Agent_Impl.cpp +++ b/src/engine/agent/Agent_Impl.cpp @@ -526,24 +526,13 @@ void AgentImpl::processGetMediaStats(JsonCpp::Value& request, JsonCpp::Value& an { PSession session = sessionIter->second; VariantMap result; - bool includePvqa = request["include_pvqa"].asBool(); -#if defined(USE_AQUA_LIBRARY) - bool includeAqua = request["include_aqua"].asBool(); - std::string aquaReference = request["aqua_reference_audio"].asString(); -#endif - session->getSessionInfo(includePvqa ? Session::InfoOptions::Detailed : Session::InfoOptions::Standard, + session->getSessionInfo(Session::InfoOptions::Detailed, result); if (result.exists(SessionInfo_AudioCodec)) answer["codec"] = result[SessionInfo_AudioCodec].asStdString(); if (result.exists(SessionInfo_NetworkMos)) answer["network_mos"] = result[SessionInfo_NetworkMos].asFloat(); -#if defined(USE_PVQA_LIBRARY) - if (result.exists(SessionInfo_PvqaMos)) - answer["pvqa_mos"] = result[SessionInfo_PvqaMos].asFloat(); - if (result.exists(SessionInfo_PvqaReport)) - answer["pvqa_report"] = CsvReportToJson(result[SessionInfo_PvqaReport].asStdString()); -#endif if (result.exists(SessionInfo_PacketLoss)) answer["rtp_lost"] = result[SessionInfo_LostRtp].asInt(); if (result.exists(SessionInfo_DroppedRtp)) @@ -566,69 +555,6 @@ void AgentImpl::processGetMediaStats(JsonCpp::Value& request, JsonCpp::Value& an if (result.exists(SessionInfo_RemotePeer)) answer["rtp_remotepeer"] = result[SessionInfo_RemotePeer].asStdString(); -#if defined(USE_AQUA_LIBRARY) -/* if (includeAqua) - { - answer["incoming_audio"] = mAquaIncoming.hexstring(); - answer["incoming_audio_samplerate"] = AUDIO_SAMPLERATE; - answer["incoming_audio_channels"] = AUDIO_CHANNELS; - - ICELogInfo(<< "Running AQuA analyzer."); - ByteBuffer referenceAudio; - // Read AQuA reference audio from file if available - if (aquaReference.empty()) - { - ICELogCritical(<< "AQuA reference audio file is not set, skipping analyzing."); - } - else { - auto sa = mAquaMap[sessionIter->first]; - if (sa) { - Audio::WavFileReader reader; - reader.open(strx::makeTstring(aquaReference)); - - if (reader.isOpened()) { - char buffer[1024]; - int wasRead = 0; - do { - wasRead = reader.read(buffer, 1024); - if (wasRead > 0) - referenceAudio.appendBuffer(buffer, wasRead); - } while (wasRead == 1024); - } - else { - ICELogCritical(<< "Failed to read AQuA reference audio, error code: " << reader.lastError()); - } - - 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; - ICELogInfo( - << "Comparing test audio " << mAquaIncoming.size() << " bytes with reference audio " << referenceAudio.size() << " bytes."); - auto r = sa->compare(reference, test); - if (r.mErrorCode) { - ICELogInfo( - << "Error code: " << r.mErrorCode << ", msg: " << r.mErrorMessage); - } else { - ICELogInfo(<< "MOS: " << r.mMos << ", faults: " << r.mFaultsText); - } - answer["aqua_mos"] = r.mMos; - answer["aqua_report"] = r.mFaultsText; - - if (r.mErrorCode) { - answer["aqua_error_code"] = r.mErrorCode; - answer["aqua_error_message"] = r.mErrorMessage; - } - closeAqua(sessionIter->first); - } - } - // Remove test audio - mAquaIncoming.clear(); mAquaOutgoing.clear(); - }*/ -#endif - answer["status"] = Status_Ok; } else diff --git a/src/engine/endpoint/EP_Session.cpp b/src/engine/endpoint/EP_Session.cpp index 7f880d20..8df9d879 100644 --- a/src/engine/endpoint/EP_Session.cpp +++ b/src/engine/endpoint/EP_Session.cpp @@ -446,27 +446,18 @@ void Session::getSessionInfo(Session::InfoOptions options, VariantMap& info) // Iterate all session providers stat.reset(); - Stream* media = NULL; - for (unsigned streamIndex = 0; streamIndex < mStreamList.size(); streamIndex++) + Stream* media = nullptr; + for (Stream& stream: mStreamList) { - Stream& stream = mStreamList[streamIndex]; - if (stream.provider()) - { - media = &stream; - MT::Statistics s = stream.provider()->getStatistics(); -#if defined(USE_PVQA_LIBRARY) && !defined(TARGET_SERVER) - if (options != InfoOptions::Standard) - { - // This information is available AFTER audio stream is deleted - info[SessionInfo_PvqaMos] = s.mPvqaMos; - info[SessionInfo_PvqaReport] = s.mPvqaReport; - } -#endif - info[SessionInfo_NetworkMos] = static_cast(s.calculateMos(4.14)); - info[SessionInfo_AudioCodec] = s.mCodecName; + if (!stream.provider()) + continue; - stat += s; - } + media = &stream; + MT::Statistics s = stream.provider()->getStatistics(); + info[SessionInfo_NetworkMos] = static_cast(s.calculateMos(4.14)); + info[SessionInfo_AudioCodec] = s.mCodecName; + + stat += s; } info[SessionInfo_ReceivedTraffic] = static_cast(stat.mReceived);