Compare commits
No commits in common. "e342abe2f57646bcdb287a8dba23b9f200261639" and "c3c59ddf03b60a2a09657b7b0a5e2b85f0d51171" have entirely different histories.
e342abe2f5
...
c3c59ddf03
|
|
@ -184,3 +184,80 @@ 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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,4 +72,22 @@ 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
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@ if (CMAKE_SYSTEM MATCHES "Windows*")
|
|||
endif()
|
||||
|
||||
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
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/
|
||||
|
|
|
|||
|
|
@ -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), mDecodedAudio(0)
|
||||
mPacketLoss(0), mJitter(0.0), mAudioTime(0), mSsrc(0), mPacketDropped(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,7 +230,6 @@ 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)
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ 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<float> 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
|
||||
|
|
@ -100,10 +98,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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ void Logger::beginLine(LogLevel level, const char* filename, int linenumber, con
|
|||
void
|
||||
Logger::endLine()
|
||||
{
|
||||
*mStream << std::endl;
|
||||
*mStream << std::flush;
|
||||
mStream->flush();
|
||||
|
||||
|
|
@ -212,7 +213,7 @@ Logger::endLine()
|
|||
|
||||
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() << " | "
|
||||
<< mStream->str().c_str() << std::endl;
|
||||
<< mStream->str().c_str();
|
||||
|
||||
std::string t = result.str();
|
||||
if (mUseDebugWindow) {
|
||||
|
|
|
|||
|
|
@ -86,14 +86,8 @@ protected:
|
|||
class LogLock
|
||||
{
|
||||
public:
|
||||
LogLock(LogGuard& g) :mGuard(g)
|
||||
{
|
||||
mGuard.Lock();
|
||||
}
|
||||
~LogLock()
|
||||
{
|
||||
mGuard.Unlock();
|
||||
}
|
||||
LogLock(LogGuard& g) :mGuard(g) { mGuard.Lock(); }
|
||||
~LogLock() { mGuard.Unlock(); }
|
||||
|
||||
protected:
|
||||
LogGuard& mGuard;
|
||||
|
|
|
|||
|
|
@ -91,4 +91,4 @@ set(JRTPLIB_SOURCES
|
|||
rtpexternaltransmitter.cpp)
|
||||
|
||||
add_library(jrtplib STATIC ${JRTPLIB_SOURCES})
|
||||
target_include_directories(jrtplib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
|
|
|||
|
|
@ -152,8 +152,6 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
|||
|
||||
csrccount = rtpheader->csrccount;
|
||||
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
|
||||
{
|
||||
|
|
@ -169,8 +167,6 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
|||
{
|
||||
rtpextheader = (RTPExtensionHeader *)(packetbytes+payloadoffset);
|
||||
payloadoffset += sizeof(RTPExtensionHeader);
|
||||
if ((size_t)payloadoffset > packetlen)
|
||||
return ERR_RTP_PACKET_INVALIDPACKET;
|
||||
exthdrlen = ntohs(rtpextheader->length);
|
||||
payloadoffset += ((int)exthdrlen)*sizeof(uint32_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ set (SPEEXDSP_SOURCES
|
|||
)
|
||||
|
||||
add_library(speexdsp ${SPEEXDSP_SOURCES})
|
||||
target_compile_definitions(speexdsp PUBLIC -DUSE_KISS_FFT -DFLOATING_POINT -DHAVE_STDINT_H)
|
||||
target_compile_definitions(speexdsp PUBLIC -DUSE_KISS_FFT -DFIXED_POINT -DHAVE_STDINT_H)
|
||||
|
||||
target_include_directories(speexdsp PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libspeexdsp
|
||||
|
|
|
|||
Loading…
Reference in New Issue