qosMeasurementRecord Class Reference

Collaboration diagram for qosMeasurementRecord:

Collaboration graph
[legend]

Public Member Functions

 qosMeasurementRecord (struct timeval const &startTime, RTPSource *src)
virtual ~qosMeasurementRecord ()
void periodicQOSMeasurement (struct timeval const &timeNow)

Data Fields

RTPSourcefSource
qosMeasurementRecordfNext
timeval measurementStartTime measurementEndTime
double kbits_per_second_min
double kbits_per_second_max
double kBytesTotal
double packet_loss_fraction_min
double packet_loss_fraction_max
unsigned totNumPacketsReceived
unsigned totNumPacketsExpected

Detailed Description

Definition at line 924 of file playCommon.cpp.


Constructor & Destructor Documentation

qosMeasurementRecord::qosMeasurementRecord ( struct timeval const &  startTime,
RTPSource src 
) [inline]

Definition at line 926 of file playCommon.cpp.

References kBytesTotal, measurementEndTime, NULL, RTPSource::receptionStatsDB(), totNumPacketsExpected, totNumPacketsReceived, and True.

00927     : fSource(src), fNext(NULL),
00928       kbits_per_second_min(1e20), kbits_per_second_max(0),
00929       kBytesTotal(0.0),
00930       packet_loss_fraction_min(1.0), packet_loss_fraction_max(0.0),
00931       totNumPacketsReceived(0), totNumPacketsExpected(0) {
00932     measurementEndTime = measurementStartTime = startTime;
00933 
00934     RTPReceptionStatsDB::Iterator statsIter(src->receptionStatsDB());
00935     // Assume that there's only one SSRC source (usually the case):
00936     RTPReceptionStats* stats = statsIter.next(True);
00937     if (stats != NULL) {
00938       kBytesTotal = stats->totNumKBytesReceived();
00939       totNumPacketsReceived = stats->totNumPacketsReceived();
00940       totNumPacketsExpected = stats->totNumPacketsExpected();
00941     }
00942   }

virtual qosMeasurementRecord::~qosMeasurementRecord (  )  [inline, virtual]

Definition at line 943 of file playCommon.cpp.

References fNext.

00943 { delete fNext; }


Member Function Documentation

void qosMeasurementRecord::periodicQOSMeasurement ( struct timeval const &  timeNow  ) 

Definition at line 991 of file playCommon.cpp.

References NULL, totNumPacketsReceived, and True.

00991                                                       {
00992   unsigned secsDiff = timeNow.tv_sec - measurementEndTime.tv_sec;
00993   int usecsDiff = timeNow.tv_usec - measurementEndTime.tv_usec;
00994   double timeDiff = secsDiff + usecsDiff/1000000.0;
00995   measurementEndTime = timeNow;
00996 
00997   RTPReceptionStatsDB::Iterator statsIter(fSource->receptionStatsDB());
00998   // Assume that there's only one SSRC source (usually the case):
00999   RTPReceptionStats* stats = statsIter.next(True);
01000   if (stats != NULL) {
01001     double kBytesTotalNow = stats->totNumKBytesReceived();
01002     double kBytesDeltaNow = kBytesTotalNow - kBytesTotal;
01003     kBytesTotal = kBytesTotalNow;
01004 
01005     double kbpsNow = timeDiff == 0.0 ? 0.0 : 8*kBytesDeltaNow/timeDiff;
01006     if (kbpsNow < 0.0) kbpsNow = 0.0; // in case of roundoff error
01007     if (kbpsNow < kbits_per_second_min) kbits_per_second_min = kbpsNow;
01008     if (kbpsNow > kbits_per_second_max) kbits_per_second_max = kbpsNow;
01009 
01010     unsigned totReceivedNow = stats->totNumPacketsReceived();
01011     unsigned totExpectedNow = stats->totNumPacketsExpected();
01012     unsigned deltaReceivedNow = totReceivedNow - totNumPacketsReceived;
01013     unsigned deltaExpectedNow = totExpectedNow - totNumPacketsExpected;
01014     totNumPacketsReceived = totReceivedNow;
01015     totNumPacketsExpected = totExpectedNow;
01016 
01017     double lossFractionNow = deltaExpectedNow == 0 ? 0.0
01018       : 1.0 - deltaReceivedNow/(double)deltaExpectedNow;
01019     //if (lossFractionNow < 0.0) lossFractionNow = 0.0; //reordering can cause
01020     if (lossFractionNow < packet_loss_fraction_min) {
01021       packet_loss_fraction_min = lossFractionNow;
01022     }
01023     if (lossFractionNow > packet_loss_fraction_max) {
01024       packet_loss_fraction_max = lossFractionNow;
01025     }
01026   }
01027 }


Field Documentation

RTPSource* qosMeasurementRecord::fSource

Definition at line 948 of file playCommon.cpp.

qosMeasurementRecord* qosMeasurementRecord::fNext

Definition at line 949 of file playCommon.cpp.

Referenced by beginQOSMeasurement(), printQOSData(), and ~qosMeasurementRecord().

struct timeval measurementStartTime qosMeasurementRecord::measurementEndTime [read]

Definition at line 952 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

double qosMeasurementRecord::kbits_per_second_min

Definition at line 953 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::kbits_per_second_max

Definition at line 953 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::kBytesTotal

Definition at line 954 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

double qosMeasurementRecord::packet_loss_fraction_min

Definition at line 955 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::packet_loss_fraction_max

Definition at line 955 of file playCommon.cpp.

Referenced by printQOSData().

unsigned qosMeasurementRecord::totNumPacketsReceived

Definition at line 956 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

unsigned qosMeasurementRecord::totNumPacketsExpected

Definition at line 956 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().


The documentation for this class was generated from the following file:
Generated on Thu May 17 07:16:08 2012 for live by  doxygen 1.5.2