From 17e17d3d79dfb2c87b793e2bc6c8460fe96fb2ef Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Tue, 14 Jun 2022 18:36:22 +0300 Subject: [PATCH] - work to move Sevana specific parts to corresponding project (PVQA server and PVQA RTP library) --- src/engine/helper/HL_Rtp.cpp | 77 ----------------------------- src/engine/helper/HL_Rtp.h | 18 ------- src/engine/media/MT_Statistics.cpp | 7 +-- src/engine/media/MT_Statistics.h | 10 ++-- src/libs/jrtplib/src/CMakeLists.txt | 2 +- src/libs/jrtplib/src/rtppacket.h | 2 +- src/libs/speexdsp/CMakeLists.txt | 2 +- 7 files changed, 13 insertions(+), 105 deletions(-) diff --git a/src/engine/helper/HL_Rtp.cpp b/src/engine/helper/HL_Rtp.cpp index ec09814c..000d9b92 100644 --- a/src/engine/helper/HL_Rtp.cpp +++ b/src/engine/helper/HL_Rtp.cpp @@ -184,80 +184,3 @@ void RtpDump::flush() } #endif - -// -------------- MediaStreamId -------------------- -bool MediaStreamId::operator < (const MediaStreamId& right) const -{ - if (mSsrcIsId) - return std::tie(mSSRC, mSource, mDestination) < std::tie(right.mSSRC, right.mSource, right.mDestination); - else - return std::tie(mSource, mDestination) < std::tie(right.mSource, right.mDestination); - -} - -bool MediaStreamId::operator == (const MediaStreamId& right) const -{ - if (mSsrcIsId) - return std::tie(mSSRC, mSource, mDestination) == std::tie(right.mSSRC, right.mSource, right.mDestination); - else - return std::tie(mSource, mDestination) == std::tie(right.mSource, right.mDestination); -} - -std::string MediaStreamId::toString() const -{ - std::ostringstream oss; - oss << "src: " << mSource.toStdString() << - " dst: " << mDestination.toStdString() << - " ssrc: " << StringHelper::toHex(mSSRC); - return oss.str(); -} - - -void writeToJson(const MediaStreamId& id, std::ostringstream& oss) -{ - oss << " \"src\": \"" << id.mSource.toStdString() << "\"," << std::endl - << " \"dst\": \"" << id.mDestination.toStdString() << "\"," << std::endl - << " \"ssrc\": \"" << StringHelper::toHex(id.mSSRC) << "\"," << std::endl -#if !defined(USE_NULL_UUID) - << " \"link_id\": \"" << id.mLinkId.toString() << "\"" << std::endl -#endif - ; -} - -std::string MediaStreamId::getDetectDescription() const -{ - std::ostringstream oss; - oss << "{\"event\": \"stream_detected\"," << std::endl; - writeToJson(*this, oss); - oss << "}"; - - return oss.str(); -} - -std::string MediaStreamId::getFinishDescription() const -{ - std::ostringstream oss; - oss << "{" << std::endl - << " \"event\": \"stream_finished\", " << std::endl; - writeToJson(*this, oss); - oss << "}"; - - return oss.str(); -} - -MediaStreamId& MediaStreamId::operator = (const MediaStreamId& src) -{ - this->mDestination = src.mDestination; - this->mSource = src.mSource; - this->mLinkId = src.mLinkId; - this->mSSRC = src.mSSRC; - this->mSsrcIsId = src.mSsrcIsId; - - return *this; -} - -std::ostream& operator << (std::ostream& output, const MediaStreamId& id) -{ - return (output << id.toString()); -} - diff --git a/src/engine/helper/HL_Rtp.h b/src/engine/helper/HL_Rtp.h index 8df1f3b5..30aee94c 100644 --- a/src/engine/helper/HL_Rtp.h +++ b/src/engine/helper/HL_Rtp.h @@ -72,22 +72,4 @@ public: }; #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 diff --git a/src/engine/media/MT_Statistics.cpp b/src/engine/media/MT_Statistics.cpp index acad1e07..aaee0feb 100644 --- a/src/engine/media/MT_Statistics.cpp +++ b/src/engine/media/MT_Statistics.cpp @@ -67,7 +67,7 @@ void JitterStatistics::process(jrtplib::RTPPacket* packet, int rate) Statistics::Statistics() :mReceived(0), mSent(0), mReceivedRtp(0), mSentRtp(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), mSsrc(0), mPacketDropped(0), mDecodedAudio(0) { mBitrateSwitchCounter = 0; memset(mLoss, 0, sizeof mLoss); @@ -95,7 +95,7 @@ void Statistics::reset() mJitter = 0.0; mAudioTime = 0; mPacketDropped = 0; - + mDecodedAudio = 0; memset(mLoss, 0, sizeof mLoss); } @@ -179,7 +179,7 @@ Statistics& Statistics::operator += (const Statistics& src) mPacketLoss += src.mPacketLoss; mPacketDropped += src.mPacketDropped; mAudioTime += src.mAudioTime; - + mDecodedAudio += src.mDecodedAudio; for (auto codecStat: src.mCodecCount) { @@ -230,6 +230,7 @@ Statistics& Statistics::operator -= (const Statistics& src) mOldRtp -= src.mOldRtp; mPacketLoss -= src.mPacketLoss; mPacketDropped -= src.mPacketDropped; + mDecodedAudio -= src.mDecodedAudio; mAudioTime -= src.mAudioTime; for (auto codecStat: src.mCodecCount) diff --git a/src/engine/media/MT_Statistics.h b/src/engine/media/MT_Statistics.h index b5c054ac..cc3a61a2 100644 --- a/src/engine/media/MT_Statistics.h +++ b/src/engine/media/MT_Statistics.h @@ -63,6 +63,8 @@ public: mPacketDropped, // Number of dropped packets (due to time unsync when playing)б mIllegalRtp; // Number of rtp packets with bad payload type + size_t mDecodedAudio; // Size of decoded audio bytes + TestResult mDecodingInterval, // Average interval on call to packet decode mDecodeRequested, // Average amount of requested audio frames to play mPacketInterval; // Average interval between packet adding to jitter buffer @@ -98,10 +100,10 @@ public: Statistics& operator -= (const Statistics& src); float mNetworkMos = 0.0; -#if defined(USE_PVQA_LIBRARY) && !defined(PVQA_SERVER) - float mPvqaMos = 0.0; - std::string mPvqaReport; -#endif +// #if defined(USE_PVQA_LIBRARY) && !defined(PVQA_SERVER) + // float mPvqaMos = 0.0; + //std::string mPvqaReport; +// #endif std::string toString() const; }; diff --git a/src/libs/jrtplib/src/CMakeLists.txt b/src/libs/jrtplib/src/CMakeLists.txt index a6e5b86d..b8261d66 100644 --- a/src/libs/jrtplib/src/CMakeLists.txt +++ b/src/libs/jrtplib/src/CMakeLists.txt @@ -91,4 +91,4 @@ set(JRTPLIB_SOURCES rtpexternaltransmitter.cpp) add_library(jrtplib STATIC ${JRTPLIB_SOURCES}) - +target_include_directories(jrtplib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/libs/jrtplib/src/rtppacket.h b/src/libs/jrtplib/src/rtppacket.h index 74060b20..5c6cd7bc 100644 --- a/src/libs/jrtplib/src/rtppacket.h +++ b/src/libs/jrtplib/src/rtppacket.h @@ -131,7 +131,7 @@ public: /** Returns the payload length. */ size_t GetPayloadLength() const { return payloadlength; } - void SetPayloadLength(size_t l) { payloadlength = l; } + void SetPayloadLength(size_t l) { payloadlength = l; } /** If a header extension is present, this function returns the extension identifier. */ uint16_t GetExtensionID() const { return extid; } diff --git a/src/libs/speexdsp/CMakeLists.txt b/src/libs/speexdsp/CMakeLists.txt index 129b6f9d..b7b37fd5 100644 --- a/src/libs/speexdsp/CMakeLists.txt +++ b/src/libs/speexdsp/CMakeLists.txt @@ -20,7 +20,7 @@ set (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 ${CMAKE_CURRENT_SOURCE_DIR}/libspeexdsp