sipxmedialib  Version 3.3
SenderReport.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2013 SIPez LLC. All rights reserved.
3 //
4 // Copyright (C) 2004-2006 SIPfoundry Inc.
5 // Licensed by SIPfoundry under the LGPL license.
6 //
7 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
8 // Licensed to SIPfoundry under a Contributor Agreement.
9 //
10 // $$
12 
13 
14 // Border Guard
15 #ifndef _SenderReport_h
16 #define _SenderReport_h
17 
18 #include "rtcp/RtcpConfig.h"
19 
20 // Includes
21 #ifndef WIN32
22 #include <time.h>
23 #endif
24 
25 #include "RTCPHeader.h"
26 #include "ISenderReport.h"
27 #include "IGetSenderStatistics.h"
28 #include "ISetSenderStatistics.h"
29 #include "ISetReceiverStatistics.h"
30 
31 
50  public CBaseClass, // Inherits the CBaseClass implementation
51  public CRTCPHeader, // Inherits the CRTCPHeader implementation
52  public ISenderReport, // Sender Report Control Interface
53  public IGetSenderStatistics, // Get Sender Statistics Interface
54  public ISetSenderStatistics // Set Sender Statistics Interface
55 {
56 
57 // Public Methods
58 public:
59 
83  CSenderReport(ssrc_t ulSSRC,
84  ISetReceiverStatistics *piSetStatistics=NULL);
85 
86 
87 
106  ~CSenderReport(void);
107 
108 
128  void IncrementCounts(uint32_t ulOctetCount, rtpts_t RTPTimestampBase, rtpts_t RTPTimestamp, ssrc_t ssrc);
129 
149  void CSR_SetRTPTimestamp(uint32_t ulRandomOffset,
150  uint32_t ulSamplesPerSecond = SAMPLES_PER_SEC);
151 
152 
153 
171  virtual void SetSRAdjustUSecs(int iUSecs = 0);
172 
173 
193  void GetSenderStatistics(uint32_t *ulPacketCount,
194  uint32_t *ulOctetCount);
195 
214  ssrc_t GetSSRC(void);
215 
216 
237  virtual void SetSSRC(ssrc_t ulSSRC);
238 
257  bool WasMediaSent(void);
258 
259 
283  unsigned long FormatSenderReport(unsigned char *puchReportBuffer,
284  unsigned long ulBufferSize=0);
285 
286 
312 unsigned long ParseSenderReport(unsigned char *puchReportBuffer);
313 
333 
334 private: // Private Methods
335 
336 
355  void ResetStatistics(void);
356 
376  unsigned long LoadTimestamps(uint32_t *paulTimeStamps);
377 
378 
379 
397  unsigned long LoadSenderStats(uint32_t *paulSenderStats);
398 
399 
419  unsigned long ExtractTimestamps(uint32_t *paulTimestamps);
420 
421 
440  unsigned long ExtractSenderStats(uint32_t *aulSenderStats);
441 
442 
443 
444 private: // Private Data Members
445 
446 
458  ISetReceiverStatistics *m_piSetReceiverStatistics;
459 
469  uint32_t m_ulPacketCount;
470 
480  uint32_t m_ulOctetCount;
481 
493 
503  uint32_t m_aulNTPTimestamp[2];
504 
505 
516  uint32_t m_aulNTPStartTime[2];
517 
529 
540  uint32_t m_ulNTPSeconds[2];
541  uint32_t m_ulNTPuSecs[2];
542 
544 
545 /*
546  * And this is a fudge-factor to be applied to the RTP timestamp
547  * calculation in the SR generation. It is the (signed) number of
548  * microseconds to adjust the clock time by when extrapolating the
549  * RTP timestamp, to compensate for delay in the MpMedia system.
550  * Yes, it is a bit of a hack...
551  */
552 
554 };
555 
556 
576 {
577 
578  return(CRTCPHeader::GetSSRC());
579 
580 }
581 
582 #endif
interface rtpts_t rtpts_t RTPTimestamp
Definition: ISetSenderStatistics.h:68
interface unsigned long ulBufferSize
Definition: INetworkSource.h:54
rtpts_t m_ulRTPTimestamp
Definition: SenderReport.h:528
uint32_t m_ulOctetCount
Definition: SenderReport.h:480
uint32_t rtpts_t
Definition: RtcpConfig.h:63
uint32_t m_ulNTPuSecs[2]
Definition: SenderReport.h:541
bool m_bMediaSent
Definition: SenderReport.h:492
unsigned long ExtractSenderStats(uint32_t *aulSenderStats)
int m_iUSecAdjust
Definition: SenderReport.h:553
uint32_t m_aulNTPStartTime[2]
Definition: SenderReport.h:516
unsigned long LoadSenderStats(uint32_t *paulSenderStats)
virtual void SetSRAdjustUSecs(int iUSecs=0)
unsigned long FormatSenderReport(unsigned char *puchReportBuffer, unsigned long ulBufferSize=0)
ISetReceiverStatistics * m_piSetReceiverStatistics
Definition: SenderReport.h:458
unsigned long ParseSenderReport(unsigned char *puchReportBuffer)
void IncrementCounts(uint32_t ulOctetCount, rtpts_t RTPTimestampBase, rtpts_t RTPTimestamp, ssrc_t ssrc)
#define SAMPLES_PER_SEC
Definition: ISetSenderStatistics.h:25
interface long unsigned char * puchReportBuffer
Definition: ISDESReport.h:79
uint32_t m_ulPacketCount
Definition: SenderReport.h:469
bool WasMediaSent(void)
interface rtpts_t rtpts_t ssrc_t ssrc
Definition: ISetSenderStatistics.h:68
Definition: RTCPHeader.h:51
interface rtpts_t RTPTimestampBase
Definition: ISetSenderStatistics.h:68
#define DECLARE_IBASE_M
Definition: BaseClass.h:368
uint32_t ssrc_t
Definition: RtcpConfig.h:62
rtpts_t m_ulRTPTimestampBase
Definition: SenderReport.h:538
rtpts_t m_ulRTPTimestamps[2]
Definition: SenderReport.h:539
unsigned long LoadTimestamps(uint32_t *paulTimeStamps)
uint32_t m_aulNTPTimestamp[2]
Definition: SenderReport.h:503
Definition: BaseClass.h:118
int m_iTSCollectState
Definition: SenderReport.h:543
Definition: SenderReport.h:49
CSenderReport(ssrc_t ulSSRC, ISetReceiverStatistics *piSetStatistics=NULL)
unsigned long ExtractTimestamps(uint32_t *paulTimestamps)
void CSR_SetRTPTimestamp(uint32_t ulRandomOffset, uint32_t ulSamplesPerSecond=SAMPLES_PER_SEC)
virtual void SetSSRC(ssrc_t ulSSRC)
uint32_t m_ulNTPSeconds[2]
Definition: SenderReport.h:540
virtual ssrc_t GetSSRC(void)
void ResetStatistics(void)
void GetSenderStatistics(uint32_t *ulPacketCount, uint32_t *ulOctetCount)
ssrc_t GetSSRC(void)
Definition: SenderReport.h:575
~CSenderReport(void)