sipxmedialib  Version 3.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CSenderReport Class Reference

#include <SenderReport.h>

Inheritance diagram for CSenderReport:
Inheritance graph
[legend]
Collaboration diagram for CSenderReport:
Collaboration graph
[legend]

Public Member Functions

 CSenderReport (ssrc_t ulSSRC, ISetReceiverStatistics *piSetStatistics=NULL)
 
 ~CSenderReport (void)
 
void IncrementCounts (uint32_t ulOctetCount, rtpts_t RTPTimestampBase, rtpts_t RTPTimestamp, ssrc_t ssrc)
 
void CSR_SetRTPTimestamp (uint32_t ulRandomOffset, uint32_t ulSamplesPerSecond=SAMPLES_PER_SEC)
 
virtual void SetSRAdjustUSecs (int iUSecs=0)
 
void GetSenderStatistics (uint32_t *ulPacketCount, uint32_t *ulOctetCount)
 
ssrc_t GetSSRC (void)
 
virtual void SetSSRC (ssrc_t ulSSRC)
 
bool WasMediaSent (void)
 
unsigned long FormatSenderReport (unsigned char *puchReportBuffer, unsigned long ulBufferSize=0)
 
unsigned long ParseSenderReport (unsigned char *puchReportBuffer)
 
- Public Member Functions inherited from CBaseClass
CBaseClass CBASECLASS_PROTO_ARGS ((const char *pDerivedType="Unknown", int callLineNum=0))
 
virtual ~CBaseClass (void)
 
virtual bool Initialize (void)
 
bool IsInitialized (void)
 
void setAutomatic (bool)
 
virtual unsigned long AddRef ADD_RELEASE_PROTO_ARGS ((int callLineNum))
 
virtual unsigned long Release ADD_RELEASE_PROTO_ARGS ((int callLineNum))
 
- Public Member Functions inherited from CRTCPHeader
 CRTCPHeader (ssrc_t ulSSRC, RTCP_REPORTS_ET etPayloadType, unsigned long ulVersion=2)
 
virtual ~CRTCPHeader (void)
 
virtual unsigned long GetHeaderLength (void)
 
virtual unsigned long GetVersion (void)
 
virtual unsigned long GetPadding (void)
 
virtual RTCP_REPORTS_ET GetPayload (void)
 
virtual unsigned long GetReportCount (void)
 
virtual unsigned long GetReportLength (void)
 
virtual bool IsOurSSRC (ssrc_t ulSSRC)
 

Private Member Functions

void ResetStatistics (void)
 
unsigned long LoadTimestamps (uint32_t *paulTimeStamps)
 
unsigned long LoadSenderStats (uint32_t *paulSenderStats)
 
unsigned long ExtractTimestamps (uint32_t *paulTimestamps)
 
unsigned long ExtractSenderStats (uint32_t *aulSenderStats)
 

Private Attributes

ISetReceiverStatistics * m_piSetReceiverStatistics
 
uint32_t m_ulPacketCount
 
uint32_t m_ulOctetCount
 
bool m_bMediaSent
 
uint32_t m_aulNTPTimestamp [2]
 
uint32_t m_aulNTPStartTime [2]
 
rtpts_t m_ulRTPTimestamp
 
rtpts_t m_ulRTPTimestampBase
 
rtpts_t m_ulRTPTimestamps [2]
 
uint32_t m_ulNTPSeconds [2]
 
uint32_t m_ulNTPuSecs [2]
 
int m_iTSCollectState
 
int m_iUSecAdjust
 

Additional Inherited Members

- Static Public Member Functions inherited from CBaseClass
static bool AllowDeletes (void)
 
static void s_SetAllowDeletes (int v)
 
- Static Public Member Functions inherited from CRTCPHeader
static int VetPacket (unsigned char *buffer, int bufferLen)
 
- Public Attributes inherited from CBaseClass
bool m_bInitialized
 
bool m_bAutomatic
 
int m_ulReferences
 
- Static Public Attributes inherited from CBaseClass
static bool s_bAllowDeletes = true
 
- Protected Member Functions inherited from CRTCPHeader
unsigned long FormatRTCPHeader (unsigned char *puchRTCPBuffer, unsigned long ulPadding, unsigned long ulCount, unsigned long ulPayloadLength)
 
bool ParseRTCPHeader (unsigned char *puchRTCPBuffer)
 
- Protected Attributes inherited from CRTCPHeader
unsigned long m_ulVersion
 
unsigned long m_ulPadding
 
unsigned long m_ulCount
 
RTCP_REPORTS_ET m_etPayloadType
 
unsigned long m_ulLength
 
unsigned long m_ulSSRC
 

Detailed Description

Class Name: CSenderReport

Inheritance: CRTCPHeader - RTCP Report Header Base Class

Interfaces: ISenderReport - RTCP Sender Report Interface

Description: The CSenderReport Class coordinates the processing and generation of RTCP sender reports associated with either an inbound or outbound RTP connection.

Notes: CSenderReport is derived from CBaseClass which provides basic Initialization and reference counting support.

Constructor & Destructor Documentation

CSenderReport ( ssrc_t  ulSSRC,
ISetReceiverStatistics *  piSetStatistics = NULL 
)

Method Name: CSenderReport() - Constructor

Inputs: ssrc_t ulSSRC - The Identifier for this source ISetReceiverStatistics *piSetStatistics

  • Interface for setting receiver stats

Outputs: None

Returns: None

Description: Performs routine CSenderReport object initialization.

Usage Notes: A CSenderReport object shall be created by the CRTCPRender with this constructor. The Sender shall be responsible for maintain sender statistics related to an outbound RTP connection. The constructor shall be pass the SSRC and an optional pointer to the Set Statistics interface of the receiver report.

~CSenderReport ( void  )

Method Name: ~CSenderReport() - Destructor

Inputs: None

Outputs: None

Returns: None

Description: Shall deallocated and/or release all resources which was acquired over the course of runtime.

Usage Notes:

Member Function Documentation

void IncrementCounts ( uint32_t  ulOctetCount,
rtpts_t  RTPTimestampBase,
rtpts_t  RTPTimestamp,
ssrc_t  ssrc 
)

Method Name: IncrementCounts

Inputs: uint32_t ulOctetCount - RTP Octets Sent

Outputs: None

Returns: void

Description: The IncrementCounts method shall add the number of octets passed to the cumulative octet count stored as an attribute to this object. Each call to IncrementCounts() shall also increment the packet count by 1.

Usage Notes:

void CSR_SetRTPTimestamp ( uint32_t  ulRandomOffset,
uint32_t  ulSamplesPerSecond = SAMPLES_PER_SEC 
)

Method Name: SetRTPTimestamp

Inputs: uint32_t ulRandomOffset - Random Offset for RTP Timestamp uint32_t ulSamplesPerSecond - Number of sample per second

Outputs: None

Returns: void

Description: The SetRTPTimestamp method shall initialized values that are used to determine the RTP Timestamp value to be sent out in an SR Report.

Usage Notes:

virtual void SetSRAdjustUSecs ( int  iUSecs = 0)
virtual

Method Name: SetSRAdjustUSecs

Inputs: int iUSecs - signed # of microseconds of skew adjustment

Outputs: None

Returns: void

Description: The SetSRAdjustUSecs method sets an adjustment for skew, in microseconds, for the RTP time in the SR Report.

Usage Notes:

void GetSenderStatistics ( uint32_t *  ulPacketCount,
uint32_t *  ulOctetCount 
)

Method Name: GetSenderStatistics

Inputs: None

Outputs: uint32_t *ulPacketCount - Sender Packet Count uint32_t *ulOctetCount - Sender Octet Count

Returns: void

Description: Returns the packet and octet counts values stored as attributes.

Usage Notes:

ssrc_t GetSSRC ( void  )
inlinevirtual

Method Name: GetSSRC

Inputs: None

Outputs: None

Returns: unsigned ssrc_t - The SSRC of the Bye Report

Description: Returns the SSRC Associated with the Bye Report.

Usage Notes:

Method Name: GetSSRC

Inputs: None

Outputs: None

Returns: ssrc_t - The SSRC of the Bye Report

Description: Returns the SSRC Associated with the Bye Report.

Usage Notes:

Reimplemented from CRTCPHeader.

virtual void SetSSRC ( ssrc_t  ulSSRC)
virtual

Method Name: SetSSRC

Inputs: unsigned ssrc_t ulSSRC - Source ID

Outputs: None

Returns: void

Description: Stores the Source Identifier associated with an RTP connection.

Usage Notes: This is an override of the base class method defined in CRTCPHeader. This method shall additionally reset the octet and packet count accumulators as mandated by standard.

Reimplemented from CRTCPHeader.

bool WasMediaSent ( void  )

Method Name: WasMediaSent

Inputs: None

Outputs: None

Returns: bool

Description: A method to determine whether media has been sent out since the last reporting period. This will determine whether a Sender Report or Receiver Report is in order.

Usage Notes:

unsigned long FormatSenderReport ( unsigned char *  puchReportBuffer,
unsigned long  ulBufferSize = 0 
)

Method Name: FormatSenderReport

Inputs: uint32_t ulBufferSize

  • Optional length allocated for the buffer

Outputs: unsigned char *puchReportBuffer

  • Buffer to hold the Sender Report

Returns: uint32_t - number of octets written into the buffer.

Description: Constructs a Sender report using the buffer passed in by the caller. The Sender Report object shall keep track of the reporting periods that have passed an which information should be used to populate the report.

Usage Notes: The header of the RTCP Report shall be formatted by delegating to the base class.

unsigned long ParseSenderReport ( unsigned char *  puchReportBuffer)

Method Name: ParseSenderReport

Inputs: unsigned char *puchReportBuffer

  • Buffer containing the Sender Report

Outputs: None

Returns: uint32_t

Description: Extracts the contents of an Sender report using the buffer passed in by the caller. The Sender Report object shall store the content and length of data fields extracted from the Sender Report. The timestamps identifying the time of SR report reception shall obtained and sent with the SR Send timestamp to the associated Receiver Report through the SetLastRcvdSRTime() method of the ISetReceiverStatistics interface.

Usage Notes: The header of the RTCP Report shall be parsed by delegating to the base class.

void ResetStatistics ( void  )
private

Macro Name: DECLARE_IBASE_M

Inputs: None

Outputs: None

Returns: None

Description: This implements the IBaseClass functions used and exposed by derived classes.

Usage Notes:

Method Name: ResetStatistics

Inputs: None

Outputs: None

Returns: void

Description: This method shall reset all sedner report statistics. A reset shall occur when the SSRC ID is reset due to a collision with a participating source.

Usage Notes:

unsigned long LoadTimestamps ( uint32_t *  paulTimeStamps)
private

Method Name: LoadTimestamps

Inputs: None

Outputs: uint32_t *aulTimeStamps - Long word array in which to load the NTP/RTP timestamp

Returns: uint32_t - Size of the data loaded

Description: This method shall load the 64 bit NTP timestamp and the 32-bit RTP timestamp into the int32_t word array passed as an argument to this call.

Usage Notes:

unsigned long LoadSenderStats ( uint32_t *  paulSenderStats)
private

Method Name: LoadSenderStats

Inputs: None

Outputs: uint32_t *aulSenderStats

  • Long word array in which to load the statistics

Returns: uint32_t - Amount of data loaded

Description: This method shall retrieve the packet and octet counts.

Usage Notes:

unsigned long ExtractTimestamps ( uint32_t *  paulTimestamps)
private

Method Name: ExtractTimestamps

Inputs: uint32_t *paulTimestamps

  • Array containing the NTP/RTP Timestamps

Outputs: None

Returns: uint32_t - Size of the data extracted

Description: This method shall extract the 64 bits of NTP time information and the 32-bits of RTP timestamp and store them both in respective report attributes.

Usage Notes:

unsigned long ExtractSenderStats ( uint32_t *  aulSenderStats)
private

Method Name: ExtractSenderStats

Inputs: uint32_t *aulSenderStats

  • Long word array in which to load the statistics

Outputs: None

Returns: uint32_t - Amount of data extracted

Description: This method shall extract the packet and octet counts from the Sender Report.

Usage Notes:

Member Data Documentation

ISetReceiverStatistics* m_piSetReceiverStatistics
private

Attribute Name: m_piSetReceiverStatistics

Type: ISetReceiverStatistics

Description: Interface used by the Sender Report of an associated inbound RTP connection to update SR timestamp information within the corresponding Receiver Report.

uint32_t m_ulPacketCount
private

Attribute Name: m_ulPacketCount

Type: uint32_t

Description: This member shall store the cumlative sender packet count.

uint32_t m_ulOctetCount
private

Attribute Name: m_ulOctetCount

Type: uint32_t

Description: This member shall store the cumlative sender octet count.

bool m_bMediaSent
private

Attribute Name: m_bMediaSent

Type: bool

Description: This member shall identify whether media was sent over a particular reporting period.

uint32_t m_aulNTPTimestamp[2]
private

Attribute Name: m_aulNTPTimestamp

Type: uint32_t [2]

Description: This member shall store the 64 bit Network TimeStamp.

uint32_t m_aulNTPStartTime[2]
private

Attribute Name: m_aulNTPStartTime

Type: uint32_t [2]

Description: This member shall store the 64 bit Network Starting TimeStamp for the RTP Stream.

rtpts_t m_ulRTPTimestamp
private

Attribute Name: m_ulRTPTimestamp

Type: uint32_t

Description: This member shall store the 32 bit RTP TimeStamp identifying when a Sender Report was sent.

rtpts_t m_ulRTPTimestampBase
private

These are used to save the NTP time and the RTP timestamp of the last two outgoing RTP packets with DIFFERENT timestamps. These are then used when creating the next SR, to extrapolate to the current RTP timestamp corresponding to the NTP time when the SR is sent.

rtpts_t m_ulRTPTimestamps[2]
private
uint32_t m_ulNTPSeconds[2]
private
uint32_t m_ulNTPuSecs[2]
private
int m_iTSCollectState
private
int m_iUSecAdjust
private