• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <list>
15 #include <vector>
16 
17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"  // RTCPReportBlock
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
21 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
22 #include "webrtc/typedefs.h"
23 
24 namespace webrtc {
25 namespace rtcp {
26 class TransportFeedback;
27 }
28 namespace RTCPHelp
29 {
30 
31 class RTCPReportBlockInformation
32 {
33 public:
34     RTCPReportBlockInformation();
35     ~RTCPReportBlockInformation();
36 
37     // Statistics
38     RTCPReportBlock remoteReceiveBlock;
39     uint32_t        remoteMaxJitter;
40 
41     // RTT
42     int64_t  RTT;
43     int64_t  minRTT;
44     int64_t  maxRTT;
45     int64_t  avgRTT;
46     uint32_t numAverageCalcs;
47 };
48 
49 class RTCPPacketInformation
50 {
51 public:
52     RTCPPacketInformation();
53     ~RTCPPacketInformation();
54 
55     void AddVoIPMetric(const RTCPVoIPMetric*  metric);
56 
57     void AddApplicationData(const uint8_t* data,
58                             const uint16_t size);
59 
60     void AddNACKPacket(const uint16_t packetID);
61     void ResetNACKPacketIdArray();
62 
63     void AddReportInfo(const RTCPReportBlockInformation& report_block_info);
64 
65     uint32_t  rtcpPacketTypeFlags; // RTCPPacketTypeFlags bit field
66     uint32_t  remoteSSRC;
67 
68     std::list<uint16_t> nackSequenceNumbers;
69 
70     uint8_t   applicationSubType;
71     uint32_t  applicationName;
72     uint8_t*  applicationData;
73     uint16_t  applicationLength;
74 
75     ReportBlockList report_blocks;
76     int64_t rtt;
77 
78     uint32_t  interArrivalJitter;
79 
80     uint8_t   sliPictureId;
81     uint64_t  rpsiPictureId;
82     uint32_t  receiverEstimatedMaxBitrate;
83 
84     uint32_t ntp_secs;
85     uint32_t ntp_frac;
86     uint32_t rtp_timestamp;
87 
88     uint32_t xr_originator_ssrc;
89     bool xr_dlrr_item;
90     RTCPVoIPMetric*  VoIPMetric;
91 
92     rtc::scoped_ptr<rtcp::TransportFeedback> transport_feedback_;
93 
94 private:
95     RTC_DISALLOW_COPY_AND_ASSIGN(RTCPPacketInformation);
96 };
97 
98 class RTCPReceiveInformation
99 {
100 public:
101     RTCPReceiveInformation();
102     ~RTCPReceiveInformation();
103 
104     void VerifyAndAllocateBoundingSet(const uint32_t minimumSize);
105     void VerifyAndAllocateTMMBRSet(const uint32_t minimumSize);
106 
107     void InsertTMMBRItem(const uint32_t senderSSRC,
108                          const RTCPUtility::RTCPPacketRTPFBTMMBRItem& TMMBRItem,
109                          const int64_t currentTimeMS);
110 
111     // get
112     int32_t GetTMMBRSet(const uint32_t sourceIdx,
113                         const uint32_t targetIdx,
114                         TMMBRSet* candidateSet,
115                         const int64_t currentTimeMS);
116 
117     int64_t lastTimeReceived;
118 
119     // FIR
120     int32_t lastFIRSequenceNumber;
121     int64_t lastFIRRequest;
122 
123     // TMMBN
124     TMMBRSet        TmmbnBoundingSet;
125 
126     // TMMBR
127     TMMBRSet        TmmbrSet;
128 
129     bool            readyForDelete;
130 private:
131     std::vector<int64_t> _tmmbrSetTimeouts;
132 };
133 
134 }  // end namespace RTCPHelp
135 }  // namespace webrtc
136 
137 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_HELP_H_
138