rtcp_receiver_help.h revision 14b43beb7ce4440b30dcea31196de5b4a529cb6b
1/*
2 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_
13
14#include <vector>
15
16#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"  // RTCPReportBlock
17#include "modules/rtp_rtcp/source/rtcp_utility.h"
18#include "modules/rtp_rtcp/source/tmmbr_help.h"
19#include "typedefs.h"
20
21namespace webrtc {
22namespace RTCPHelp
23{
24
25class RTCPPacketInformation
26{
27public:
28    RTCPPacketInformation();
29    ~RTCPPacketInformation();
30
31    void AddVoIPMetric(const RTCPVoIPMetric*  metric);
32
33    void AddApplicationData(const WebRtc_UWord8* data,
34                            const WebRtc_UWord16 size);
35
36    void AddNACKPacket(const WebRtc_UWord16 packetID);
37    void ResetNACKPacketIdArray();
38
39    void AddReportInfo(const WebRtc_UWord8 fractionLost,
40                       const WebRtc_UWord16 rtt,
41                       const WebRtc_UWord32 extendedHighSeqNum,
42                       const WebRtc_UWord32 jitter);
43
44    WebRtc_UWord32  rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
45    WebRtc_UWord32  remoteSSRC;
46
47    WebRtc_UWord16* nackSequenceNumbers;
48    WebRtc_UWord16  nackSequenceNumbersLength;
49
50    WebRtc_UWord8   applicationSubType;
51    WebRtc_UWord32  applicationName;
52    WebRtc_UWord8*  applicationData;
53    WebRtc_UWord16  applicationLength;
54
55    bool            reportBlock;
56    WebRtc_UWord8   fractionLost;
57    WebRtc_UWord16  roundTripTime;
58    WebRtc_UWord32  lastReceivedExtendedHighSeqNum;
59    WebRtc_UWord32  jitter;
60
61    WebRtc_UWord32  interArrivalJitter;
62
63    WebRtc_UWord8   sliPictureId;
64    WebRtc_UWord64  rpsiPictureId;
65    WebRtc_UWord32  receiverEstimatedMaxBitrate;
66
67    uint32_t ntp_secs;
68    uint32_t ntp_frac;
69    uint32_t rtp_timestamp;
70
71    RTCPVoIPMetric*  VoIPMetric;
72};
73
74
75class RTCPReportBlockInformation
76{
77public:
78    RTCPReportBlockInformation();
79    ~RTCPReportBlockInformation();
80
81    // Statistics
82    RTCPReportBlock remoteReceiveBlock;
83    WebRtc_UWord32        remoteMaxJitter;
84
85    // RTT
86    WebRtc_UWord16    RTT;
87    WebRtc_UWord16    minRTT;
88    WebRtc_UWord16    maxRTT;
89    WebRtc_UWord16    avgRTT;
90    WebRtc_UWord32    numAverageCalcs;
91};
92
93class RTCPReceiveInformation
94{
95public:
96    RTCPReceiveInformation();
97    ~RTCPReceiveInformation();
98
99    void VerifyAndAllocateBoundingSet(const WebRtc_UWord32 minimumSize);
100    void VerifyAndAllocateTMMBRSet(const WebRtc_UWord32 minimumSize);
101
102    void InsertTMMBRItem(const WebRtc_UWord32 senderSSRC,
103                         const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
104                         const WebRtc_Word64 currentTimeMS);
105
106    // get
107    WebRtc_Word32 GetTMMBRSet(const WebRtc_UWord32 sourceIdx,
108                              const WebRtc_UWord32 targetIdx,
109                              TMMBRSet* candidateSet,
110                              const WebRtc_Word64 currentTimeMS);
111
112    WebRtc_Word64 lastTimeReceived;
113
114    // FIR
115    WebRtc_Word32 lastFIRSequenceNumber;
116    WebRtc_Word64 lastFIRRequest;
117
118    // TMMBN
119    TMMBRSet        TmmbnBoundingSet;
120
121    // TMMBR
122    TMMBRSet        TmmbrSet;
123
124    bool            readyForDelete;
125private:
126    std::vector<WebRtc_Word64> _tmmbrSetTimeouts;
127};
128
129} // end namespace RTCPHelp
130} // namespace webrtc
131
132#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_
133