Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
e342abe2f5 | |
|
|
9d79c01be0 | |
|
|
fa705e141b | |
|
|
17e17d3d79 |
|
|
@ -184,80 +184,3 @@ void RtpDump::flush()
|
||||||
}
|
}
|
||||||
#endif
|
#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());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,22 +72,4 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ if (CMAKE_SYSTEM MATCHES "Windows*")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(media_lib ${SOURCES})
|
add_library(media_lib ${SOURCES})
|
||||||
|
# Depending on ice stack library to provide bit level operations
|
||||||
|
target_link_libraries(media_lib PUBLIC ice_stack)
|
||||||
|
|
||||||
target_include_directories(media_lib
|
target_include_directories(media_lib
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/
|
||||||
|
|
|
||||||
|
|
@ -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), mSsrc(0), mPacketDropped(0), mDecodedAudio(0)
|
||||||
{
|
{
|
||||||
mBitrateSwitchCounter = 0;
|
mBitrateSwitchCounter = 0;
|
||||||
memset(mLoss, 0, sizeof mLoss);
|
memset(mLoss, 0, sizeof mLoss);
|
||||||
|
|
@ -95,7 +95,7 @@ void Statistics::reset()
|
||||||
mJitter = 0.0;
|
mJitter = 0.0;
|
||||||
mAudioTime = 0;
|
mAudioTime = 0;
|
||||||
mPacketDropped = 0;
|
mPacketDropped = 0;
|
||||||
|
mDecodedAudio = 0;
|
||||||
memset(mLoss, 0, sizeof mLoss);
|
memset(mLoss, 0, sizeof mLoss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ Statistics& Statistics::operator += (const Statistics& src)
|
||||||
mPacketLoss += src.mPacketLoss;
|
mPacketLoss += src.mPacketLoss;
|
||||||
mPacketDropped += src.mPacketDropped;
|
mPacketDropped += src.mPacketDropped;
|
||||||
mAudioTime += src.mAudioTime;
|
mAudioTime += src.mAudioTime;
|
||||||
|
mDecodedAudio += src.mDecodedAudio;
|
||||||
|
|
||||||
for (auto codecStat: src.mCodecCount)
|
for (auto codecStat: src.mCodecCount)
|
||||||
{
|
{
|
||||||
|
|
@ -230,6 +230,7 @@ Statistics& Statistics::operator -= (const Statistics& src)
|
||||||
mOldRtp -= src.mOldRtp;
|
mOldRtp -= src.mOldRtp;
|
||||||
mPacketLoss -= src.mPacketLoss;
|
mPacketLoss -= src.mPacketLoss;
|
||||||
mPacketDropped -= src.mPacketDropped;
|
mPacketDropped -= src.mPacketDropped;
|
||||||
|
mDecodedAudio -= src.mDecodedAudio;
|
||||||
|
|
||||||
mAudioTime -= src.mAudioTime;
|
mAudioTime -= src.mAudioTime;
|
||||||
for (auto codecStat: src.mCodecCount)
|
for (auto codecStat: src.mCodecCount)
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ public:
|
||||||
mPacketDropped, // Number of dropped packets (due to time unsync when playing)б
|
mPacketDropped, // Number of dropped packets (due to time unsync when playing)б
|
||||||
mIllegalRtp; // Number of rtp packets with bad payload type
|
mIllegalRtp; // Number of rtp packets with bad payload type
|
||||||
|
|
||||||
|
size_t mDecodedAudio; // Size of decoded audio bytes
|
||||||
|
|
||||||
TestResult<float> mDecodingInterval, // Average interval on call to packet decode
|
TestResult<float> mDecodingInterval, // Average interval on call to packet decode
|
||||||
mDecodeRequested, // Average amount of requested audio frames to play
|
mDecodeRequested, // Average amount of requested audio frames to play
|
||||||
mPacketInterval; // Average interval between packet adding to jitter buffer
|
mPacketInterval; // Average interval between packet adding to jitter buffer
|
||||||
|
|
@ -98,10 +100,10 @@ public:
|
||||||
Statistics& operator -= (const Statistics& src);
|
Statistics& operator -= (const Statistics& src);
|
||||||
|
|
||||||
float mNetworkMos = 0.0;
|
float mNetworkMos = 0.0;
|
||||||
#if defined(USE_PVQA_LIBRARY) && !defined(PVQA_SERVER)
|
// #if defined(USE_PVQA_LIBRARY) && !defined(PVQA_SERVER)
|
||||||
float mPvqaMos = 0.0;
|
// float mPvqaMos = 0.0;
|
||||||
std::string mPvqaReport;
|
//std::string mPvqaReport;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,6 @@ void Logger::beginLine(LogLevel level, const char* filename, int linenumber, con
|
||||||
void
|
void
|
||||||
Logger::endLine()
|
Logger::endLine()
|
||||||
{
|
{
|
||||||
*mStream << std::endl;
|
|
||||||
*mStream << std::flush;
|
*mStream << std::flush;
|
||||||
mStream->flush();
|
mStream->flush();
|
||||||
|
|
||||||
|
|
@ -213,7 +212,7 @@ Logger::endLine()
|
||||||
|
|
||||||
result << time_buffer << ":" << (unix_timestamp_ms.count() % 1000 ) << "\t" << " | " << std::setw(8) << ThreadInfo::currentThread() << " | " << std::setw(30)
|
result << time_buffer << ":" << (unix_timestamp_ms.count() % 1000 ) << "\t" << " | " << std::setw(8) << ThreadInfo::currentThread() << " | " << std::setw(30)
|
||||||
<< mFilename.c_str() << " | " << std::setw(4) << mLine << " | " << std::setw(12) << mSubsystem.c_str() << " | "
|
<< mFilename.c_str() << " | " << std::setw(4) << mLine << " | " << std::setw(12) << mSubsystem.c_str() << " | "
|
||||||
<< mStream->str().c_str();
|
<< mStream->str().c_str() << std::endl;
|
||||||
|
|
||||||
std::string t = result.str();
|
std::string t = result.str();
|
||||||
if (mUseDebugWindow) {
|
if (mUseDebugWindow) {
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,14 @@ protected:
|
||||||
class LogLock
|
class LogLock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LogLock(LogGuard& g) :mGuard(g) { mGuard.Lock(); }
|
LogLock(LogGuard& g) :mGuard(g)
|
||||||
~LogLock() { mGuard.Unlock(); }
|
{
|
||||||
|
mGuard.Lock();
|
||||||
|
}
|
||||||
|
~LogLock()
|
||||||
|
{
|
||||||
|
mGuard.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LogGuard& mGuard;
|
LogGuard& mGuard;
|
||||||
|
|
|
||||||
|
|
@ -91,4 +91,4 @@ set(JRTPLIB_SOURCES
|
||||||
rtpexternaltransmitter.cpp)
|
rtpexternaltransmitter.cpp)
|
||||||
|
|
||||||
add_library(jrtplib STATIC ${JRTPLIB_SOURCES})
|
add_library(jrtplib STATIC ${JRTPLIB_SOURCES})
|
||||||
|
target_include_directories(jrtplib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@
|
||||||
#include "rtperrors.h"
|
#include "rtperrors.h"
|
||||||
#include "rtprawpacket.h"
|
#include "rtprawpacket.h"
|
||||||
#if ! (defined(WIN32) || defined(_WIN32_WCE))
|
#if ! (defined(WIN32) || defined(_WIN32_WCE))
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
#ifdef RTPDEBUG
|
#ifdef RTPDEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif // RTPDEBUG
|
#endif // RTPDEBUG
|
||||||
|
|
||||||
#include "rtpdebug.h"
|
#include "rtpdebug.h"
|
||||||
|
|
@ -152,6 +152,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||||
|
|
||||||
csrccount = rtpheader->csrccount;
|
csrccount = rtpheader->csrccount;
|
||||||
payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(uint32_t));
|
payloadoffset = sizeof(RTPHeader)+(int)(csrccount*sizeof(uint32_t));
|
||||||
|
if ((size_t)payloadoffset > packetlen)
|
||||||
|
return ERR_RTP_PACKET_INVALIDPACKET;
|
||||||
|
|
||||||
if (rtpheader->padding) // adjust payload length to take padding into account
|
if (rtpheader->padding) // adjust payload length to take padding into account
|
||||||
{
|
{
|
||||||
|
|
@ -167,6 +169,8 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||||
{
|
{
|
||||||
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
||||||
payloadoffset += sizeof(RTPExtensionHeader);
|
payloadoffset += sizeof(RTPExtensionHeader);
|
||||||
|
if ((size_t)payloadoffset > packetlen)
|
||||||
|
return ERR_RTP_PACKET_INVALIDPACKET;
|
||||||
exthdrlen = ntohs(rtpextheader->length);
|
exthdrlen = ntohs(rtpextheader->length);
|
||||||
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue