RTPReceptionStatsDB Class Reference

#include <RTPSource.hh>

Collaboration diagram for RTPReceptionStatsDB:

Collaboration graph
[legend]

Public Member Functions

unsigned totNumPacketsReceived () const
unsigned numActiveSourcesSinceLastReset () const
void reset ()
void noteIncomingPacket (u_int32_t SSRC, u_int16_t seqNum, u_int32_t rtpTimestamp, unsigned timestampFrequency, Boolean useForJitterCalculation, struct timeval &resultPresentationTime, Boolean &resultHasBeenSyncedUsingRTCP, unsigned packetSize)
void noteIncomingSR (u_int32_t SSRC, u_int32_t ntpTimestampMSW, u_int32_t ntpTimestampLSW, u_int32_t rtpTimestamp)
void removeRecord (u_int32_t SSRC)
RTPReceptionStatslookup (u_int32_t SSRC) const

Protected Member Functions

 RTPReceptionStatsDB ()
virtual ~RTPReceptionStatsDB ()
void add (u_int32_t SSRC, RTPReceptionStats *stats)

Protected Attributes

unsigned fNumActiveSourcesSinceLastReset

Private Attributes

HashTablefTable
unsigned fTotNumPacketsReceived

Friends

class RTPSource
class Iterator

Data Structures

class  Iterator

Detailed Description

Definition at line 116 of file RTPSource.hh.


Constructor & Destructor Documentation

RTPReceptionStatsDB::RTPReceptionStatsDB (  )  [protected]

Definition at line 73 of file RTPSource.cpp.

References reset().

RTPReceptionStatsDB::~RTPReceptionStatsDB (  )  [protected, virtual]

Definition at line 88 of file RTPSource.cpp.

References fTable, NULL, and HashTable::RemoveNext().

00088                                           {
00089   // First, remove and delete all stats records from the table:
00090   RTPReceptionStats* stats;
00091   while ((stats = (RTPReceptionStats*)fTable->RemoveNext()) != NULL) {
00092     delete stats;
00093   }
00094 
00095   // Then, delete the table itself:
00096   delete fTable;
00097 }


Member Function Documentation

unsigned RTPReceptionStatsDB::totNumPacketsReceived (  )  const [inline]

Definition at line 118 of file RTPSource.hh.

References fTotNumPacketsReceived.

Referenced by checkInterPacketGaps().

00118 { return fTotNumPacketsReceived; }

unsigned RTPReceptionStatsDB::numActiveSourcesSinceLastReset (  )  const [inline]

Definition at line 119 of file RTPSource.hh.

References fNumActiveSourcesSinceLastReset.

Referenced by checkForPacketArrival().

00119                                                   {
00120     return fNumActiveSourcesSinceLastReset;
00121  }

void RTPReceptionStatsDB::reset (  ) 

Definition at line 78 of file RTPSource.cpp.

References fNumActiveSourcesSinceLastReset, iter, MediaSubsessionIterator::next(), NULL, and RTPReceptionStats::reset().

Referenced by RTCPInstance::enqueueCommonReportSuffix(), and RTPReceptionStatsDB().

00078                                 {
00079   fNumActiveSourcesSinceLastReset = 0;
00080 
00081   Iterator iter(*this);
00082   RTPReceptionStats* stats;
00083   while ((stats = iter.next()) != NULL) {
00084     stats->reset();
00085   }
00086 }

void RTPReceptionStatsDB::noteIncomingPacket ( u_int32_t  SSRC,
u_int16_t  seqNum,
u_int32_t  rtpTimestamp,
unsigned  timestampFrequency,
Boolean  useForJitterCalculation,
struct timeval &  resultPresentationTime,
Boolean resultHasBeenSyncedUsingRTCP,
unsigned  packetSize 
)

Definition at line 100 of file RTPSource.cpp.

References fNumActiveSourcesSinceLastReset, fTotNumPacketsReceived, lookup(), RTPReceptionStats::noteIncomingPacket(), NULL, and RTPReceptionStats::numPacketsReceivedSinceLastReset().

Referenced by MultiFramedRTPSource::networkReadHandler1().

00105                                           {
00106   ++fTotNumPacketsReceived;
00107   RTPReceptionStats* stats = lookup(SSRC);
00108   if (stats == NULL) {
00109     // This is the first time we've heard from this SSRC.
00110     // Create a new record for it:
00111     stats = new RTPReceptionStats(SSRC, seqNum);
00112     if (stats == NULL) return;
00113     add(SSRC, stats);
00114   }
00115 
00116   if (stats->numPacketsReceivedSinceLastReset() == 0) {
00117     ++fNumActiveSourcesSinceLastReset;
00118   }
00119 
00120   stats->noteIncomingPacket(seqNum, rtpTimestamp, timestampFrequency,
00121                             useForJitterCalculation,
00122                             resultPresentationTime,
00123                             resultHasBeenSyncedUsingRTCP, packetSize);
00124 }

void RTPReceptionStatsDB::noteIncomingSR ( u_int32_t  SSRC,
u_int32_t  ntpTimestampMSW,
u_int32_t  ntpTimestampLSW,
u_int32_t  rtpTimestamp 
)

Definition at line 127 of file RTPSource.cpp.

References lookup(), RTPReceptionStats::noteIncomingSR(), and NULL.

Referenced by RTCPInstance::incomingReportHandler1().

00129                                          {
00130   RTPReceptionStats* stats = lookup(SSRC);
00131   if (stats == NULL) {
00132     // This is the first time we've heard of this SSRC.
00133     // Create a new record for it:
00134     stats = new RTPReceptionStats(SSRC);
00135     if (stats == NULL) return;
00136     add(SSRC, stats);
00137   }
00138 
00139   stats->noteIncomingSR(ntpTimestampMSW, ntpTimestampLSW, rtpTimestamp);
00140 }

void RTPReceptionStatsDB::removeRecord ( u_int32_t  SSRC  ) 

Definition at line 142 of file RTPSource.cpp.

References fTable, lookup(), NULL, and HashTable::Remove().

Referenced by RTCPInstance::removeSSRC().

00142                                                      {
00143   RTPReceptionStats* stats = lookup(SSRC);
00144   if (stats != NULL) {
00145     long SSRC_long = (long)SSRC;
00146     fTable->Remove((char const*)SSRC_long);
00147     delete stats;
00148   }
00149 }

RTPReceptionStats * RTPReceptionStatsDB::lookup ( u_int32_t  SSRC  )  const

Definition at line 175 of file RTPSource.cpp.

References fTable, and HashTable::Lookup().

Referenced by RTCPInstance::incomingReportHandler1(), noteIncomingPacket(), noteIncomingSR(), and removeRecord().

00175                                                                    {
00176   long SSRC_long = (long)SSRC;
00177   return (RTPReceptionStats*)(fTable->Lookup((char const*)SSRC_long));
00178 }

void RTPReceptionStatsDB::add ( u_int32_t  SSRC,
RTPReceptionStats stats 
) [protected]

Definition at line 180 of file RTPSource.cpp.

References HashTable::Add(), and fTable.

00180                                                                       {
00181   long SSRC_long = (long)SSRC;
00182   fTable->Add((char const*)SSRC_long, stats);
00183 }


Friends And Related Function Documentation

friend class RTPSource [friend]

Definition at line 159 of file RTPSource.hh.

friend class Iterator [friend]

Definition at line 167 of file RTPSource.hh.


Field Documentation

unsigned RTPReceptionStatsDB::fNumActiveSourcesSinceLastReset [protected]

Definition at line 168 of file RTPSource.hh.

Referenced by noteIncomingPacket(), numActiveSourcesSinceLastReset(), and reset().

HashTable* RTPReceptionStatsDB::fTable [private]

Definition at line 171 of file RTPSource.hh.

Referenced by add(), lookup(), removeRecord(), and ~RTPReceptionStatsDB().

unsigned RTPReceptionStatsDB::fTotNumPacketsReceived [private]

Definition at line 172 of file RTPSource.hh.

Referenced by noteIncomingPacket(), and totNumPacketsReceived().


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