- decouple the Sevana libraries; some improvements for statistics

This commit is contained in:
Dmytro Bogovych 2022-10-12 12:28:57 +03:00
parent c2e9985bc2
commit 691501c405
11 changed files with 18 additions and 54 deletions

View File

@ -7,13 +7,6 @@
#include "helper/HL_Base64.h" #include "helper/HL_Base64.h"
#include <fstream> #include <fstream>
#if defined(USE_PVQA_LIBRARY)
# include "pvqa++.h"
#endif
#if defined(USE_AQUA_LIBRARY)
# include "aqua++.h"
#endif
const std::string Status_Ok = "ok"; const std::string Status_Ok = "ok";
const std::string Status_SessionNotFound = "session not found"; const std::string Status_SessionNotFound = "session not found";
@ -156,20 +149,6 @@ void AgentImpl::processConfig(JsonCpp::Value &d, JsonCpp::Value &answer)
{ {
std::unique_lock<std::recursive_mutex> l(mAgentMutex); std::unique_lock<std::recursive_mutex> l(mAgentMutex);
#if !defined(TARGET_ANDROID) && defined(USE_PVQA_LIBRARY)
// It works for desktop OSes only
// Because Android requires special initializing procedure (valid JNI environment context)
std::string pvqaLicense = d["pvqa-license"].asString(), pvqaConfig = d["pvqa-config"].asString();
if (!pvqaLicense.empty() && !pvqaConfig.empty())
sevana::pvqa::initialize(pvqaLicense, pvqaConfig);
#endif
#if !defined(TARGET_ANDROID) && defined(USE_AQUA_LIBRARY)
std::string aquaLicense = d["aqua-license"].asString();
if (!aquaLicense.empty())
sevana::aqua::initialize(aquaLicense.c_str(), aquaLicense.size());
#endif
std::string transport = d["transport"].asString(); std::string transport = d["transport"].asString();
config()[CONFIG_TRANSPORT] = (transport == "any") ? TransportType_Any : (transport == "udp" ? TransportType_Udp : (transport == "tcp" ? TransportType_Tcp : TransportType_Tls)); config()[CONFIG_TRANSPORT] = (transport == "any") ? TransportType_Any : (transport == "udp" ? TransportType_Udp : (transport == "tcp" ? TransportType_Tcp : TransportType_Tls));
config()[CONFIG_IPV4] = d["ipv4"].asBool(); config()[CONFIG_IPV4] = d["ipv4"].asBool();

View File

@ -13,18 +13,8 @@
#include "Agent_AudioManager.h" #include "Agent_AudioManager.h"
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#if defined(USE_AQUA_LIBRARY)
# include "aqua++.h"
#endif
#if defined(USE_PVQA_LIBRARY)
# include "pvqa++.h"
#endif
class AgentImpl: public UserAgent class AgentImpl: public UserAgent
#if defined(USE_AQUA_LIBRARY)
, public MT::Stream::MediaObserver
#endif
{ {
protected: protected:
std::recursive_mutex mAgentMutex; std::recursive_mutex mAgentMutex;

View File

@ -185,6 +185,7 @@ void RtpDump::flush()
#endif #endif
#ifndef EXTERNAL_MEDIA_STREAM_ID
// -------------- MediaStreamId -------------------- // -------------- MediaStreamId --------------------
bool MediaStreamId::operator < (const MediaStreamId& right) const bool MediaStreamId::operator < (const MediaStreamId& right) const
{ {
@ -260,4 +261,5 @@ std::ostream& operator << (std::ostream& output, const MediaStreamId& id)
{ {
return (output << id.toString()); return (output << id.toString());
} }
#endif

View File

@ -72,22 +72,5 @@ public:
}; };
#endif #endif
struct MediaStreamId
{
InternetAddress mSource;
InternetAddress mDestination;
uint32_t mSSRC = 0;
bool mSsrcIsId = true;
Uuid mLinkId;
bool operator < (const MediaStreamId& s2) const;
bool operator == (const MediaStreamId& right) const;
std::string toString() const;
std::string getDetectDescription() const;
std::string getFinishDescription() const;
MediaStreamId& operator = (const MediaStreamId& src);
};
std::ostream& operator << (std::ostream& output, const MediaStreamId& id);
#endif #endif

View File

@ -80,6 +80,10 @@ if (CMAKE_SYSTEM MATCHES "Windows*")
endif() endif()
add_library(media_lib ${SOURCES}) add_library(media_lib ${SOURCES})
# Dependency on ice_stack - Linux build requires it
target_link_libraries(media_lib ice_stack)
set_property(TARGET media_lib PROPERTY set_property(TARGET media_lib PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
@ -101,6 +105,7 @@ target_include_directories(media_lib
${CMAKE_CURRENT_SOURCE_DIR}/../../libs/libevs/basic_op ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/libevs/basic_op
${CMAKE_CURRENT_SOURCE_DIR}/../../libs/libevs/basic_math ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/libevs/basic_math
) )
if (USE_RESIP_INTEGRATION) if (USE_RESIP_INTEGRATION)
message("USE_RESIP_INTEGRATION is turned on!") message("USE_RESIP_INTEGRATION is turned on!")
target_compile_definitions(media_lib PUBLIC -DUSE_RESIP_INTEGRATION) target_compile_definitions(media_lib PUBLIC -DUSE_RESIP_INTEGRATION)

View File

@ -20,9 +20,9 @@
#include "../audio/Audio_DataWindow.h" #include "../audio/Audio_DataWindow.h"
#include "../audio/Audio_Resampler.h" #include "../audio/Audio_Resampler.h"
#if defined(USE_PVQA_LIBRARY) /*#if defined(USE_PVQA_LIBRARY)
# include "pvqa++.h" # include "pvqa++.h"
#endif #endif*/
#include <map> #include <map>
@ -199,6 +199,7 @@ namespace MT
// Resamples, sends to analysis, writes to dump and queues to output decoded frames from mDecodedFrame // Resamples, sends to analysis, writes to dump and queues to output decoded frames from mDecodedFrame
void processDecoded(Audio::DataWindow& output, int options); void processDecoded(Audio::DataWindow& output, int options);
/*
#if defined(USE_PVQA_LIBRARY) && defined(PVQA_IN_RECEIVER) #if defined(USE_PVQA_LIBRARY) && defined(PVQA_IN_RECEIVER)
std::shared_ptr<sevana::pvqa> mPVQA; std::shared_ptr<sevana::pvqa> mPVQA;
void initPvqa(); void initPvqa();
@ -207,7 +208,7 @@ namespace MT
std::shared_ptr<Audio::DataWindow> mPvqaBuffer; std::shared_ptr<Audio::DataWindow> mPvqaBuffer;
#endif #endif
*/
void processStatisticsWithAmrCodec(Codec* c); void processStatisticsWithAmrCodec(Codec* c);
}; };

View File

@ -1,4 +1,4 @@
/* Copyright(C) 2007-2021 VoIPobjects (voipobjects.com) /* Copyright(C) 2007-2022 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/. */

View File

@ -67,7 +67,7 @@ void JitterStatistics::process(jrtplib::RTPPacket* packet, int rate)
Statistics::Statistics() Statistics::Statistics()
:mReceived(0), mSent(0), mReceivedRtp(0), mSentRtp(0), :mReceived(0), mSent(0), mReceivedRtp(0), mSentRtp(0),
mReceivedRtcp(0), mSentRtcp(0), mDuplicatedRtp(0), mOldRtp(0), mIllegalRtp(0), mReceivedRtcp(0), mSentRtcp(0), mDuplicatedRtp(0), mOldRtp(0), mIllegalRtp(0),
mPacketLoss(0), mJitter(0.0), mAudioTime(0), mSsrc(0), mPacketDropped(0) mPacketLoss(0), mJitter(0.0), mAudioTime(0), mDecodedSize(0), mSsrc(0), mPacketDropped(0)
{ {
mBitrateSwitchCounter = 0; mBitrateSwitchCounter = 0;
memset(mLoss, 0, sizeof mLoss); memset(mLoss, 0, sizeof mLoss);
@ -95,6 +95,7 @@ void Statistics::reset()
mJitter = 0.0; mJitter = 0.0;
mAudioTime = 0; mAudioTime = 0;
mPacketDropped = 0; mPacketDropped = 0;
mDecodedSize = 0;
memset(mLoss, 0, sizeof mLoss); memset(mLoss, 0, sizeof mLoss);
} }

View File

@ -69,6 +69,7 @@ public:
int mLoss[128]; // Every item is number of loss of corresping length int mLoss[128]; // Every item is number of loss of corresping length
size_t mAudioTime; // Decoded/found time in milliseconds size_t mAudioTime; // Decoded/found time in milliseconds
size_t mDecodedSize; // Number of decoded bytes
uint16_t mSsrc; // Last known SSRC ID in a RTP stream uint16_t mSsrc; // Last known SSRC ID in a RTP stream
ice::NetworkAddress mRemotePeer; // Last known remote RTP address ice::NetworkAddress mRemotePeer; // Last known remote RTP address

View File

@ -91,6 +91,8 @@ set(JRTPLIB_SOURCES
rtpexternaltransmitter.cpp) rtpexternaltransmitter.cpp)
add_library(jrtplib STATIC ${JRTPLIB_SOURCES}) add_library(jrtplib STATIC ${JRTPLIB_SOURCES})
target_include_directories(jrtplib PUBLIC .)
set_property(TARGET jrtplib PROPERTY set_property(TARGET jrtplib PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

View File

@ -20,7 +20,7 @@ set (SPEEXDSP_SOURCES
) )
add_library(speexdsp ${SPEEXDSP_SOURCES}) add_library(speexdsp ${SPEEXDSP_SOURCES})
target_compile_definitions(speexdsp PUBLIC -DUSE_KISS_FFT -DFIXED_POINT -DHAVE_STDINT_H) target_compile_definitions(speexdsp PUBLIC -DUSE_KISS_FFT -DFLOATING_POINT -DHAVE_STDINT_H)
target_include_directories(speexdsp PUBLIC target_include_directories(speexdsp PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/libspeexdsp ${CMAKE_CURRENT_SOURCE_DIR}/libspeexdsp