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_RECEIVER_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
| 13 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 14 | #include <map> |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 15 | #include <set> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 16 | #include <vector> |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 17 | |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 18 | #include "webrtc/base/thread_annotations.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 19 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 20 | #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h" |
| 21 | #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 22 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 23 | #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
| 24 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | |
| 26 | namespace webrtc { |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 27 | class ModuleRtpRtcpImpl; |
| 28 | |
pwestin@webrtc.org | cac7878 | 2012-04-05 08:30:10 +0000 | [diff] [blame] | 29 | class RTCPReceiver : public TMMBRHelp |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | { |
| 31 | public: |
Peter Boström | ac547a6 | 2015-09-17 23:03:57 +0200 | [diff] [blame] | 32 | RTCPReceiver(Clock* clock, |
Peter Boström | fe7a80c | 2015-04-23 17:53:17 +0200 | [diff] [blame] | 33 | bool receiver_only, |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 34 | RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
mflodman@webrtc.org | 96abda0 | 2015-02-25 13:50:10 +0000 | [diff] [blame] | 35 | RtcpBandwidthObserver* rtcp_bandwidth_observer, |
| 36 | RtcpIntraFrameObserver* rtcp_intra_frame_observer, |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 37 | TransportFeedbackObserver* transport_feedback_observer, |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 38 | ModuleRtpRtcpImpl* owner); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | virtual ~RTCPReceiver(); |
| 40 | |
pbos | da903ea | 2015-10-02 02:36:56 -0700 | [diff] [blame] | 41 | RtcpMode Status() const; |
| 42 | void SetRTCPStatus(RtcpMode method); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 44 | int64_t LastReceived(); |
| 45 | int64_t LastReceivedReceiverReport() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 47 | void SetSsrcs(uint32_t main_ssrc, |
| 48 | const std::set<uint32_t>& registered_ssrcs); |
asapersson@webrtc.org | df7b65b | 2015-01-21 13:07:04 +0000 | [diff] [blame] | 49 | void SetRemoteSSRC(uint32_t ssrc); |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 50 | uint32_t RemoteSSRC() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 51 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 52 | int32_t IncomingRTCPPacket( |
| 53 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, |
| 54 | RTCPUtility::RTCPParserV2 *rtcpParser); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | |
asapersson@webrtc.org | df7b65b | 2015-01-21 13:07:04 +0000 | [diff] [blame] | 56 | void TriggerCallbacksFromRTCPPacket( |
| 57 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
| 59 | // get received cname |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 60 | int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 61 | |
| 62 | // get received NTP |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 63 | bool NTP(uint32_t* ReceivedNTPsecs, |
| 64 | uint32_t* ReceivedNTPfrac, |
| 65 | uint32_t* RTCPArrivalTimeSecs, |
| 66 | uint32_t* RTCPArrivalTimeFrac, |
| 67 | uint32_t* rtcp_timestamp) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 68 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 69 | bool LastReceivedXrReferenceTimeInfo(RtcpReceiveTimeInfo* info) const; |
| 70 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | // get rtt |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 72 | int32_t RTT(uint32_t remoteSSRC, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 73 | int64_t* RTT, |
| 74 | int64_t* avgRTT, |
| 75 | int64_t* minRTT, |
| 76 | int64_t* maxRTT) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 78 | int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 79 | |
Danil Chapovalov | c1e55c7 | 2016-03-09 15:14:35 +0100 | [diff] [blame^] | 80 | void SetRtcpXrRrtrStatus(bool enable); |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 81 | bool GetAndResetXrRrRtt(int64_t* rtt_ms); |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 82 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | // get statistics |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 84 | int32_t StatisticsReceived( |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 85 | std::vector<RTCPReportBlock>* receiveBlocks) const; |
| 86 | |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 87 | // Returns true if we haven't received an RTCP RR for several RTCP |
| 88 | // intervals, but only triggers true once. |
| 89 | bool RtcpRrTimeout(int64_t rtcp_interval_ms); |
| 90 | |
| 91 | // Returns true if we haven't received an RTCP RR telling the receive side |
| 92 | // has not received RTP packets for too long, i.e. extended highest sequence |
| 93 | // number hasn't increased for several RTCP intervals. The function only |
| 94 | // returns true once until a new RR is received. |
| 95 | bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms); |
| 96 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 97 | // Get TMMBR |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 98 | int32_t TMMBRReceived(uint32_t size, |
| 99 | uint32_t accNumCandidates, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 100 | TMMBRSet* candidateSet) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 101 | |
| 102 | bool UpdateRTCPReceiveInformationTimers(); |
| 103 | |
danilchap | 6db6cdc | 2015-12-15 02:54:47 -0800 | [diff] [blame] | 104 | int32_t BoundingSet(bool* tmmbrOwner, TMMBRSet* boundingSetRec); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 105 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 106 | int32_t UpdateTMMBR(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 108 | void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback); |
| 109 | RtcpStatisticsCallback* GetRtcpStatisticsCallback(); |
| 110 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 111 | protected: |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 112 | RTCPUtility::RTCPCnameInformation* CreateCnameInformation(uint32_t remoteSSRC); |
| 113 | RTCPUtility::RTCPCnameInformation* GetCnameInformation( |
| 114 | uint32_t remoteSSRC) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 116 | RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation( |
| 117 | uint32_t remoteSSRC); |
| 118 | RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | |
asapersson@webrtc.org | df7b65b | 2015-01-21 13:07:04 +0000 | [diff] [blame] | 120 | void UpdateReceiveInformation( |
| 121 | RTCPHelp::RTCPReceiveInformation& receiveInformation); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 122 | |
asapersson@webrtc.org | df7b65b | 2015-01-21 13:07:04 +0000 | [diff] [blame] | 123 | void HandleSenderReceiverReport( |
| 124 | RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 125 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 126 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 127 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 128 | void HandleReportBlock( |
| 129 | const RTCPUtility::RTCPPacket& rtcpPacket, |
| 130 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 131 | uint32_t remoteSSRC) |
| 132 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 133 | |
Erik Språng | a38233a | 2015-07-24 09:58:18 +0200 | [diff] [blame] | 134 | void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 135 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 136 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 137 | |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 138 | void HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser) |
| 139 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 141 | void HandleXrHeader(RTCPUtility::RTCPParserV2& parser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 142 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 143 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 144 | |
| 145 | void HandleXrReceiveReferenceTime( |
| 146 | RTCPUtility::RTCPParserV2& parser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 147 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 148 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 149 | |
| 150 | void HandleXrDlrrReportBlock( |
| 151 | RTCPUtility::RTCPParserV2& parser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 152 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 153 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 154 | |
| 155 | void HandleXrDlrrReportBlockItem( |
| 156 | const RTCPUtility::RTCPPacket& packet, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 157 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 158 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 159 | |
asapersson@webrtc.org | df7b65b | 2015-01-21 13:07:04 +0000 | [diff] [blame] | 160 | void HandleXRVOIPMetric( |
| 161 | RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 162 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 163 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 164 | |
| 165 | void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 166 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 167 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 168 | |
| 169 | void HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 170 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 171 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 172 | |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 173 | void HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser) |
| 174 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 175 | |
| 176 | void HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 177 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 178 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 179 | |
| 180 | void HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 181 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 182 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 183 | |
| 184 | void HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 185 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 186 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 187 | |
| 188 | void HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 189 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 190 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 191 | |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 192 | void HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 193 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 194 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 195 | |
| 196 | void HandleREMBItem(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 197 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 198 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 199 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 200 | void HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 201 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 202 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 203 | |
| 204 | void HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 205 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 206 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 207 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 208 | void HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 209 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 210 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 211 | |
| 212 | void HandleTMMBRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo, |
| 213 | const RTCPUtility::RTCPPacket& rtcpPacket, |
| 214 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 215 | uint32_t senderSSRC) |
| 216 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 217 | |
hta@webrtc.org | 9d54cd1 | 2012-04-30 08:24:55 +0000 | [diff] [blame] | 218 | void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 219 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 220 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 221 | |
| 222 | void HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 223 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 224 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 225 | |
| 226 | void HandleTMMBNItem(RTCPHelp::RTCPReceiveInformation& receiveInfo, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 227 | const RTCPUtility::RTCPPacket& rtcpPacket) |
| 228 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 229 | |
| 230 | void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 231 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 232 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 233 | |
pwestin@webrtc.org | b2179c2 | 2012-05-21 12:00:49 +0000 | [diff] [blame] | 234 | void HandleFIRItem(RTCPHelp::RTCPReceiveInformation* receiveInfo, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 235 | const RTCPUtility::RTCPPacket& rtcpPacket, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 236 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 237 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 238 | |
| 239 | void HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 240 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 241 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 242 | |
| 243 | void HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 244 | RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) |
| 245 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 246 | |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 247 | void HandleTransportFeedback( |
| 248 | RTCPUtility::RTCPParserV2* rtcp_parser, |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 249 | RTCPHelp::RTCPPacketInformation* rtcp_packet_information) |
| 250 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 251 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 252 | private: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 253 | typedef std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*> |
stefan@webrtc.org | b586507 | 2013-02-01 14:33:42 +0000 | [diff] [blame] | 254 | ReceivedInfoMap; |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 255 | // RTCP report block information mapped by remote SSRC. |
| 256 | typedef std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*> |
| 257 | ReportBlockInfoMap; |
| 258 | // RTCP report block information map mapped by source SSRC. |
| 259 | typedef std::map<uint32_t, ReportBlockInfoMap> ReportBlockMap; |
| 260 | |
| 261 | RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation( |
| 262 | uint32_t remote_ssrc, uint32_t source_ssrc) |
| 263 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
| 264 | RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation( |
| 265 | uint32_t remote_ssrc, uint32_t source_ssrc) const |
| 266 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
| 267 | |
Peter Boström | fe7a80c | 2015-04-23 17:53:17 +0200 | [diff] [blame] | 268 | Clock* const _clock; |
| 269 | const bool receiver_only_; |
pbos | da903ea | 2015-10-02 02:36:56 -0700 | [diff] [blame] | 270 | RtcpMode _method; |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 271 | int64_t _lastReceived; |
| 272 | ModuleRtpRtcpImpl& _rtpRtcp; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 273 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 274 | CriticalSectionWrapper* _criticalSectionFeedbacks; |
mflodman@webrtc.org | 96abda0 | 2015-02-25 13:50:10 +0000 | [diff] [blame] | 275 | RtcpBandwidthObserver* const _cbRtcpBandwidthObserver; |
| 276 | RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver; |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 277 | TransportFeedbackObserver* const _cbTransportFeedbackObserver; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 278 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 279 | CriticalSectionWrapper* _criticalSectionRTCPReceiver; |
sprang | 7dc39f3 | 2015-10-13 09:17:48 -0700 | [diff] [blame] | 280 | uint32_t main_ssrc_ GUARDED_BY(_criticalSectionRTCPReceiver); |
| 281 | uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPReceiver); |
| 282 | std::set<uint32_t> registered_ssrcs_ GUARDED_BY(_criticalSectionRTCPReceiver); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 283 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 284 | // Received send report |
| 285 | RTCPSenderInfo _remoteSenderInfo; |
| 286 | // when did we receive the last send report |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 287 | uint32_t _lastReceivedSRNTPsecs; |
| 288 | uint32_t _lastReceivedSRNTPfrac; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 289 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 290 | // Received XR receive time report. |
| 291 | RtcpReceiveTimeInfo _remoteXRReceiveTimeInfo; |
| 292 | // Time when the report was received. |
| 293 | uint32_t _lastReceivedXRNTPsecs; |
| 294 | uint32_t _lastReceivedXRNTPfrac; |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 295 | // Estimated rtt, zero when there is no valid estimate. |
Danil Chapovalov | c1e55c7 | 2016-03-09 15:14:35 +0100 | [diff] [blame^] | 296 | bool xr_rrtr_status_ GUARDED_BY(_criticalSectionRTCPReceiver); |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 297 | int64_t xr_rr_rtt_ms_; |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 298 | |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 299 | // Received report blocks. |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 300 | ReportBlockMap _receivedReportBlockMap |
| 301 | GUARDED_BY(_criticalSectionRTCPReceiver); |
stefan@webrtc.org | b586507 | 2013-02-01 14:33:42 +0000 | [diff] [blame] | 302 | ReceivedInfoMap _receivedInfoMap; |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 303 | std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _receivedCnameMap; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 304 | |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 305 | // The last time we received an RTCP RR. |
| 306 | int64_t _lastReceivedRrMs; |
| 307 | |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 308 | // The time we last received an RTCP RR telling we have successfully |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 309 | // delivered RTP packet to the remote side. |
| 310 | int64_t _lastIncreasedSequenceNumberMs; |
stefan@webrtc.org | 8ca8a71 | 2013-04-23 16:48:32 +0000 | [diff] [blame] | 311 | |
pbos@webrtc.org | a28a91d | 2015-02-17 14:45:08 +0000 | [diff] [blame] | 312 | RtcpStatisticsCallback* stats_callback_ GUARDED_BY(_criticalSectionFeedbacks); |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 313 | |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 314 | RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 315 | RtcpPacketTypeCounter packet_type_counter_; |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 +0000 | [diff] [blame] | 316 | |
| 317 | RTCPUtility::NackStats nack_stats_; |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 318 | |
| 319 | size_t num_skipped_packets_; |
| 320 | int64_t last_skipped_packets_warning_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 321 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 322 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 323 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |