- allow usage of jrtplib as network analyzer (accept alien SSRC packets as own ones when calculating the RTT delay)

This commit is contained in:
Dmytro Bogovych 2023-04-12 13:10:16 +03:00
parent bb48e1a777
commit 4f1486b257
5 changed files with 18 additions and 5 deletions

View File

@ -221,8 +221,9 @@ int RTPSession::InternalCreate(const RTPSessionParams &sessparams)
return status; return status;
} }
sources.AcceptAllSSRC(sessparams.GetAcceptAllSSRC());
// Set the initial receive mode // Set the initial receive mode
if ((status = rtptrans->SetReceiveMode(sessparams.GetReceiveMode())) < 0) if ((status = rtptrans->SetReceiveMode(sessparams.GetReceiveMode())) < 0)
{ {
packetbuilder.Destroy(); packetbuilder.Destroy();

View File

@ -47,7 +47,8 @@ RTPSessionParams::RTPSessionParams() : mininterval(0,0)
#else #else
usepollthread = false; usepollthread = false;
#endif // RTP_SUPPORT_THREAD #endif // RTP_SUPPORT_THREAD
maxpacksize = RTP_DEFAULTPACKETSIZE; acceptallssrc = false;
maxpacksize = RTP_DEFAULTPACKETSIZE;
receivemode = RTPTransmitter::AcceptAll; receivemode = RTPTransmitter::AcceptAll;
acceptown = false; acceptown = false;
owntsunit = -1; // The user will have to set it to the correct value himself owntsunit = -1; // The user will have to set it to the correct value himself

View File

@ -70,6 +70,10 @@ public:
/** Returns the maximum allowed packet size (default is 1400 bytes). */ /** Returns the maximum allowed packet size (default is 1400 bytes). */
size_t GetMaximumPacketSize() const { return maxpacksize; } size_t GetMaximumPacketSize() const { return maxpacksize; }
// Accept packets with any SSRC when using as delay calculator - for network analyzer project
void SetAcceptAllSSRC(bool accept) { acceptallssrc = accept; }
bool GetAcceptAllSSRC() const { return acceptallssrc; }
/** If the argument is \c true, the session should accept its own packets and store /** If the argument is \c true, the session should accept its own packets and store
* them accordingly in the source table. * them accordingly in the source table.
*/ */
@ -212,6 +216,7 @@ public:
/** Returns the currently set CNAME, is blank when this will be generated automatically (the default). */ /** Returns the currently set CNAME, is blank when this will be generated automatically (the default). */
std::string GetCNAME() const { return cname; } std::string GetCNAME() const { return cname; }
private: private:
bool acceptallssrc;
bool acceptown; bool acceptown;
bool usepollthread; bool usepollthread;
size_t maxpacksize; size_t maxpacksize;

View File

@ -60,6 +60,8 @@ RTPSources::RTPSources(ProbationType probtype,RTPMemoryManager *mgr) : RTPMemory
sendercount = 0; sendercount = 0;
activecount = 0; activecount = 0;
owndata = 0; owndata = 0;
acceptallssrc = false;
#ifdef RTP_SUPPORT_PROBATION #ifdef RTP_SUPPORT_PROBATION
probationtype = probtype; probationtype = probtype;
#endif // RTP_SUPPORT_PROBATION #endif // RTP_SUPPORT_PROBATION
@ -109,7 +111,7 @@ int RTPSources::CreateOwnSSRC(uint32_t ssrc)
owndata = 0; // just to make sure owndata = 0; // just to make sure
return status; return status;
} }
owndata->SetOwnSSRC(); owndata->SetOwnSSRC();
owndata->SetRTPDataAddress(0); owndata->SetRTPDataAddress(0);
owndata->SetRTCPDataAddress(0); owndata->SetRTCPDataAddress(0);
@ -393,7 +395,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const
int num = p->GetReceptionReportCount(); int num = p->GetReceptionReportCount();
for (i = 0 ; i < num ; i++) for (i = 0 ; i < num ; i++)
{ {
if (p->GetSSRC(i) == ownssrc) // data is meant for us if (p->GetSSRC(i) == ownssrc || acceptallssrc) // data is meant for us
{ {
gotinfo = true; gotinfo = true;
status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i), status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i),
@ -425,7 +427,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const
int num = p->GetReceptionReportCount(); int num = p->GetReceptionReportCount();
for (i = 0 ; i < num ; i++) for (i = 0 ; i < num ; i++)
{ {
if (p->GetSSRC(i) == ownssrc) if (p->GetSSRC(i) == ownssrc || acceptallssrc)
{ {
gotinfo = true; gotinfo = true;
status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i), status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i),

View File

@ -99,6 +99,9 @@ public:
/** Deletes the entry for our own SSRC identifier. */ /** Deletes the entry for our own SSRC identifier. */
int DeleteOwnSSRC(); int DeleteOwnSSRC();
/** This is needed to allow accept RR when running as delay calculator in network analyzer project **/
void AcceptAllSSRC(bool accept) { acceptallssrc = accept; }
/** This function should be called if our own session has sent an RTP packet. /** This function should be called if our own session has sent an RTP packet.
* This function should be called if our own session has sent an RTP packet. * This function should be called if our own session has sent an RTP packet.
* For our own SSRC entry, the sender flag is updated based upon outgoing packets instead of incoming packets. * For our own SSRC entry, the sender flag is updated based upon outgoing packets instead of incoming packets.
@ -352,6 +355,7 @@ private:
RTPKeyHashTable<const uint32_t,RTPInternalSourceData*,RTPSources_GetHashIndex,RTPSOURCES_HASHSIZE> sourcelist; RTPKeyHashTable<const uint32_t,RTPInternalSourceData*,RTPSources_GetHashIndex,RTPSOURCES_HASHSIZE> sourcelist;
bool acceptallssrc;
int sendercount; int sendercount;
int totalcount; int totalcount;
int activecount; int activecount;