1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

qrtplib: removed probation support

This commit is contained in:
f4exb 2018-02-27 23:36:24 +01:00
parent b8c50eb798
commit 92bc10efe6
10 changed files with 5 additions and 151 deletions

View File

@ -57,7 +57,7 @@
#define RTP_SUPPORT_SDESPRIV
#define RTP_SUPPORT_PROBATION
// No #define RTP_SUPPORT_PROBATION
#define RTP_SUPPORT_GETLOGINR

View File

@ -39,13 +39,9 @@
namespace qrtplib
{
RTPInternalSourceData::RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype) :
RTPInternalSourceData::RTPInternalSourceData(uint32_t ssrc) :
RTPSourceData(ssrc)
{
JRTPLIB_UNUSED(probtype); // possibly unused
#ifdef RTP_SUPPORT_PROBATION
probationtype = probtype;
#endif // RTP_SUPPORT_PROBATION
}
RTPInternalSourceData::~RTPInternalSourceData()
@ -65,45 +61,13 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &r
else
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;
#endif // RTP_SUPPORT_PROBATION
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)
return 0;
return 0;
validated = true;
#endif // RTP_SUPPORT_PROBATION;
if (validated && !ownssrc) // for own ssrc these variables depend on the outgoing packets, not on the incoming
issender = true;

View File

@ -50,7 +50,7 @@ namespace qrtplib
class RTPInternalSourceData: public RTPSourceData
{
public:
RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype);
RTPInternalSourceData(uint32_t ssrc);
~RTPInternalSourceData();
int ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &receivetime, bool *stored, RTPSources *sources);
@ -107,10 +107,6 @@ public:
SDESinf.SetNote(0, 0);
}
#ifdef RTP_SUPPORT_PROBATION
private:
RTPSources::ProbationType probationtype;
#endif // RTP_SUPPORT_PROBATION
};
inline int RTPInternalSourceData::SetRTPDataAddress(const RTPAddress *a)

View File

@ -193,13 +193,6 @@ int RTPSession::InternalCreate(const RTPSessionParams &sessparams)
if (sessparams.GetUsePredefinedSSRC())
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
if ((status = sources.CreateOwnSSRC(packetbuilder.GetSSRC())) < 0)

View File

@ -48,9 +48,6 @@ RTPSessionParams::RTPSessionParams() :
acceptown = false;
owntsunit = -1; // The user will have to set it to the correct value himself
resolvehostname = false;
#ifdef RTP_SUPPORT_PROBATION
probationtype = RTPSources::ProbationStore;
#endif // RTP_SUPPORT_PROBATION
mininterval = RTPTime(RTCP_DEFAULTMININTERVAL);
sessionbandwidth = RTP_DEFAULTSESSIONBANDWIDTH;

View File

@ -143,19 +143,6 @@ public:
{
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. */
void SetSessionBandwidth(double sessbw)
@ -357,9 +344,6 @@ private:
double owntsunit;
RTPTransmitter::ReceiveMode receivemode;
bool resolvehostname;
#ifdef RTP_SUPPORT_PROBATION
RTPSources::ProbationType probationtype;
#endif // RTP_SUPPORT_PROBATION
double sessionbandwidth;
double controlfrac;

View File

@ -75,61 +75,7 @@ void RTPSourceStats::ProcessPacket(RTPPacket *pack, const RTPTime &receivetime,
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
#endif // RTP_SUPPORT_PROBATION
}
else // already got packets
{

View File

@ -254,10 +254,6 @@ private:
RTPTime lastnotetime;
uint32_t numnewpackets;
uint32_t savedextseqnr;
#ifdef RTP_SUPPORT_PROBATION
uint16_t prevseqnr;
int probation;
#endif // RTP_SUPPORT_PROBATION
};
inline RTPSourceStats::RTPSourceStats() :
@ -274,10 +270,6 @@ inline RTPSourceStats::RTPSourceStats() :
prevtimestamp = 0;
djitter = 0;
savedextseqnr = 0;
#ifdef RTP_SUPPORT_PROBATION
probation = 0;
prevseqnr = 0;
#endif // RTP_SUPPORT_PROBATION
}
/** Describes an entry in the RTPSources source table. */

View File

@ -56,9 +56,6 @@ RTPSources::RTPSources(ProbationType probtype)
sendercount = 0;
activecount = 0;
owndata = 0;
#ifdef RTP_SUPPORT_PROBATION
probationtype = probtype;
#endif // RTP_SUPPORT_PROBATION
}
RTPSources::~RTPSources()
@ -812,11 +809,7 @@ int RTPSources::ObtainSourceDataInstance(uint32_t ssrc, RTPInternalSourceData **
if (sourcelist.GotoElement(ssrc) < 0) // No entry for this source
{
#ifdef RTP_SUPPORT_PROBATION
srcdat2 = new RTPInternalSourceData(ssrc, probationtype);
#else
srcdat2 = new RTPInternalSourceData(ssrc,RTPSources::NoProbation);
#endif // RTP_SUPPORT_PROBATION
srcdat2 = new RTPInternalSourceData(ssrc);
if (srcdat2 == 0)
return ERR_RTP_OUTOFMEM;
if ((status = sourcelist.AddElement(ssrc, srcdat2)) < 0)

View File

@ -90,13 +90,6 @@ public:
/** Clears the source table. */
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. */
int CreateOwnSSRC(uint32_t ssrc);
@ -370,10 +363,6 @@ private:
int totalcount;
int activecount;
#ifdef RTP_SUPPORT_PROBATION
ProbationType probationtype;
#endif // RTP_SUPPORT_PROBATION
RTPInternalSourceData *owndata;
friend class RTPInternalSourceData;