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 (RTPSource &rtpSource)
virtual ~RTPReceptionStatsDB ()
void add (u_int32_t SSRC, RTPReceptionStats *stats)

Protected Attributes

RTPSourcefOurRTPSource
unsigned fNumActiveSourcesSinceLastReset

Private Attributes

HashTablefTable
unsigned fTotNumPacketsReceived

Friends

class RTPSource
class Iterator

Data Structures

class  Iterator

Detailed Description

Definition at line 109 of file RTPSource.hh.


Constructor & Destructor Documentation

RTPReceptionStatsDB::RTPReceptionStatsDB ( RTPSource rtpSource  )  [protected]

Definition at line 74 of file RTPSource.cpp.

References reset().

00075   : fOurRTPSource(rtpSource),
00076     fTable(HashTable::create(ONE_WORD_HASH_KEYS)), fTotNumPacketsReceived(0) {
00077   reset();
00078 }

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

Definition at line 90 of file RTPSource.cpp.

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

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


Member Function Documentation

unsigned RTPReceptionStatsDB::totNumPacketsReceived (  )  const [inline]

Definition at line 111 of file RTPSource.hh.

References fTotNumPacketsReceived.

Referenced by checkInterPacketGaps().

00111 { return fTotNumPacketsReceived; }

unsigned RTPReceptionStatsDB::numActiveSourcesSinceLastReset (  )  const [inline]

Definition at line 112 of file RTPSource.hh.

References fNumActiveSourcesSinceLastReset.

Referenced by checkForPacketArrival().

00112                                                   {
00113     return fNumActiveSourcesSinceLastReset;
00114  }

void RTPReceptionStatsDB::reset (  ) 

Definition at line 80 of file RTPSource.cpp.

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

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

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

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 102 of file RTPSource.cpp.

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

Referenced by MultiFramedRTPSource::networkReadHandler().

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

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

Definition at line 129 of file RTPSource.cpp.

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

Referenced by RTCPInstance::incomingReportHandler1().

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

void RTPReceptionStatsDB::removeRecord ( u_int32_t  SSRC  ) 

Definition at line 144 of file RTPSource.cpp.

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

Referenced by RTCPInstance::removeSSRC().

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

RTPReceptionStats * RTPReceptionStatsDB::lookup ( u_int32_t  SSRC  )  const

Definition at line 177 of file RTPSource.cpp.

References fTable, and HashTable::Lookup().

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

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

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

Definition at line 182 of file RTPSource.cpp.

References HashTable::Add(), and fTable.

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


Friends And Related Function Documentation

friend class RTPSource [friend]

Definition at line 152 of file RTPSource.hh.

friend class Iterator [friend]

Definition at line 160 of file RTPSource.hh.


Field Documentation

RTPSource& RTPReceptionStatsDB::fOurRTPSource [protected]

Definition at line 161 of file RTPSource.hh.

Referenced by noteIncomingPacket(), and noteIncomingSR().

unsigned RTPReceptionStatsDB::fNumActiveSourcesSinceLastReset [protected]

Definition at line 162 of file RTPSource.hh.

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

HashTable* RTPReceptionStatsDB::fTable [private]

Definition at line 165 of file RTPSource.hh.

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

unsigned RTPReceptionStatsDB::fTotNumPacketsReceived [private]

Definition at line 166 of file RTPSource.hh.

Referenced by noteIncomingPacket(), and totNumPacketsReceived().


The documentation for this class was generated from the following files:
Generated on Tue Oct 7 15:40:08 2008 for live by  doxygen 1.5.2