- 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;
}
// Set the initial receive mode
sources.AcceptAllSSRC(sessparams.GetAcceptAllSSRC());
// Set the initial receive mode
if ((status = rtptrans->SetReceiveMode(sessparams.GetReceiveMode())) < 0)
{
packetbuilder.Destroy();

View File

@ -47,6 +47,7 @@ RTPSessionParams::RTPSessionParams() : mininterval(0,0)
#else
usepollthread = false;
#endif // RTP_SUPPORT_THREAD
acceptallssrc = false;
maxpacksize = RTP_DEFAULTPACKETSIZE;
receivemode = RTPTransmitter::AcceptAll;
acceptown = false;

View File

@ -70,6 +70,10 @@ public:
/** Returns the maximum allowed packet size (default is 1400 bytes). */
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
* 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). */
std::string GetCNAME() const { return cname; }
private:
bool acceptallssrc;
bool acceptown;
bool usepollthread;
size_t maxpacksize;

View File

@ -60,6 +60,8 @@ RTPSources::RTPSources(ProbationType probtype,RTPMemoryManager *mgr) : RTPMemory
sendercount = 0;
activecount = 0;
owndata = 0;
acceptallssrc = false;
#ifdef RTP_SUPPORT_PROBATION
probationtype = probtype;
#endif // RTP_SUPPORT_PROBATION
@ -393,7 +395,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const
int num = p->GetReceptionReportCount();
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;
status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i),
@ -425,7 +427,7 @@ int RTPSources::ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack,const
int num = p->GetReceptionReportCount();
for (i = 0 ; i < num ; i++)
{
if (p->GetSSRC(i) == ownssrc)
if (p->GetSSRC(i) == ownssrc || acceptallssrc)
{
gotinfo = true;
status = ProcessRTCPReportBlock(senderssrc,p->GetFractionLost(i),p->GetLostPacketCount(i),

View File

@ -99,6 +99,9 @@ public:
/** Deletes the entry for our own SSRC identifier. */
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.
* 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;
bool acceptallssrc;
int sendercount;
int totalcount;
int activecount;