blob: a6175d0774d8c4d01aaacd8d9417a8a5e9ac1717 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:592 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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 Bonadei92ea95e2017-09-15 04:47:3111#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_
12#define MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_
niklase@google.com470e71d2011-07-07 08:21:2513
Mirta Dvornicicb1f063d2018-04-16 09:16:2114#include <list>
pwestin@webrtc.org26f8d9c2012-01-19 15:53:0915#include <map>
danilchap95321242016-09-27 14:05:3216#include <string>
danilchapb8b6fbb2015-12-10 13:05:2717#include <vector>
perkj@webrtc.orgce5990c2012-01-11 13:00:0818
Ivo Creusen2562cf02021-09-03 14:51:2219#include "absl/types/optional.h"
Danil Chapovalov443f2662020-03-11 11:24:4020#include "api/array_view.h"
Tommi08be9ba2021-06-15 21:01:5721#include "api/sequence_checker.h"
Ivo Creusen2562cf02021-09-03 14:51:2222#include "api/units/time_delta.h"
Danil Chapovalovaa8faa62023-07-13 09:00:2823#include "api/units/timestamp.h"
Henrik Boströmf2047872019-05-16 11:32:2024#include "modules/rtp_rtcp/include/report_block_data.h"
Niels Möller53382cb2018-11-27 13:05:0825#include "modules/rtp_rtcp/include/rtcp_statistics.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3126#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
27#include "modules/rtp_rtcp/source/rtcp_nack_stats.h"
28#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
Stephan Hartmann26946722021-05-03 11:06:2329#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
Tomas Gunnarssonf25761d2020-06-03 20:55:3330#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
Victor Boivief7156182021-07-06 21:14:5131#include "rtc_base/containers/flat_map.h"
Markus Handelle7c015e2020-07-07 09:44:2832#include "rtc_base/synchronization/mutex.h"
Tommi08be9ba2021-06-15 21:01:5733#include "rtc_base/system/no_unique_address.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3134#include "rtc_base/thread_annotations.h"
35#include "system_wrappers/include/ntp_time.h"
niklase@google.com470e71d2011-07-07 08:21:2536
37namespace webrtc {
Tommi08be9ba2021-06-15 21:01:5738
39class ModuleRtpRtcpImpl2;
spranga790d832016-12-02 15:29:4440class VideoBitrateAllocationObserver;
Tommi08be9ba2021-06-15 21:01:5741
danilchap59cb2bd2016-08-29 18:08:4742namespace rtcp {
danilchap1b1863a2016-09-20 08:39:5443class CommonHeader;
danilchap1b1863a2016-09-20 08:39:5444class ReportBlock;
45class Rrtr;
spranga790d832016-12-02 15:29:4446class TargetBitrate;
danilchap59cb2bd2016-08-29 18:08:4747class TmmbItem;
48} // namespace rtcp
pwestin@webrtc.org741da942011-09-20 13:52:0449
Danil Chapovalov443f2662020-03-11 11:24:4050class RTCPReceiver final {
danilchapda161d72016-08-19 14:29:4651 public:
danilchap59cb2bd2016-08-29 18:08:4752 class ModuleRtpRtcp {
53 public:
54 virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0;
55 virtual void OnRequestSendReport() = 0;
56 virtual void OnReceivedNack(
57 const std::vector<uint16_t>& nack_sequence_numbers) = 0;
58 virtual void OnReceivedRtcpReportBlocks(
Danil Chapovalove641a972023-05-23 08:39:0959 rtc::ArrayView<const ReportBlockData> report_blocks) = 0;
danilchap59cb2bd2016-08-29 18:08:4760
61 protected:
62 virtual ~ModuleRtpRtcp() = default;
63 };
Ivo Creusen2562cf02021-09-03 14:51:2264 // Standardized stats derived from the non-sender RTT.
65 class NonSenderRttStats {
66 public:
67 NonSenderRttStats() = default;
68 NonSenderRttStats(const NonSenderRttStats&) = default;
69 NonSenderRttStats& operator=(const NonSenderRttStats&) = default;
70 ~NonSenderRttStats() = default;
71 void Update(TimeDelta non_sender_rtt_seconds) {
72 round_trip_time_ = non_sender_rtt_seconds;
73 total_round_trip_time_ += non_sender_rtt_seconds;
74 round_trip_time_measurements_++;
75 }
76 void Invalidate() { round_trip_time_.reset(); }
77 // https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats-roundtriptime
78 absl::optional<TimeDelta> round_trip_time() const {
79 return round_trip_time_;
80 }
81 // https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats-totalroundtriptime
82 TimeDelta total_round_trip_time() const { return total_round_trip_time_; }
83 // https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats-roundtriptimemeasurements
84 int round_trip_time_measurements() const {
85 return round_trip_time_measurements_;
86 }
87
88 private:
89 absl::optional<TimeDelta> round_trip_time_;
90 TimeDelta total_round_trip_time_ = TimeDelta::Zero();
91 int round_trip_time_measurements_ = 0;
92 };
danilchap59cb2bd2016-08-29 18:08:4793
Tomas Gunnarssonf25761d2020-06-03 20:55:3394 RTCPReceiver(const RtpRtcpInterface::Configuration& config,
95 ModuleRtpRtcp* owner);
Tommi08be9ba2021-06-15 21:01:5796
97 RTCPReceiver(const RtpRtcpInterface::Configuration& config,
98 ModuleRtpRtcpImpl2* owner);
99
Danil Chapovalov443f2662020-03-11 11:24:40100 ~RTCPReceiver();
niklase@google.com470e71d2011-07-07 08:21:25101
Danil Chapovalov443f2662020-03-11 11:24:40102 void IncomingPacket(rtc::ArrayView<const uint8_t> packet);
danilchap59cb2bd2016-08-29 18:08:47103
Danil Chapovalov760c4b42017-09-27 11:25:24104 int64_t LastReceivedReportBlockMs() const;
niklase@google.com470e71d2011-07-07 08:21:25105
Tommi08be9ba2021-06-15 21:01:57106 void set_local_media_ssrc(uint32_t ssrc);
107 uint32_t local_media_ssrc() const;
108
danilchapda161d72016-08-19 14:29:46109 void SetRemoteSSRC(uint32_t ssrc);
110 uint32_t RemoteSSRC() const;
niklase@google.com470e71d2011-07-07 08:21:25111
Tommi08be9ba2021-06-15 21:01:57112 bool receiver_only() const { return receiver_only_; }
113
Danil Chapovalov0f43da22023-02-28 16:03:21114 // Returns stats based on the received RTCP Sender Reports.
115 absl::optional<RtpRtcpInterface::SenderReportStats> GetSenderReportStats()
116 const;
niklase@google.com470e71d2011-07-07 08:21:25117
Mirta Dvornicicb1f063d2018-04-16 09:16:21118 std::vector<rtcp::ReceiveTimeInfo> ConsumeReceivedXrReferenceTimeInfo();
asapersson@webrtc.org8469f7b2013-10-02 13:15:34119
Danil Chapovalov71f80c02023-05-11 08:35:37120 absl::optional<TimeDelta> AverageRtt() const;
Danil Chapovalov8095d022023-05-09 07:59:46121 absl::optional<TimeDelta> LastRtt() const;
122
Ivo Creusen2562cf02021-09-03 14:51:22123 // Returns non-sender RTT metrics for the remote SSRC.
124 NonSenderRttStats GetNonSenderRTT() const;
125
Ivo Creusen8c40d512021-07-13 12:53:22126 void SetNonSenderRttMeasurement(bool enabled);
Danil Chapovalov4d2a2192023-06-16 14:12:06127 absl::optional<TimeDelta> GetAndResetXrRrRtt();
asapersson@webrtc.org7d6bd222013-10-31 12:14:34128
Tomas Gunnarssonba0ba712020-07-01 06:53:21129 // Called once per second on the worker thread to do rtt calculations.
130 // Returns an optional rtt value if one is available.
131 absl::optional<TimeDelta> OnPeriodicRttUpdate(Timestamp newer_than,
132 bool sending);
133
Henrik Boströmf2047872019-05-16 11:32:20134 // A snapshot of Report Blocks with additional data of interest to statistics.
Danil Chapovalov510c94c2021-07-02 11:51:19135 // Within this list, the source SSRC is unique and ReportBlockData represents
136 // the latest Report Block that was received for that SSRC.
Henrik Boströmf2047872019-05-16 11:32:20137 std::vector<ReportBlockData> GetLatestReportBlockData() const;
perkj@webrtc.orgce5990c2012-01-11 13:00:08138
danilchapda161d72016-08-19 14:29:46139 // Returns true if we haven't received an RTCP RR for several RTCP
140 // intervals, but only triggers true once.
Jiawei Ou8b5d9d82018-11-16 00:44:37141 bool RtcpRrTimeout();
mflodman@webrtc.org2f225ca2013-01-09 13:54:43142
danilchapda161d72016-08-19 14:29:46143 // Returns true if we haven't received an RTCP RR telling the receive side
144 // has not received RTP packets for too long, i.e. extended highest sequence
145 // number hasn't increased for several RTCP intervals. The function only
146 // returns true once until a new RR is received.
Jiawei Ou8b5d9d82018-11-16 00:44:37147 bool RtcpRrSequenceNumberTimeout();
mflodman@webrtc.org2f225ca2013-01-09 13:54:43148
danilchap7851bda2016-09-29 22:28:07149 std::vector<rtcp::TmmbItem> TmmbrReceived();
danilchap9bf610e2017-02-20 14:03:01150 // Return true if new bandwidth should be set.
151 bool UpdateTmmbrTimers();
danilchapda161d72016-08-19 14:29:46152 std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner);
danilchap9bf610e2017-02-20 14:03:01153 // Set new bandwidth and notify remote clients about it.
154 void NotifyTmmbrUpdated();
niklase@google.com470e71d2011-07-07 08:21:25155
danilchapdd128922016-09-13 19:23:29156 private:
Tommi08be9ba2021-06-15 21:01:57157#if RTC_DCHECK_IS_ON
158 class CustomSequenceChecker : public SequenceChecker {
Victor Boivie306b1392021-04-27 08:33:58159 public:
Tommi08be9ba2021-06-15 21:01:57160 explicit CustomSequenceChecker(bool disable_checks)
161 : disable_checks_(disable_checks) {}
162 bool IsCurrent() const {
163 if (disable_checks_)
164 return true;
165 return SequenceChecker::IsCurrent();
Victor Boivie306b1392021-04-27 08:33:58166 }
167
168 private:
Tommi08be9ba2021-06-15 21:01:57169 const bool disable_checks_;
170 };
171#else
172 class CustomSequenceChecker : public SequenceChecker {
173 public:
174 explicit CustomSequenceChecker(bool) {}
175 };
176#endif
177
178 // A lightweight inlined set of local SSRCs.
179 class RegisteredSsrcs {
180 public:
181 static constexpr size_t kMediaSsrcIndex = 0;
182 static constexpr size_t kMaxSsrcs = 3;
183 // Initializes the set of registered local SSRCS by extracting them from the
184 // provided `config`. The `disable_sequence_checker` flag is a workaround
185 // to be able to use a sequence checker without breaking downstream
186 // code that currently doesn't follow the same threading rules as webrtc.
187 RegisteredSsrcs(bool disable_sequence_checker,
188 const RtpRtcpInterface::Configuration& config);
189
190 // Indicates if `ssrc` is in the set of registered local SSRCs.
191 bool contains(uint32_t ssrc) const;
192 uint32_t media_ssrc() const;
193 void set_media_ssrc(uint32_t ssrc);
194
195 private:
196 RTC_NO_UNIQUE_ADDRESS CustomSequenceChecker packet_sequence_checker_;
197 absl::InlinedVector<uint32_t, kMaxSsrcs> ssrcs_
198 RTC_GUARDED_BY(packet_sequence_checker_);
Victor Boivie306b1392021-04-27 08:33:58199 };
200
danilchap92ea6012016-09-23 17:36:03201 struct PacketInformation;
Stephan Hartmann26946722021-05-03 11:06:23202
203 // Structure for handing TMMBR and TMMBN rtcp messages (RFC5104,
204 // section 3.5.4).
205 struct TmmbrInformation {
206 struct TimedTmmbrItem {
207 rtcp::TmmbItem tmmbr_item;
Danil Chapovalovaa8faa62023-07-13 09:00:28208 Timestamp last_updated = Timestamp::Zero();
Stephan Hartmann26946722021-05-03 11:06:23209 };
210
Danil Chapovalovaa8faa62023-07-13 09:00:28211 Timestamp last_time_received = Timestamp::Zero();
Stephan Hartmann26946722021-05-03 11:06:23212
213 bool ready_for_delete = false;
214
215 std::vector<rtcp::TmmbItem> tmmbn;
216 std::map<uint32_t, TimedTmmbrItem> tmmbr;
217 };
218
219 // Structure for storing received RRTR RTCP messages (RFC3611, section 4.4).
220 struct RrtrInformation {
221 RrtrInformation(uint32_t ssrc,
222 uint32_t received_remote_mid_ntp_time,
223 uint32_t local_receive_mid_ntp_time)
224 : ssrc(ssrc),
225 received_remote_mid_ntp_time(received_remote_mid_ntp_time),
226 local_receive_mid_ntp_time(local_receive_mid_ntp_time) {}
227
228 uint32_t ssrc;
229 // Received NTP timestamp in compact representation.
230 uint32_t received_remote_mid_ntp_time;
231 // NTP time when the report was received in compact representation.
232 uint32_t local_receive_mid_ntp_time;
233 };
234
235 struct LastFirStatus {
Danil Chapovalovaa8faa62023-07-13 09:00:28236 LastFirStatus(Timestamp now, uint8_t sequence_number)
237 : request(now), sequence_number(sequence_number) {}
238 Timestamp request;
Stephan Hartmann26946722021-05-03 11:06:23239 uint8_t sequence_number;
240 };
Victor Boivie0c563a42021-04-27 08:24:01241
Danil Chapovalov510c94c2021-07-02 11:51:19242 class RttStats {
243 public:
244 RttStats() = default;
245 RttStats(const RttStats&) = default;
246 RttStats& operator=(const RttStats&) = default;
Victor Boivie0c563a42021-04-27 08:24:01247
Danil Chapovalov510c94c2021-07-02 11:51:19248 void AddRtt(TimeDelta rtt);
249
250 TimeDelta last_rtt() const { return last_rtt_; }
Danil Chapovalov510c94c2021-07-02 11:51:19251 TimeDelta average_rtt() const { return sum_rtt_ / num_rtts_; }
252
253 private:
254 TimeDelta last_rtt_ = TimeDelta::Zero();
Danil Chapovalov510c94c2021-07-02 11:51:19255 TimeDelta sum_rtt_ = TimeDelta::Zero();
256 size_t num_rtts_ = 0;
257 };
danilchapdd128922016-09-13 19:23:29258
Danil Chapovalov443f2662020-03-11 11:24:40259 bool ParseCompoundPacket(rtc::ArrayView<const uint8_t> packet,
danilchap92ea6012016-09-23 17:36:03260 PacketInformation* packet_information);
danilchapdd128922016-09-13 19:23:29261
danilchap8bab7962016-12-20 10:46:46262 void TriggerCallbacksFromRtcpPacket(
danilchap92ea6012016-09-23 17:36:03263 const PacketInformation& packet_information);
danilchapdd128922016-09-13 19:23:29264
danilchapec067e92017-02-21 13:38:19265 TmmbrInformation* FindOrCreateTmmbrInfo(uint32_t remote_ssrc)
danilchap56359be2017-09-07 14:53:45266 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapec067e92017-02-21 13:38:19267 // Update TmmbrInformation (if present) is alive.
268 void UpdateTmmbrRemoteIsAlive(uint32_t remote_ssrc)
danilchap56359be2017-09-07 14:53:45269 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchap9bf610e2017-02-20 14:03:01270 TmmbrInformation* GetTmmbrInformation(uint32_t remote_ssrc)
danilchap56359be2017-09-07 14:53:45271 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25272
Danil Chapovalov6a0997d2023-03-08 11:34:34273 bool HandleSenderReport(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03274 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45275 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
Danil Chapovalov91511f12016-09-15 14:24:02276
Danil Chapovalov6a0997d2023-03-08 11:34:34277 bool HandleReceiverReport(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03278 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45279 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25280
danilchap1b1863a2016-09-20 08:39:54281 void HandleReportBlock(const rtcp::ReportBlock& report_block,
danilchap92ea6012016-09-23 17:36:03282 PacketInformation* packet_information,
danilchap8bab7962016-12-20 10:46:46283 uint32_t remote_ssrc)
danilchap56359be2017-09-07 14:53:45284 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25285
Danil Chapovalov6a0997d2023-03-08 11:34:34286 bool HandleSdes(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03287 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45288 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25289
Danil Chapovalov6a0997d2023-03-08 11:34:34290 bool HandleXr(const rtcp::CommonHeader& rtcp_block,
Ivo Creusen2562cf02021-09-03 14:51:22291 PacketInformation* packet_information,
292 bool& contains_dlrr,
293 uint32_t& ssrc)
danilchap56359be2017-09-07 14:53:45294 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25295
danilchap92ea6012016-09-23 17:36:03296 void HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
297 const rtcp::Rrtr& rrtr)
danilchap56359be2017-09-07 14:53:45298 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25299
Ivo Creusen2562cf02021-09-03 14:51:22300 void HandleXrDlrrReportBlock(uint32_t ssrc, const rtcp::ReceiveTimeInfo& rti)
danilchap56359be2017-09-07 14:53:45301 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46302
sprangb32aaf92017-08-28 12:49:12303 void HandleXrTargetBitrate(uint32_t ssrc,
304 const rtcp::TargetBitrate& target_bitrate,
spranga790d832016-12-02 15:29:44305 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45306 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
spranga790d832016-12-02 15:29:44307
Danil Chapovalov6a0997d2023-03-08 11:34:34308 bool HandleNack(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03309 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45310 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46311
Danil Chapovalov6a0997d2023-03-08 11:34:34312 bool HandleApp(const rtcp::CommonHeader& rtcp_block,
Sebastian Janssone1795f42019-07-24 09:38:03313 PacketInformation* packet_information)
314 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
315
Danil Chapovalov6a0997d2023-03-08 11:34:34316 bool HandleBye(const rtcp::CommonHeader& rtcp_block)
danilchap56359be2017-09-07 14:53:45317 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46318
Danil Chapovalov6a0997d2023-03-08 11:34:34319 bool HandlePli(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03320 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45321 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46322
danilchap1b1863a2016-09-20 08:39:54323 void HandlePsfbApp(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03324 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45325 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46326
Danil Chapovalov6a0997d2023-03-08 11:34:34327 bool HandleTmmbr(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03328 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45329 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25330
Danil Chapovalov6a0997d2023-03-08 11:34:34331 bool HandleTmmbn(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03332 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45333 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25334
Danil Chapovalov6a0997d2023-03-08 11:34:34335 bool HandleSrReq(const rtcp::CommonHeader& rtcp_block,
danilchap8bab7962016-12-20 10:46:46336 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45337 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25338
Danil Chapovalov6a0997d2023-03-08 11:34:34339 bool HandleFir(const rtcp::CommonHeader& rtcp_block,
danilchap92ea6012016-09-23 17:36:03340 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45341 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
danilchapda161d72016-08-19 14:29:46342
danilchap92ea6012016-09-23 17:36:03343 void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block,
344 PacketInformation* packet_information)
danilchap56359be2017-09-07 14:53:45345 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
Erik Språng6b8d3552015-09-24 13:06:57346
Tomas Gunnarssonba0ba712020-07-01 06:53:21347 bool RtcpRrTimeoutLocked(Timestamp now)
348 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
349
350 bool RtcpRrSequenceNumberTimeoutLocked(Timestamp now)
351 RTC_EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
352
danilchap8bab7962016-12-20 10:46:46353 Clock* const clock_;
Peter Boströmfe7a80c2015-04-23 15:53:17354 const bool receiver_only_;
danilchap8bab7962016-12-20 10:46:46355 ModuleRtpRtcp* const rtp_rtcp_;
Victor Boivie306b1392021-04-27 08:33:58356 // The set of registered local SSRCs.
Tommi08be9ba2021-06-15 21:01:57357 RegisteredSsrcs registered_ssrcs_;
niklase@google.com470e71d2011-07-07 08:21:25358
Danil Chapovalov52518632023-05-09 15:11:49359 NetworkLinkRtcpObserver* const network_link_rtcp_observer_;
spranga790d832016-12-02 15:29:44360 RtcpIntraFrameObserver* const rtcp_intra_frame_observer_;
Elad Alon0a8562e2019-04-09 09:55:13361 RtcpLossNotificationObserver* const rtcp_loss_notification_observer_;
Sebastian Janssone1795f42019-07-24 09:38:03362 NetworkStateEstimateObserver* const network_state_estimate_observer_;
spranga790d832016-12-02 15:29:44363 VideoBitrateAllocationObserver* const bitrate_allocation_observer_;
Tomas Gunnarssonba0ba712020-07-01 06:53:21364 const TimeDelta report_interval_;
niklase@google.com470e71d2011-07-07 08:21:25365
Markus Handelle7c015e2020-07-07 09:44:28366 mutable Mutex rtcp_receiver_lock_;
danilchap56359be2017-09-07 14:53:45367 uint32_t remote_ssrc_ RTC_GUARDED_BY(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25368
danilchap8bab7962016-12-20 10:46:46369 // Received sender report.
Danil Chapovalov0f43da22023-02-28 16:03:21370 RtpRtcpInterface::SenderReportStats remote_sender_
371 RTC_GUARDED_BY(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25372
Mirta Dvornicicb1f063d2018-04-16 09:16:21373 // Received RRTR information in ascending receive time order.
374 std::list<RrtrInformation> received_rrtrs_
375 RTC_GUARDED_BY(rtcp_receiver_lock_);
376 // Received RRTR information mapped by remote ssrc.
Victor Boivief7156182021-07-06 21:14:51377 flat_map<uint32_t, std::list<RrtrInformation>::iterator>
Mirta Dvornicicb1f063d2018-04-16 09:16:21378 received_rrtrs_ssrc_it_ RTC_GUARDED_BY(rtcp_receiver_lock_);
379
Danil Chapovalov4d2a2192023-06-16 14:12:06380 // Estimated rtt, nullopt when there is no valid estimate.
Ivo Creusen8c40d512021-07-13 12:53:22381 bool xr_rrtr_status_ RTC_GUARDED_BY(rtcp_receiver_lock_);
Danil Chapovalov4d2a2192023-06-16 14:12:06382 absl::optional<TimeDelta> xr_rr_rtt_;
asapersson@webrtc.org8469f7b2013-10-02 13:15:34383
Danil Chapovalovaa8faa62023-07-13 09:00:28384 Timestamp oldest_tmmbr_info_ RTC_GUARDED_BY(rtcp_receiver_lock_);
danilchap9bf610e2017-02-20 14:03:01385 // Mapped by remote ssrc.
Victor Boivief7156182021-07-06 21:14:51386 flat_map<uint32_t, TmmbrInformation> tmmbr_infos_
danilchap56359be2017-09-07 14:53:45387 RTC_GUARDED_BY(rtcp_receiver_lock_);
danilchap9bf610e2017-02-20 14:03:01388
Danil Chapovalov510c94c2021-07-02 11:51:19389 // Round-Trip Time per remote sender ssrc.
Victor Boivief7156182021-07-06 21:14:51390 flat_map<uint32_t, RttStats> rtts_ RTC_GUARDED_BY(rtcp_receiver_lock_);
Ivo Creusen2562cf02021-09-03 14:51:22391 // Non-sender Round-trip time per remote ssrc.
392 flat_map<uint32_t, NonSenderRttStats> non_sender_rtts_
393 RTC_GUARDED_BY(rtcp_receiver_lock_);
Danil Chapovalov510c94c2021-07-02 11:51:19394
395 // Report blocks per local source ssrc.
Victor Boivief7156182021-07-06 21:14:51396 flat_map<uint32_t, ReportBlockData> received_report_blocks_
Danil Chapovalov510c94c2021-07-02 11:51:19397 RTC_GUARDED_BY(rtcp_receiver_lock_);
Victor Boivief7156182021-07-06 21:14:51398 flat_map<uint32_t, LastFirStatus> last_fir_
danilchap56359be2017-09-07 14:53:45399 RTC_GUARDED_BY(rtcp_receiver_lock_);
niklase@google.com470e71d2011-07-07 08:21:25400
Danil Chapovalov760c4b42017-09-27 11:25:24401 // The last time we received an RTCP Report block for this module.
Tomas Gunnarssonba0ba712020-07-01 06:53:21402 Timestamp last_received_rb_ RTC_GUARDED_BY(rtcp_receiver_lock_) =
403 Timestamp::PlusInfinity();
mflodman@webrtc.org2f225ca2013-01-09 13:54:43404
asapersson@webrtc.orgcb791412014-12-18 14:30:32405 // The time we last received an RTCP RR telling we have successfully
mflodman@webrtc.org2f225ca2013-01-09 13:54:43406 // delivered RTP packet to the remote side.
Tomas Gunnarssonba0ba712020-07-01 06:53:21407 Timestamp last_increased_sequence_number_ = Timestamp::PlusInfinity();
stefan@webrtc.org8ca8a712013-04-23 16:48:32408
Danil Chapovalovbd74d5c2020-03-12 08:22:44409 RtcpCnameCallback* const cname_callback_;
Danil Chapovalovbd74d5c2020-03-12 08:22:44410 ReportBlockDataObserver* const report_block_data_observer_;
asapersson@webrtc.org8098e072014-02-19 11:59:02411
pbos@webrtc.org1d0fa5d2015-02-19 12:47:00412 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
asapersson@webrtc.org8098e072014-02-19 11:59:02413 RtcpPacketTypeCounter packet_type_counter_;
asapersson@webrtc.org2dd31342014-10-29 12:42:30414
danilchap84432382017-02-09 13:21:42415 RtcpNackStats nack_stats_;
Erik Språng6b8d3552015-09-24 13:06:57416
417 size_t num_skipped_packets_;
Danil Chapovalovaa8faa62023-07-13 09:00:28418 Timestamp last_skipped_packets_warning_;
niklase@google.com470e71d2011-07-07 08:21:25419};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26420} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 04:47:31421#endif // MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_