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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
| 12 | #define MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Mirta Dvornicic | b1f063d | 2018-04-16 11:16:21 +0200 | [diff] [blame] | 14 | #include <list> |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 15 | #include <map> |
stefan@webrtc.org | 28a331e | 2013-09-17 07:49:56 +0000 | [diff] [blame] | 16 | #include <set> |
danilchap | 9532124 | 2016-09-27 07:05:32 -0700 | [diff] [blame] | 17 | #include <string> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 18 | #include <vector> |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 19 | |
Niels Möller | 53382cb | 2018-11-27 14:05:08 +0100 | [diff] [blame] | 20 | #include "modules/rtp_rtcp/include/rtcp_statistics.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 22 | #include "modules/rtp_rtcp/source/rtcp_nack_stats.h" |
| 23 | #include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 24 | #include "rtc_base/critical_section.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "rtc_base/thread_annotations.h" |
| 26 | #include "system_wrappers/include/ntp_time.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
| 28 | namespace webrtc { |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 29 | class VideoBitrateAllocationObserver; |
danilchap | 59cb2bd | 2016-08-29 11:08:47 -0700 | [diff] [blame] | 30 | namespace rtcp { |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 31 | class CommonHeader; |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 32 | class ReportBlock; |
| 33 | class Rrtr; |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 34 | class TargetBitrate; |
danilchap | 59cb2bd | 2016-08-29 11:08:47 -0700 | [diff] [blame] | 35 | class TmmbItem; |
| 36 | } // namespace rtcp |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 37 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 38 | class RTCPReceiver { |
| 39 | public: |
danilchap | 59cb2bd | 2016-08-29 11:08:47 -0700 | [diff] [blame] | 40 | class ModuleRtpRtcp { |
| 41 | public: |
| 42 | virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0; |
| 43 | virtual void OnRequestSendReport() = 0; |
| 44 | virtual void OnReceivedNack( |
| 45 | const std::vector<uint16_t>& nack_sequence_numbers) = 0; |
| 46 | virtual void OnReceivedRtcpReportBlocks( |
| 47 | const ReportBlockList& report_blocks) = 0; |
| 48 | |
| 49 | protected: |
| 50 | virtual ~ModuleRtpRtcp() = default; |
| 51 | }; |
| 52 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 53 | RTCPReceiver(Clock* clock, |
| 54 | bool receiver_only, |
| 55 | RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
| 56 | RtcpBandwidthObserver* rtcp_bandwidth_observer, |
| 57 | RtcpIntraFrameObserver* rtcp_intra_frame_observer, |
| 58 | TransportFeedbackObserver* transport_feedback_observer, |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 59 | VideoBitrateAllocationObserver* bitrate_allocation_observer, |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 60 | int report_interval_ms, |
danilchap | 59cb2bd | 2016-08-29 11:08:47 -0700 | [diff] [blame] | 61 | ModuleRtpRtcp* owner); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 62 | virtual ~RTCPReceiver(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | |
nisse | 479d3d7 | 2017-09-13 07:53:37 -0700 | [diff] [blame] | 64 | void IncomingPacket(const uint8_t* packet, size_t packet_size); |
danilchap | 59cb2bd | 2016-08-29 11:08:47 -0700 | [diff] [blame] | 65 | |
Danil Chapovalov | 760c4b4 | 2017-09-27 13:25:24 +0200 | [diff] [blame] | 66 | int64_t LastReceivedReportBlockMs() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 68 | void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs); |
| 69 | void SetRemoteSSRC(uint32_t ssrc); |
| 70 | uint32_t RemoteSSRC() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 71 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 72 | // Get received cname. |
| 73 | int32_t CNAME(uint32_t remote_ssrc, char cname[RTCP_CNAME_SIZE]) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 74 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 75 | // Get received NTP. |
| 76 | bool NTP(uint32_t* received_ntp_secs, |
| 77 | uint32_t* received_ntp_frac, |
| 78 | uint32_t* rtcp_arrival_time_secs, |
| 79 | uint32_t* rtcp_arrival_time_frac, |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 80 | uint32_t* rtcp_timestamp) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 81 | |
Mirta Dvornicic | b1f063d | 2018-04-16 11:16:21 +0200 | [diff] [blame] | 82 | std::vector<rtcp::ReceiveTimeInfo> ConsumeReceivedXrReferenceTimeInfo(); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 83 | |
danilchap | 28b03eb | 2016-10-05 06:59:44 -0700 | [diff] [blame] | 84 | // Get rtt. |
| 85 | int32_t RTT(uint32_t remote_ssrc, |
| 86 | int64_t* last_rtt_ms, |
| 87 | int64_t* avg_rtt_ms, |
| 88 | int64_t* min_rtt_ms, |
| 89 | int64_t* max_rtt_ms) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 90 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 91 | void SetRtcpXrRrtrStatus(bool enable); |
| 92 | bool GetAndResetXrRrRtt(int64_t* rtt_ms); |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 93 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 94 | // Get statistics. |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 95 | int32_t StatisticsReceived(std::vector<RTCPReportBlock>* receiveBlocks) const; |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 96 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 97 | // Returns true if we haven't received an RTCP RR for several RTCP |
| 98 | // intervals, but only triggers true once. |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 99 | bool RtcpRrTimeout(); |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 100 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 101 | // Returns true if we haven't received an RTCP RR telling the receive side |
| 102 | // has not received RTP packets for too long, i.e. extended highest sequence |
| 103 | // number hasn't increased for several RTCP intervals. The function only |
| 104 | // returns true once until a new RR is received. |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 105 | bool RtcpRrSequenceNumberTimeout(); |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 106 | |
danilchap | 7851bda | 2016-09-29 15:28:07 -0700 | [diff] [blame] | 107 | std::vector<rtcp::TmmbItem> TmmbrReceived(); |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 108 | // Return true if new bandwidth should be set. |
| 109 | bool UpdateTmmbrTimers(); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 110 | std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner); |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 111 | // Set new bandwidth and notify remote clients about it. |
| 112 | void NotifyTmmbrUpdated(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 114 | void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback); |
| 115 | RtcpStatisticsCallback* GetRtcpStatisticsCallback(); |
sprang@webrtc.org | a6ad6e5 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 116 | |
danilchap | dd12892 | 2016-09-13 12:23:29 -0700 | [diff] [blame] | 117 | private: |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 118 | struct PacketInformation; |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 119 | struct TmmbrInformation; |
Mirta Dvornicic | b1f063d | 2018-04-16 11:16:21 +0200 | [diff] [blame] | 120 | struct RrtrInformation; |
danilchap | 28b03eb | 2016-10-05 06:59:44 -0700 | [diff] [blame] | 121 | struct ReportBlockWithRtt; |
danilchap | efa966b | 2017-02-17 06:23:15 -0800 | [diff] [blame] | 122 | struct LastFirStatus; |
danilchap | 28b03eb | 2016-10-05 06:59:44 -0700 | [diff] [blame] | 123 | // RTCP report blocks mapped by remote SSRC. |
| 124 | using ReportBlockInfoMap = std::map<uint32_t, ReportBlockWithRtt>; |
| 125 | // RTCP report blocks map mapped by source SSRC. |
danilchap | dd12892 | 2016-09-13 12:23:29 -0700 | [diff] [blame] | 126 | using ReportBlockMap = std::map<uint32_t, ReportBlockInfoMap>; |
| 127 | |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 128 | bool ParseCompoundPacket(const uint8_t* packet_begin, |
| 129 | const uint8_t* packet_end, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 130 | PacketInformation* packet_information); |
danilchap | dd12892 | 2016-09-13 12:23:29 -0700 | [diff] [blame] | 131 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 132 | void TriggerCallbacksFromRtcpPacket( |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 133 | const PacketInformation& packet_information); |
danilchap | dd12892 | 2016-09-13 12:23:29 -0700 | [diff] [blame] | 134 | |
danilchap | ec067e9 | 2017-02-21 05:38:19 -0800 | [diff] [blame] | 135 | TmmbrInformation* FindOrCreateTmmbrInfo(uint32_t remote_ssrc) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 136 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | ec067e9 | 2017-02-21 05:38:19 -0800 | [diff] [blame] | 137 | // Update TmmbrInformation (if present) is alive. |
| 138 | void UpdateTmmbrRemoteIsAlive(uint32_t remote_ssrc) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 139 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 140 | TmmbrInformation* GetTmmbrInformation(uint32_t remote_ssrc) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 141 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 142 | |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 143 | void HandleSenderReport(const rtcp::CommonHeader& rtcp_block, |
| 144 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 145 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
Danil Chapovalov | 91511f1 | 2016-09-15 16:24:02 +0200 | [diff] [blame] | 146 | |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 147 | void HandleReceiverReport(const rtcp::CommonHeader& rtcp_block, |
| 148 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 149 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 150 | |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 151 | void HandleReportBlock(const rtcp::ReportBlock& report_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 152 | PacketInformation* packet_information, |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 153 | uint32_t remote_ssrc) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 154 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 155 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 156 | void HandleSdes(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 157 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 158 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 159 | |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 160 | void HandleXr(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 161 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 162 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 163 | |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 164 | void HandleXrReceiveReferenceTime(uint32_t sender_ssrc, |
| 165 | const rtcp::Rrtr& rrtr) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 166 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 167 | |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 168 | void HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 169 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 170 | |
sprang | b32aaf9 | 2017-08-28 05:49:12 -0700 | [diff] [blame] | 171 | void HandleXrTargetBitrate(uint32_t ssrc, |
| 172 | const rtcp::TargetBitrate& target_bitrate, |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 173 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 174 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 175 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 176 | void HandleNack(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 177 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 178 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 179 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 180 | void HandleBye(const rtcp::CommonHeader& rtcp_block) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 181 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 182 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 183 | void HandlePli(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 184 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 185 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 186 | |
danilchap | 1b1863a | 2016-09-20 01:39:54 -0700 | [diff] [blame] | 187 | void HandlePsfbApp(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 188 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 189 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 190 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 191 | void HandleTmmbr(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 192 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 193 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 194 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 195 | void HandleTmmbn(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 196 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 197 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 198 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 199 | void HandleSrReq(const rtcp::CommonHeader& rtcp_block, |
| 200 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 201 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 202 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 203 | void HandleFir(const rtcp::CommonHeader& rtcp_block, |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 204 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 205 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
danilchap | da161d7 | 2016-08-19 07:29:46 -0700 | [diff] [blame] | 206 | |
danilchap | 92ea601 | 2016-09-23 10:36:03 -0700 | [diff] [blame] | 207 | void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block, |
| 208 | PacketInformation* packet_information) |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 209 | RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 210 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 211 | Clock* const clock_; |
Peter Boström | fe7a80c | 2015-04-23 17:53:17 +0200 | [diff] [blame] | 212 | const bool receiver_only_; |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 213 | ModuleRtpRtcp* const rtp_rtcp_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 214 | |
sprang | a790d83 | 2016-12-02 07:29:44 -0800 | [diff] [blame] | 215 | rtc::CriticalSection feedbacks_lock_; |
| 216 | RtcpBandwidthObserver* const rtcp_bandwidth_observer_; |
| 217 | RtcpIntraFrameObserver* const rtcp_intra_frame_observer_; |
| 218 | TransportFeedbackObserver* const transport_feedback_observer_; |
| 219 | VideoBitrateAllocationObserver* const bitrate_allocation_observer_; |
Jiawei Ou | 8b5d9d8 | 2018-11-15 16:44:37 -0800 | [diff] [blame] | 220 | const int report_interval_ms_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 221 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 222 | rtc::CriticalSection rtcp_receiver_lock_; |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 223 | uint32_t main_ssrc_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 224 | uint32_t remote_ssrc_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 225 | std::set<uint32_t> registered_ssrcs_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 226 | |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 227 | // Received sender report. |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 228 | NtpTime remote_sender_ntp_time_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 229 | uint32_t remote_sender_rtp_time_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
danilchap | 0b4b727 | 2016-10-06 09:24:45 -0700 | [diff] [blame] | 230 | // When did we receive the last send report. |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 231 | NtpTime last_received_sr_ntp_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 232 | |
Mirta Dvornicic | b1f063d | 2018-04-16 11:16:21 +0200 | [diff] [blame] | 233 | // Received RRTR information in ascending receive time order. |
| 234 | std::list<RrtrInformation> received_rrtrs_ |
| 235 | RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 236 | // Received RRTR information mapped by remote ssrc. |
| 237 | std::map<uint32_t, std::list<RrtrInformation>::iterator> |
| 238 | received_rrtrs_ssrc_it_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 239 | |
asapersson@webrtc.org | 7d6bd22 | 2013-10-31 12:14:34 +0000 | [diff] [blame] | 240 | // Estimated rtt, zero when there is no valid estimate. |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 241 | bool xr_rrtr_status_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 242 | int64_t xr_rr_rtt_ms_; |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 243 | |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 244 | int64_t oldest_tmmbr_info_ms_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 245 | // Mapped by remote ssrc. |
| 246 | std::map<uint32_t, TmmbrInformation> tmmbr_infos_ |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 247 | RTC_GUARDED_BY(rtcp_receiver_lock_); |
danilchap | 9bf610e | 2017-02-20 06:03:01 -0800 | [diff] [blame] | 248 | |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 249 | ReportBlockMap received_report_blocks_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
| 250 | std::map<uint32_t, LastFirStatus> last_fir_ |
| 251 | RTC_GUARDED_BY(rtcp_receiver_lock_); |
danilchap | 9532124 | 2016-09-27 07:05:32 -0700 | [diff] [blame] | 252 | std::map<uint32_t, std::string> received_cnames_ |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 253 | RTC_GUARDED_BY(rtcp_receiver_lock_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 254 | |
Danil Chapovalov | 760c4b4 | 2017-09-27 13:25:24 +0200 | [diff] [blame] | 255 | // The last time we received an RTCP Report block for this module. |
| 256 | int64_t last_received_rb_ms_ RTC_GUARDED_BY(rtcp_receiver_lock_); |
mflodman@webrtc.org | 2f225ca | 2013-01-09 13:54:43 +0000 | [diff] [blame] | 257 | |
asapersson@webrtc.org | cb79141 | 2014-12-18 14:30:32 +0000 | [diff] [blame] | 258 | // 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] | 259 | // delivered RTP packet to the remote side. |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 260 | int64_t last_increased_sequence_number_ms_; |
stefan@webrtc.org | 8ca8a71 | 2013-04-23 16:48:32 +0000 | [diff] [blame] | 261 | |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 262 | RtcpStatisticsCallback* stats_callback_ RTC_GUARDED_BY(feedbacks_lock_); |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 263 | |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 264 | RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 265 | RtcpPacketTypeCounter packet_type_counter_; |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 +0000 | [diff] [blame] | 266 | |
danilchap | 8443238 | 2017-02-09 05:21:42 -0800 | [diff] [blame] | 267 | RtcpNackStats nack_stats_; |
Erik Språng | 6b8d355 | 2015-09-24 15:06:57 +0200 | [diff] [blame] | 268 | |
| 269 | size_t num_skipped_packets_; |
danilchap | 8bab796 | 2016-12-20 02:46:46 -0800 | [diff] [blame] | 270 | int64_t last_skipped_packets_warning_ms_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 271 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 272 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 273 | #endif // MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |