mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-31 05:02:24 -04:00
qrtplib: removed probation support
This commit is contained in:
parent
b8c50eb798
commit
92bc10efe6
@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
#define RTP_SUPPORT_SDESPRIV
|
#define RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
#define RTP_SUPPORT_PROBATION
|
// No #define RTP_SUPPORT_PROBATION
|
||||||
|
|
||||||
#define RTP_SUPPORT_GETLOGINR
|
#define RTP_SUPPORT_GETLOGINR
|
||||||
|
|
||||||
|
@ -39,13 +39,9 @@
|
|||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTPInternalSourceData::RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype) :
|
RTPInternalSourceData::RTPInternalSourceData(uint32_t ssrc) :
|
||||||
RTPSourceData(ssrc)
|
RTPSourceData(ssrc)
|
||||||
{
|
{
|
||||||
JRTPLIB_UNUSED(probtype); // possibly unused
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
probationtype = probtype;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPInternalSourceData::~RTPInternalSourceData()
|
RTPInternalSourceData::~RTPInternalSourceData()
|
||||||
@ -65,45 +61,13 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &r
|
|||||||
else
|
else
|
||||||
tsunit = timestampunit;
|
tsunit = timestampunit;
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
if (validated) // If the source is our own process, we can already be validated. No
|
|
||||||
applyprobation = false; // probation should be applied in that case.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (probationtype == RTPSources::NoProbation)
|
|
||||||
applyprobation = false;
|
|
||||||
else
|
|
||||||
applyprobation = true;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
applyprobation = false;
|
applyprobation = false;
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
stats.ProcessPacket(rtppack, receivetime, tsunit, ownssrc, &accept, applyprobation, &onprobation);
|
stats.ProcessPacket(rtppack, receivetime, tsunit, ownssrc, &accept, applyprobation, &onprobation);
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
switch (probationtype)
|
|
||||||
{
|
|
||||||
case RTPSources::ProbationStore:
|
|
||||||
if (!(onprobation || accept))
|
|
||||||
return 0;
|
|
||||||
if (accept)
|
|
||||||
validated = true;
|
|
||||||
break;
|
|
||||||
case RTPSources::ProbationDiscard:
|
|
||||||
case RTPSources::NoProbation:
|
|
||||||
if (!accept)
|
|
||||||
return 0;
|
|
||||||
validated = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return ERR_RTP_INTERNALSOURCEDATA_INVALIDPROBATIONTYPE;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (!accept)
|
if (!accept)
|
||||||
return 0;
|
return 0;
|
||||||
validated = true;
|
validated = true;
|
||||||
#endif // RTP_SUPPORT_PROBATION;
|
|
||||||
|
|
||||||
if (validated && !ownssrc) // for own ssrc these variables depend on the outgoing packets, not on the incoming
|
if (validated && !ownssrc) // for own ssrc these variables depend on the outgoing packets, not on the incoming
|
||||||
issender = true;
|
issender = true;
|
||||||
|
@ -50,7 +50,7 @@ namespace qrtplib
|
|||||||
class RTPInternalSourceData: public RTPSourceData
|
class RTPInternalSourceData: public RTPSourceData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype);
|
RTPInternalSourceData(uint32_t ssrc);
|
||||||
~RTPInternalSourceData();
|
~RTPInternalSourceData();
|
||||||
|
|
||||||
int ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &receivetime, bool *stored, RTPSources *sources);
|
int ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &receivetime, bool *stored, RTPSources *sources);
|
||||||
@ -107,10 +107,6 @@ public:
|
|||||||
SDESinf.SetNote(0, 0);
|
SDESinf.SetNote(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
private:
|
|
||||||
RTPSources::ProbationType probationtype;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int RTPInternalSourceData::SetRTPDataAddress(const RTPAddress *a)
|
inline int RTPInternalSourceData::SetRTPDataAddress(const RTPAddress *a)
|
||||||
|
@ -193,13 +193,6 @@ int RTPSession::InternalCreate(const RTPSessionParams &sessparams)
|
|||||||
if (sessparams.GetUsePredefinedSSRC())
|
if (sessparams.GetUsePredefinedSSRC())
|
||||||
packetbuilder.AdjustSSRC(sessparams.GetPredefinedSSRC());
|
packetbuilder.AdjustSSRC(sessparams.GetPredefinedSSRC());
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
// Set probation type
|
|
||||||
sources.SetProbationType(sessparams.GetProbationType());
|
|
||||||
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
// Add our own ssrc to the source table
|
// Add our own ssrc to the source table
|
||||||
|
|
||||||
if ((status = sources.CreateOwnSSRC(packetbuilder.GetSSRC())) < 0)
|
if ((status = sources.CreateOwnSSRC(packetbuilder.GetSSRC())) < 0)
|
||||||
|
@ -48,9 +48,6 @@ RTPSessionParams::RTPSessionParams() :
|
|||||||
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
|
||||||
resolvehostname = false;
|
resolvehostname = false;
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
probationtype = RTPSources::ProbationStore;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
mininterval = RTPTime(RTCP_DEFAULTMININTERVAL);
|
mininterval = RTPTime(RTCP_DEFAULTMININTERVAL);
|
||||||
sessionbandwidth = RTP_DEFAULTSESSIONBANDWIDTH;
|
sessionbandwidth = RTP_DEFAULTSESSIONBANDWIDTH;
|
||||||
|
@ -143,19 +143,6 @@ public:
|
|||||||
{
|
{
|
||||||
return resolvehostname;
|
return resolvehostname;
|
||||||
}
|
}
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
/** If probation support is enabled, this function sets the probation type to be used. */
|
|
||||||
void SetProbationType(RTPSources::ProbationType probtype)
|
|
||||||
{
|
|
||||||
probationtype = probtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the probation type which will be used (default is RTPSources::ProbationStore). */
|
|
||||||
RTPSources::ProbationType GetProbationType() const
|
|
||||||
{
|
|
||||||
return probationtype;
|
|
||||||
}
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
/** Sets the session bandwidth in bytes per second. */
|
/** Sets the session bandwidth in bytes per second. */
|
||||||
void SetSessionBandwidth(double sessbw)
|
void SetSessionBandwidth(double sessbw)
|
||||||
@ -357,9 +344,6 @@ private:
|
|||||||
double owntsunit;
|
double owntsunit;
|
||||||
RTPTransmitter::ReceiveMode receivemode;
|
RTPTransmitter::ReceiveMode receivemode;
|
||||||
bool resolvehostname;
|
bool resolvehostname;
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
RTPSources::ProbationType probationtype;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
double sessionbandwidth;
|
double sessionbandwidth;
|
||||||
double controlfrac;
|
double controlfrac;
|
||||||
|
@ -75,61 +75,7 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack, const RTPTime &receivetime,
|
|||||||
|
|
||||||
if (!sentdata) // no valid packets received yet
|
if (!sentdata) // no valid packets received yet
|
||||||
{
|
{
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
if (applyprobation)
|
|
||||||
{
|
|
||||||
bool acceptpack = false;
|
|
||||||
|
|
||||||
if (probation)
|
|
||||||
{
|
|
||||||
uint16_t pseq;
|
|
||||||
uint32_t pseq2;
|
|
||||||
|
|
||||||
pseq = prevseqnr;
|
|
||||||
pseq++;
|
|
||||||
pseq2 = (uint32_t) pseq;
|
|
||||||
if (pseq2 == pack->GetExtendedSequenceNumber()) // ok, its the next expected packet
|
|
||||||
{
|
|
||||||
prevseqnr = (uint16_t) pack->GetExtendedSequenceNumber();
|
|
||||||
probation--;
|
|
||||||
if (probation == 0) // probation over
|
|
||||||
acceptpack = true;
|
|
||||||
else
|
|
||||||
*onprobation = true;
|
|
||||||
}
|
|
||||||
else // not next packet
|
|
||||||
{
|
|
||||||
probation = RTP_PROBATIONCOUNT;
|
|
||||||
prevseqnr = (uint16_t) pack->GetExtendedSequenceNumber();
|
|
||||||
*onprobation = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // first packet received with this SSRC ID, start probation
|
|
||||||
{
|
|
||||||
probation = RTP_PROBATIONCOUNT;
|
|
||||||
prevseqnr = (uint16_t) pack->GetExtendedSequenceNumber();
|
|
||||||
*onprobation = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (acceptpack)
|
|
||||||
{
|
|
||||||
ACCEPTPACKETCODE
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*accept = false;
|
|
||||||
lastmsgtime = receivetime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // No probation
|
|
||||||
{
|
|
||||||
ACCEPTPACKETCODE
|
|
||||||
}
|
|
||||||
#else // No compiled-in probation support
|
|
||||||
|
|
||||||
ACCEPTPACKETCODE
|
ACCEPTPACKETCODE
|
||||||
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
}
|
}
|
||||||
else // already got packets
|
else // already got packets
|
||||||
{
|
{
|
||||||
|
@ -254,10 +254,6 @@ private:
|
|||||||
RTPTime lastnotetime;
|
RTPTime lastnotetime;
|
||||||
uint32_t numnewpackets;
|
uint32_t numnewpackets;
|
||||||
uint32_t savedextseqnr;
|
uint32_t savedextseqnr;
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
uint16_t prevseqnr;
|
|
||||||
int probation;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline RTPSourceStats::RTPSourceStats() :
|
inline RTPSourceStats::RTPSourceStats() :
|
||||||
@ -274,10 +270,6 @@ inline RTPSourceStats::RTPSourceStats() :
|
|||||||
prevtimestamp = 0;
|
prevtimestamp = 0;
|
||||||
djitter = 0;
|
djitter = 0;
|
||||||
savedextseqnr = 0;
|
savedextseqnr = 0;
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
probation = 0;
|
|
||||||
prevseqnr = 0;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Describes an entry in the RTPSources source table. */
|
/** Describes an entry in the RTPSources source table. */
|
||||||
|
@ -56,9 +56,6 @@ RTPSources::RTPSources(ProbationType probtype)
|
|||||||
sendercount = 0;
|
sendercount = 0;
|
||||||
activecount = 0;
|
activecount = 0;
|
||||||
owndata = 0;
|
owndata = 0;
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
probationtype = probtype;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPSources::~RTPSources()
|
RTPSources::~RTPSources()
|
||||||
@ -812,11 +809,7 @@ int RTPSources::ObtainSourceDataInstance(uint32_t ssrc, RTPInternalSourceData **
|
|||||||
|
|
||||||
if (sourcelist.GotoElement(ssrc) < 0) // No entry for this source
|
if (sourcelist.GotoElement(ssrc) < 0) // No entry for this source
|
||||||
{
|
{
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
srcdat2 = new RTPInternalSourceData(ssrc);
|
||||||
srcdat2 = new RTPInternalSourceData(ssrc, probationtype);
|
|
||||||
#else
|
|
||||||
srcdat2 = new RTPInternalSourceData(ssrc,RTPSources::NoProbation);
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
if (srcdat2 == 0)
|
if (srcdat2 == 0)
|
||||||
return ERR_RTP_OUTOFMEM;
|
return ERR_RTP_OUTOFMEM;
|
||||||
if ((status = sourcelist.AddElement(ssrc, srcdat2)) < 0)
|
if ((status = sourcelist.AddElement(ssrc, srcdat2)) < 0)
|
||||||
|
@ -90,13 +90,6 @@ public:
|
|||||||
|
|
||||||
/** Clears the source table. */
|
/** Clears the source table. */
|
||||||
void Clear();
|
void Clear();
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
/** Changes the current probation type. */
|
|
||||||
void SetProbationType(ProbationType probtype)
|
|
||||||
{
|
|
||||||
probationtype = probtype;
|
|
||||||
}
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
/** Creates an entry for our own SSRC identifier. */
|
/** Creates an entry for our own SSRC identifier. */
|
||||||
int CreateOwnSSRC(uint32_t ssrc);
|
int CreateOwnSSRC(uint32_t ssrc);
|
||||||
@ -370,10 +363,6 @@ private:
|
|||||||
int totalcount;
|
int totalcount;
|
||||||
int activecount;
|
int activecount;
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_PROBATION
|
|
||||||
ProbationType probationtype;
|
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
|
||||||
|
|
||||||
RTPInternalSourceData *owndata;
|
RTPInternalSourceData *owndata;
|
||||||
|
|
||||||
friend class RTPInternalSourceData;
|
friend class RTPInternalSourceData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user