|
|
This class is a validator for sequence numbers. It is based on the algorithm described in RFC 1889. It can use sequence numbers up to a size of 64 bits. Jitter and fraction loss calculation is also done by this class.
SeqNumValidator (const cardinal minSequential = 2, const cardinal maxMisorder = 100, const cardinal maxDropout = 3000, const card64 seqMod = (1 << 16)) |
Constructor for new sequence number validator.
Parameters:
minSequential | Minimum number of packets in sequence for the source to be valid. |
maxMisorder | Maximum difference for packets to be misordered. |
maxDropout | Maximum gap. |
seqMod | Sequence number modulo. |
inline card64 getPacketsReceived () |
Get number of packets received.
Returns: Number of packets received.
inline card64 getPacketsLost () |
Get number of packets lost. The loss is calculated by the number of sequence number cycles and gaps.
Returns: Number of packets lost.
inline card64 getLastSeqNum () |
Get extended last sequence number. This number is extended by the calculated number of sequence number cycles!
Returns: Last sequence number.
inline double getFractionLost () |
Get fraction of packets lost. Note: No calculation of the fraction lost is done here! The fraction lost value is the value of the last call of calculateFractionLost()!
Returns: Fraction of packets lost.
See also: calculateFractionLost
inline double getJitter () |
Get jitter.
Returns: Jitter.
ValidationResult validate (const card64 sequenceNumber, const card32 packetTimeStamp = 0) |
Validate a new sequence number. If the packet is valid, jitter value will be calculated using packetTimeStamp. To disable jitter calculation, set packetTimeStamp to 0.
Parameters:
sequenceNumber | Sequence number to be validated. |
packetTimeStamp | Time stamp of the packet for jitter calculation. |
Returns: ValidationResult containing result of validation.
void reset () |
Reset SeqNumValidator.
double calculateFractionLost () |
Calculate and get fraction of packets lost.
Returns: Fraction lost.