niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_UTILITY_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ |
| 13 | |
| 14 | #include <cstddef> // size_t, ptrdiff_t |
| 15 | |
| 16 | #include "typedefs.h" |
| 17 | #include "rtp_rtcp_config.h" |
| 18 | #include "rtp_rtcp_defines.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | namespace RTCPUtility { |
| 22 | // CNAME |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 23 | struct RTCPCnameInformation |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | { |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 25 | char name[RTCP_CNAME_SIZE]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 26 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | struct RTCPPacketRR |
| 28 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 29 | uint32_t SenderSSRC; |
| 30 | uint8_t NumberOfReportBlocks; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | }; |
| 32 | struct RTCPPacketSR |
| 33 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 34 | uint32_t SenderSSRC; |
| 35 | uint8_t NumberOfReportBlocks; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
| 37 | // sender info |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 38 | uint32_t NTPMostSignificant; |
| 39 | uint32_t NTPLeastSignificant; |
| 40 | uint32_t RTPTimestamp; |
| 41 | uint32_t SenderPacketCount; |
| 42 | uint32_t SenderOctetCount; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | }; |
| 44 | struct RTCPPacketReportBlockItem |
| 45 | { |
| 46 | // report block |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 47 | uint32_t SSRC; |
| 48 | uint8_t FractionLost; |
| 49 | uint32_t CumulativeNumOfPacketsLost; |
| 50 | uint32_t ExtendedHighestSequenceNumber; |
| 51 | uint32_t Jitter; |
| 52 | uint32_t LastSR; |
| 53 | uint32_t DelayLastSR; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | struct RTCPPacketSDESCName |
| 56 | { |
| 57 | // RFC3550 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 58 | uint32_t SenderSSRC; |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 59 | char CName[RTCP_CNAME_SIZE]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 62 | struct RTCPPacketExtendedJitterReportItem |
| 63 | { |
| 64 | // RFC 5450 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 65 | uint32_t Jitter; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 68 | struct RTCPPacketBYE |
| 69 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 70 | uint32_t SenderSSRC; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | }; |
| 72 | struct RTCPPacketXR |
| 73 | { |
| 74 | // RFC 3611 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 75 | uint32_t OriginatorSSRC; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | }; |
| 77 | struct RTCPPacketXRVOIPMetricItem |
| 78 | { |
| 79 | // RFC 3611 4.7 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 80 | uint32_t SSRC; |
| 81 | uint8_t lossRate; |
| 82 | uint8_t discardRate; |
| 83 | uint8_t burstDensity; |
| 84 | uint8_t gapDensity; |
| 85 | uint16_t burstDuration; |
| 86 | uint16_t gapDuration; |
| 87 | uint16_t roundTripDelay; |
| 88 | uint16_t endSystemDelay; |
| 89 | uint8_t signalLevel; |
| 90 | uint8_t noiseLevel; |
| 91 | uint8_t RERL; |
| 92 | uint8_t Gmin; |
| 93 | uint8_t Rfactor; |
| 94 | uint8_t extRfactor; |
| 95 | uint8_t MOSLQ; |
| 96 | uint8_t MOSCQ; |
| 97 | uint8_t RXconfig; |
| 98 | uint16_t JBnominal; |
| 99 | uint16_t JBmax; |
| 100 | uint16_t JBabsMax; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | struct RTCPPacketRTPFBNACK |
| 104 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 105 | uint32_t SenderSSRC; |
| 106 | uint32_t MediaSSRC; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | }; |
| 108 | struct RTCPPacketRTPFBNACKItem |
| 109 | { |
| 110 | // RFC4585 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 111 | uint16_t PacketID; |
| 112 | uint16_t BitMask; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | struct RTCPPacketRTPFBTMMBR |
| 116 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 117 | uint32_t SenderSSRC; |
| 118 | uint32_t MediaSSRC; // zero! |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | }; |
| 120 | struct RTCPPacketRTPFBTMMBRItem |
| 121 | { |
| 122 | // RFC5104 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 123 | uint32_t SSRC; |
| 124 | uint32_t MaxTotalMediaBitRate; // In Kbit/s |
| 125 | uint32_t MeasuredOverhead; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | struct RTCPPacketRTPFBTMMBN |
| 129 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 130 | uint32_t SenderSSRC; |
| 131 | uint32_t MediaSSRC; // zero! |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 132 | }; |
| 133 | struct RTCPPacketRTPFBTMMBNItem |
| 134 | { |
| 135 | // RFC5104 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 136 | uint32_t SSRC; // "Owner" |
| 137 | uint32_t MaxTotalMediaBitRate; |
| 138 | uint32_t MeasuredOverhead; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | struct RTCPPacketPSFBFIR |
| 142 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 143 | uint32_t SenderSSRC; |
| 144 | uint32_t MediaSSRC; // zero! |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 145 | }; |
| 146 | struct RTCPPacketPSFBFIRItem |
| 147 | { |
| 148 | // RFC5104 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 149 | uint32_t SSRC; |
| 150 | uint8_t CommandSequenceNumber; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 151 | }; |
| 152 | |
| 153 | struct RTCPPacketPSFBPLI |
| 154 | { |
| 155 | // RFC4585 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 156 | uint32_t SenderSSRC; |
| 157 | uint32_t MediaSSRC; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | struct RTCPPacketPSFBSLI |
| 161 | { |
| 162 | // RFC4585 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 163 | uint32_t SenderSSRC; |
| 164 | uint32_t MediaSSRC; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 165 | }; |
| 166 | struct RTCPPacketPSFBSLIItem |
| 167 | { |
| 168 | // RFC4585 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 169 | uint16_t FirstMB; |
| 170 | uint16_t NumberOfMB; |
| 171 | uint8_t PictureId; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 172 | }; |
| 173 | struct RTCPPacketPSFBRPSI |
| 174 | { |
| 175 | // RFC4585 |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 176 | uint32_t SenderSSRC; |
| 177 | uint32_t MediaSSRC; |
| 178 | uint8_t PayloadType; |
| 179 | uint16_t NumberOfValidBits; |
| 180 | uint8_t NativeBitString[RTCP_RPSI_DATA_SIZE]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 181 | }; |
asapersson@webrtc.org | a768970 | 2012-04-19 07:01:29 +0000 | [diff] [blame] | 182 | struct RTCPPacketPSFBAPP |
| 183 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 184 | uint32_t SenderSSRC; |
| 185 | uint32_t MediaSSRC; |
asapersson@webrtc.org | a768970 | 2012-04-19 07:01:29 +0000 | [diff] [blame] | 186 | }; |
| 187 | struct RTCPPacketPSFBREMBItem |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 188 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 189 | uint32_t BitRate; |
| 190 | uint8_t NumberOfSSRCs; |
| 191 | uint32_t SSRCs[MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS]; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 192 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 193 | // generic name APP |
| 194 | struct RTCPPacketAPP |
| 195 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 196 | uint8_t SubType; |
| 197 | uint32_t Name; |
| 198 | uint8_t Data[kRtcpAppCode_DATA_SIZE]; |
| 199 | uint16_t Size; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | union RTCPPacket |
| 203 | { |
| 204 | RTCPPacketRR RR; |
| 205 | RTCPPacketSR SR; |
| 206 | RTCPPacketReportBlockItem ReportBlockItem; |
| 207 | |
| 208 | RTCPPacketSDESCName CName; |
| 209 | RTCPPacketBYE BYE; |
| 210 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 211 | RTCPPacketExtendedJitterReportItem ExtendedJitterReportItem; |
| 212 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 213 | RTCPPacketRTPFBNACK NACK; |
| 214 | RTCPPacketRTPFBNACKItem NACKItem; |
| 215 | |
| 216 | RTCPPacketPSFBPLI PLI; |
| 217 | RTCPPacketPSFBSLI SLI; |
| 218 | RTCPPacketPSFBSLIItem SLIItem; |
| 219 | RTCPPacketPSFBRPSI RPSI; |
asapersson@webrtc.org | a768970 | 2012-04-19 07:01:29 +0000 | [diff] [blame] | 220 | RTCPPacketPSFBAPP PSFBAPP; |
| 221 | RTCPPacketPSFBREMBItem REMBItem; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 222 | |
| 223 | RTCPPacketRTPFBTMMBR TMMBR; |
| 224 | RTCPPacketRTPFBTMMBRItem TMMBRItem; |
| 225 | RTCPPacketRTPFBTMMBN TMMBN; |
| 226 | RTCPPacketRTPFBTMMBNItem TMMBNItem; |
| 227 | RTCPPacketPSFBFIR FIR; |
| 228 | RTCPPacketPSFBFIRItem FIRItem; |
| 229 | |
| 230 | RTCPPacketXR XR; |
| 231 | RTCPPacketXRVOIPMetricItem XRVOIPMetricItem; |
| 232 | |
| 233 | RTCPPacketAPP APP; |
| 234 | }; |
| 235 | |
| 236 | enum RTCPPacketTypes |
| 237 | { |
| 238 | kRtcpNotValidCode, |
| 239 | |
| 240 | // RFC3550 |
| 241 | kRtcpRrCode, |
| 242 | kRtcpSrCode, |
| 243 | kRtcpReportBlockItemCode, |
| 244 | |
| 245 | kRtcpSdesCode, |
| 246 | kRtcpSdesChunkCode, |
| 247 | kRtcpByeCode, |
| 248 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 249 | // RFC5450 |
| 250 | kRtcpExtendedIjCode, |
| 251 | kRtcpExtendedIjItemCode, |
| 252 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 253 | // RFC4585 |
| 254 | kRtcpRtpfbNackCode, |
| 255 | kRtcpRtpfbNackItemCode, |
| 256 | |
| 257 | kRtcpPsfbPliCode, |
| 258 | kRtcpPsfbRpsiCode, |
| 259 | kRtcpPsfbSliCode, |
| 260 | kRtcpPsfbSliItemCode, |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 261 | kRtcpPsfbAppCode, |
asapersson@webrtc.org | a768970 | 2012-04-19 07:01:29 +0000 | [diff] [blame] | 262 | kRtcpPsfbRembCode, |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 263 | kRtcpPsfbRembItemCode, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 264 | |
| 265 | // RFC5104 |
| 266 | kRtcpRtpfbTmmbrCode, |
| 267 | kRtcpRtpfbTmmbrItemCode, |
| 268 | kRtcpRtpfbTmmbnCode, |
| 269 | kRtcpRtpfbTmmbnItemCode, |
| 270 | kRtcpPsfbFirCode, |
| 271 | kRtcpPsfbFirItemCode, |
| 272 | |
| 273 | // draft-perkins-avt-rapid-rtp-sync |
| 274 | kRtcpRtpfbSrReqCode, |
| 275 | |
| 276 | // RFC 3611 |
| 277 | kRtcpXrVoipMetricCode, |
| 278 | |
| 279 | kRtcpAppCode, |
| 280 | kRtcpAppItemCode, |
| 281 | }; |
| 282 | |
| 283 | struct RTCPRawPacket |
| 284 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 285 | const uint8_t* _ptrPacketBegin; |
| 286 | const uint8_t* _ptrPacketEnd; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 287 | }; |
| 288 | |
| 289 | struct RTCPModRawPacket |
| 290 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 291 | uint8_t* _ptrPacketBegin; |
| 292 | uint8_t* _ptrPacketEnd; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 293 | }; |
| 294 | |
| 295 | struct RTCPCommonHeader |
| 296 | { |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 297 | uint8_t V; // Version |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 298 | bool P; // Padding |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 299 | uint8_t IC; // Item count/subtype |
| 300 | uint8_t PT; // Packet Type |
| 301 | uint16_t LengthInOctets; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 302 | }; |
| 303 | |
| 304 | enum RTCPPT |
| 305 | { |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 306 | PT_IJ = 195, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 307 | PT_SR = 200, |
| 308 | PT_RR = 201, |
| 309 | PT_SDES = 202, |
| 310 | PT_BYE = 203, |
| 311 | PT_APP = 204, |
| 312 | PT_RTPFB = 205, |
| 313 | PT_PSFB = 206, |
| 314 | PT_XR = 207 |
| 315 | }; |
| 316 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 317 | bool RTCPParseCommonHeader( const uint8_t* ptrDataBegin, |
| 318 | const uint8_t* ptrDataEnd, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 319 | RTCPCommonHeader& parsedHeader); |
| 320 | |
| 321 | class RTCPParserV2 |
| 322 | { |
| 323 | public: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 324 | RTCPParserV2(const uint8_t* rtcpData, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 325 | size_t rtcpDataLength, |
| 326 | bool rtcpReducedSizeEnable); // Set to true, to allow non-compound RTCP! |
| 327 | ~RTCPParserV2(); |
| 328 | |
| 329 | RTCPPacketTypes PacketType() const; |
| 330 | const RTCPPacket& Packet() const; |
| 331 | const RTCPRawPacket& RawPacket() const; |
| 332 | ptrdiff_t LengthLeft() const; |
| 333 | |
| 334 | bool IsValid() const; |
| 335 | |
| 336 | RTCPPacketTypes Begin(); |
| 337 | RTCPPacketTypes Iterate(); |
| 338 | |
| 339 | private: |
| 340 | enum ParseState |
| 341 | { |
| 342 | State_TopLevel, // Top level packet |
| 343 | State_ReportBlockItem, // SR/RR report block |
| 344 | State_SDESChunk, // SDES chunk |
| 345 | State_BYEItem, // BYE item |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 346 | State_ExtendedJitterItem, // Extended jitter report item |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 347 | State_RTPFB_NACKItem, // NACK FCI item |
| 348 | State_RTPFB_TMMBRItem, // TMMBR FCI item |
| 349 | State_RTPFB_TMMBNItem, // TMMBN FCI item |
| 350 | State_PSFB_SLIItem, // SLI FCI item |
| 351 | State_PSFB_RPSIItem, // RPSI FCI item |
| 352 | State_PSFB_FIRItem, // FIR FCI item |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 353 | State_PSFB_AppItem, // Application specific FCI item |
| 354 | State_PSFB_REMBItem, // Application specific REMB item |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 355 | State_XRItem, |
| 356 | State_AppItem |
| 357 | }; |
| 358 | |
| 359 | private: |
| 360 | void IterateTopLevel(); |
| 361 | void IterateReportBlockItem(); |
| 362 | void IterateSDESChunk(); |
| 363 | void IterateBYEItem(); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 364 | void IterateExtendedJitterItem(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 365 | void IterateNACKItem(); |
| 366 | void IterateTMMBRItem(); |
| 367 | void IterateTMMBNItem(); |
| 368 | void IterateSLIItem(); |
| 369 | void IterateRPSIItem(); |
| 370 | void IterateFIRItem(); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 371 | void IteratePsfbAppItem(); |
| 372 | void IteratePsfbREMBItem(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 373 | void IterateAppItem(); |
| 374 | |
| 375 | void Validate(); |
| 376 | void EndCurrentBlock(); |
| 377 | |
| 378 | bool ParseRR(); |
| 379 | bool ParseSR(); |
| 380 | bool ParseReportBlockItem(); |
| 381 | |
| 382 | bool ParseSDES(); |
| 383 | bool ParseSDESChunk(); |
| 384 | bool ParseSDESItem(); |
| 385 | |
| 386 | bool ParseBYE(); |
| 387 | bool ParseBYEItem(); |
| 388 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 389 | bool ParseIJ(); |
| 390 | bool ParseIJItem(); |
| 391 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 392 | bool ParseXR(); |
| 393 | bool ParseXRItem(); |
| 394 | bool ParseXRVOIPMetricItem(); |
| 395 | |
| 396 | bool ParseFBCommon(const RTCPCommonHeader& header); |
| 397 | bool ParseNACKItem(); |
| 398 | bool ParseTMMBRItem(); |
| 399 | bool ParseTMMBNItem(); |
| 400 | bool ParseSLIItem(); |
| 401 | bool ParseRPSIItem(); |
| 402 | bool ParseFIRItem(); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 403 | bool ParsePsfbAppItem(); |
| 404 | bool ParsePsfbREMBItem(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 405 | |
| 406 | bool ParseAPP(const RTCPCommonHeader& header); |
| 407 | bool ParseAPPItem(); |
| 408 | |
| 409 | private: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 410 | const uint8_t* const _ptrRTCPDataBegin; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 411 | const bool _RTCPReducedSizeEnable; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 412 | const uint8_t* const _ptrRTCPDataEnd; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 413 | |
| 414 | bool _validPacket; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 415 | const uint8_t* _ptrRTCPData; |
| 416 | const uint8_t* _ptrRTCPBlockEnd; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 417 | |
| 418 | ParseState _state; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 419 | uint8_t _numberOfBlocks; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 420 | |
| 421 | RTCPPacketTypes _packetType; |
| 422 | RTCPPacket _packet; |
| 423 | }; |
| 424 | |
| 425 | class RTCPPacketIterator |
| 426 | { |
| 427 | public: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 428 | RTCPPacketIterator(uint8_t* rtcpData, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 429 | size_t rtcpDataLength); |
| 430 | ~RTCPPacketIterator(); |
| 431 | |
| 432 | const RTCPCommonHeader* Begin(); |
| 433 | const RTCPCommonHeader* Iterate(); |
| 434 | const RTCPCommonHeader* Current(); |
| 435 | |
| 436 | private: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 437 | uint8_t* const _ptrBegin; |
| 438 | uint8_t* const _ptrEnd; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 439 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 440 | uint8_t* _ptrBlock; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 441 | |
| 442 | RTCPCommonHeader _header; |
| 443 | }; |
| 444 | } // RTCPUtility |
| 445 | } // namespace webrtc |
| 446 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_UTILITY_H_ |