RTP Audio System  2.0.0
SeqNumValidator Class Reference

Sequence Number Validator. More...

#include <seqnumvalidator.h>

Inheritance diagram for SeqNumValidator:
SourceStateInfo

List of all members.

Public Types

enum  ValidationResult {
  Valid = 0, SourceProbation = 1, Jumped = 2, Invalid = 10,
  DuplicatePacket = Invalid + 0, InvalidSeqNum = Invalid + 1
}

Public Member Functions

 SeqNumValidator (const cardinal minSequential=2, const cardinal maxMisorder=100, const cardinal maxDropout=3000, const card64 seqMod=(1<< 16))
card64 getPacketsReceived () const
card64 getPacketsLost () const
card64 getLastSeqNum () const
double getFractionLost () const
double getJitter () const
ValidationResult validate (const card64 sequenceNumber, const card32 packetTimeStamp=0)
void reset ()
double calculateFractionLost ()

Private Member Functions

void init (const card64 sequenceNumber)

Private Attributes

card64 SeqMod
cardinal MaxDropout
cardinal MaxMisorder
cardinal MinSequential
card64 PrevPacketTimeStamp
card64 PrevPacketArrivalTime
double Jitter
double FractionLost
card64 MaxSeq
card64 BaseSeq
card64 BadSeq
card32 Probation
card64 Cycles
card64 Received
card64 ReceivedPrior
card64 ExpectedPrior
bool Uninitialized

Detailed Description

Sequence Number Validator.

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.

Author:
Thomas Dreibholz
Version:
1.0

Member Enumeration Documentation

Enumerator:
Valid 
SourceProbation 
Jumped 
Invalid 
DuplicatePacket 
InvalidSeqNum 

Constructor & Destructor Documentation

SeqNumValidator::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:
minSequentialMinimum number of packets in sequence for the source to be valid.
maxMisorderMaximum difference for packets to be misordered.
maxDropoutMaximum gap.
seqModSequence number modulo.

Member Function Documentation

Calculate and get fraction of packets lost.

Returns:
Fraction lost.
double SeqNumValidator::getFractionLost ( ) const [inline]

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
double SeqNumValidator::getJitter ( ) const [inline]

Get jitter.

Returns:
Jitter.

Get extended last sequence number. This number is extended by the calculated number of sequence number cycles!

Returns:
Last sequence number.

Get number of packets lost. The loss is calculated by the number of sequence number cycles and gaps.

Returns:
Number of packets lost.

Get number of packets received.

Returns:
Number of packets received.
void SeqNumValidator::init ( const card64  sequenceNumber) [inline, private]

Reset SeqNumValidator.

Reimplemented in SourceStateInfo.

SeqNumValidator::ValidationResult SeqNumValidator::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:
sequenceNumberSequence number to be validated.
packetTimeStampTime stamp of the packet for jitter calculation.
Returns:
ValidationResult containing result of validation.

Member Data Documentation

Reimplemented in SourceStateInfo.

double SeqNumValidator::Jitter [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines