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 947 of file playCommon.cpp.


Constructor & Destructor Documentation

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

Definition at line 949 of file playCommon.cpp.

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

00950     : fSource(src), fNext(NULL),
00951       kbits_per_second_min(1e20), kbits_per_second_max(0),
00952       kBytesTotal(0.0),
00953       packet_loss_fraction_min(1.0), packet_loss_fraction_max(0.0),
00954       totNumPacketsReceived(0), totNumPacketsExpected(0) {
00955     measurementEndTime = measurementStartTime = startTime;
00956 
00957     RTPReceptionStatsDB::Iterator statsIter(src->receptionStatsDB());
00958     // Assume that there's only one SSRC source (usually the case):
00959     RTPReceptionStats* stats = statsIter.next(True);
00960     if (stats != NULL) {
00961       kBytesTotal = stats->totNumKBytesReceived();
00962       totNumPacketsReceived = stats->totNumPacketsReceived();
00963       totNumPacketsExpected = stats->totNumPacketsExpected();
00964     }
00965   }

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

Definition at line 966 of file playCommon.cpp.

References fNext.

00966 { delete fNext; }


Member Function Documentation

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

Definition at line 1014 of file playCommon.cpp.

References NULL, totNumPacketsReceived, and True.

01014                                                       {
01015   unsigned secsDiff = timeNow.tv_sec - measurementEndTime.tv_sec;
01016   int usecsDiff = timeNow.tv_usec - measurementEndTime.tv_usec;
01017   double timeDiff = secsDiff + usecsDiff/1000000.0;
01018   measurementEndTime = timeNow;
01019 
01020   RTPReceptionStatsDB::Iterator statsIter(fSource->receptionStatsDB());
01021   // Assume that there's only one SSRC source (usually the case):
01022   RTPReceptionStats* stats = statsIter.next(True);
01023   if (stats != NULL) {
01024     double kBytesTotalNow = stats->totNumKBytesReceived();
01025     double kBytesDeltaNow = kBytesTotalNow - kBytesTotal;
01026     kBytesTotal = kBytesTotalNow;
01027 
01028     double kbpsNow = timeDiff == 0.0 ? 0.0 : 8*kBytesDeltaNow/timeDiff;
01029     if (kbpsNow < 0.0) kbpsNow = 0.0; // in case of roundoff error
01030     if (kbpsNow < kbits_per_second_min) kbits_per_second_min = kbpsNow;
01031     if (kbpsNow > kbits_per_second_max) kbits_per_second_max = kbpsNow;
01032 
01033     unsigned totReceivedNow = stats->totNumPacketsReceived();
01034     unsigned totExpectedNow = stats->totNumPacketsExpected();
01035     unsigned deltaReceivedNow = totReceivedNow - totNumPacketsReceived;
01036     unsigned deltaExpectedNow = totExpectedNow - totNumPacketsExpected;
01037     totNumPacketsReceived = totReceivedNow;
01038     totNumPacketsExpected = totExpectedNow;
01039 
01040     double lossFractionNow = deltaExpectedNow == 0 ? 0.0
01041       : 1.0 - deltaReceivedNow/(double)deltaExpectedNow;
01042     //if (lossFractionNow < 0.0) lossFractionNow = 0.0; //reordering can cause
01043     if (lossFractionNow < packet_loss_fraction_min) {
01044       packet_loss_fraction_min = lossFractionNow;
01045     }
01046     if (lossFractionNow > packet_loss_fraction_max) {
01047       packet_loss_fraction_max = lossFractionNow;
01048     }
01049   }
01050 }


Field Documentation

RTPSource* qosMeasurementRecord::fSource

Definition at line 971 of file playCommon.cpp.

qosMeasurementRecord* qosMeasurementRecord::fNext

Definition at line 972 of file playCommon.cpp.

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

struct timeval measurementStartTime qosMeasurementRecord::measurementEndTime [read]

Definition at line 975 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

double qosMeasurementRecord::kbits_per_second_min

Definition at line 976 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::kbits_per_second_max

Definition at line 976 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::kBytesTotal

Definition at line 977 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

double qosMeasurementRecord::packet_loss_fraction_min

Definition at line 978 of file playCommon.cpp.

Referenced by printQOSData().

double qosMeasurementRecord::packet_loss_fraction_max

Definition at line 978 of file playCommon.cpp.

Referenced by printQOSData().

unsigned qosMeasurementRecord::totNumPacketsReceived

Definition at line 979 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().

unsigned qosMeasurementRecord::totNumPacketsExpected

Definition at line 979 of file playCommon.cpp.

Referenced by printQOSData(), and qosMeasurementRecord().


The documentation for this class was generated from the following file:
Generated on Mon Apr 29 13:32:25 2013 for live by  doxygen 1.5.2