blob: c9220dd35c7a9dfa00ad2ac5d0971b5d335737f9 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
12#define MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
pwestin@webrtc.org26f8d9c2012-01-19 15:53:09 +000014#include <map>
danilchap56036ff2016-03-22 11:14:09 -070015#include <memory>
Erik Språng242e22b2015-05-11 10:17:43 +020016#include <set>
edjee@google.com79b02892013-04-04 19:43:34 +000017#include <string>
danilchapb8b6fbb2015-12-10 05:05:27 -080018#include <vector>
pwestin@webrtc.org26f8d9c2012-01-19 15:53:09 +000019
Danil Chapovalovd264df52018-06-14 12:59:38 +020020#include "absl/types/optional.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "api/call/transport.h"
Erik Språngeeaa8f92018-05-17 12:35:56 +020022#include "api/video/video_bitrate_allocation.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020023#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
24#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
25#include "modules/rtp_rtcp/include/receive_statistics.h"
26#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.h"
29#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
30#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
31#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
32#include "rtc_base/constructormagic.h"
33#include "rtc_base/criticalsection.h"
34#include "rtc_base/random.h"
35#include "rtc_base/thread_annotations.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000036
37namespace webrtc {
pwestin@webrtc.org741da942011-09-20 13:52:04 +000038
wu@webrtc.org822fbd82013-08-15 23:38:54 +000039class ModuleRtpRtcpImpl;
terelius429c3452016-01-21 05:42:04 -080040class RtcEventLog;
pwestin@webrtc.org741da942011-09-20 13:52:04 +000041
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +000042class RTCPSender {
danilchap162abd32015-12-10 02:39:40 -080043 public:
44 struct FeedbackState {
45 FeedbackState();
Mirta Dvornicicb1f063d2018-04-16 11:16:21 +020046 FeedbackState(const FeedbackState&);
47 FeedbackState(FeedbackState&&);
48
49 ~FeedbackState();
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000050
danilchap162abd32015-12-10 02:39:40 -080051 uint32_t packets_sent;
52 size_t media_bytes_sent;
53 uint32_t send_bitrate;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000054
danilchap162abd32015-12-10 02:39:40 -080055 uint32_t last_rr_ntp_secs;
56 uint32_t last_rr_ntp_frac;
57 uint32_t remote_sr;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000058
Mirta Dvornicicb1f063d2018-04-16 11:16:21 +020059 std::vector<rtcp::ReceiveTimeInfo> last_xr_rtis;
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +000060
danilchap162abd32015-12-10 02:39:40 -080061 // Used when generating TMMBR.
62 ModuleRtpRtcpImpl* module;
63 };
Erik Språng61be2a42015-04-27 13:32:52 +020064
danilchap162abd32015-12-10 02:39:40 -080065 RTCPSender(bool audio,
66 Clock* clock,
danilchapf5f793c2017-07-27 04:44:18 -070067 ReceiveStatisticsProvider* receive_statistics,
danilchap162abd32015-12-10 02:39:40 -080068 RtcpPacketTypeCounterObserver* packet_type_counter_observer,
terelius429c3452016-01-21 05:42:04 -080069 RtcEventLog* event_log,
Jiawei Ou3587b832018-01-31 22:08:26 -080070 Transport* outgoing_transport,
71 RtcpIntervalConfig interval_config);
danilchap162abd32015-12-10 02:39:40 -080072 virtual ~RTCPSender();
niklase@google.com470e71d2011-07-07 08:21:25 +000073
danilchap162abd32015-12-10 02:39:40 -080074 RtcpMode Status() const;
75 void SetRTCPStatus(RtcpMode method);
niklase@google.com470e71d2011-07-07 08:21:25 +000076
danilchap162abd32015-12-10 02:39:40 -080077 bool Sending() const;
78 int32_t SetSendingStatus(const FeedbackState& feedback_state,
79 bool enabled); // combine the functions
niklase@google.com470e71d2011-07-07 08:21:25 +000080
danilchap162abd32015-12-10 02:39:40 -080081 int32_t SetNackStatus(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +000082
danilchap71fead22016-08-18 02:01:49 -070083 void SetTimestampOffset(uint32_t timestamp_offset);
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000084
danilchap162abd32015-12-10 02:39:40 -080085 void SetLastRtpTime(uint32_t rtp_timestamp, int64_t capture_time_ms);
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000086
nisse14adba72017-03-20 03:52:39 -070087 uint32_t SSRC() const;
88
danilchap162abd32015-12-10 02:39:40 -080089 void SetSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000090
danilchap162abd32015-12-10 02:39:40 -080091 void SetRemoteSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000092
danilchap162abd32015-12-10 02:39:40 -080093 int32_t SetCNAME(const char* cName);
niklase@google.com470e71d2011-07-07 08:21:25 +000094
danilchap162abd32015-12-10 02:39:40 -080095 int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name);
niklase@google.com470e71d2011-07-07 08:21:25 +000096
danilchap162abd32015-12-10 02:39:40 -080097 int32_t RemoveMixedCNAME(uint32_t SSRC);
niklase@google.com470e71d2011-07-07 08:21:25 +000098
danilchap162abd32015-12-10 02:39:40 -080099 bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000100
danilchap162abd32015-12-10 02:39:40 -0800101 int32_t SendRTCP(const FeedbackState& feedback_state,
102 RTCPPacketType packetType,
103 int32_t nackSize = 0,
nissecd386eb2017-03-14 08:54:43 -0700104 const uint16_t* nackList = 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000105
danilchap162abd32015-12-10 02:39:40 -0800106 int32_t SendCompoundRTCP(const FeedbackState& feedback_state,
107 const std::set<RTCPPacketType>& packetTypes,
108 int32_t nackSize = 0,
nissecd386eb2017-03-14 08:54:43 -0700109 const uint16_t* nackList = 0);
Erik Språng242e22b2015-05-11 10:17:43 +0200110
Danil Chapovalov1de4b622017-12-13 13:35:10 +0100111 void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs);
niklase@google.com470e71d2011-07-07 08:21:25 +0000112
Danil Chapovalovf74d6412017-10-18 13:32:57 +0200113 void UnsetRemb();
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000114
danilchap162abd32015-12-10 02:39:40 -0800115 bool TMMBR() const;
mflodman@webrtc.org84dc3d12011-12-22 10:26:13 +0000116
danilchap162abd32015-12-10 02:39:40 -0800117 void SetTMMBRStatus(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000118
nisse284542b2017-01-10 08:58:32 -0800119 void SetMaxRtpPacketSize(size_t max_packet_size);
danilchap41befce2016-03-30 11:11:51 -0700120
danilchap853ecb22016-08-22 08:26:15 -0700121 void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set);
niklase@google.com470e71d2011-07-07 08:21:25 +0000122
danilchap162abd32015-12-10 02:39:40 -0800123 int32_t SetApplicationSpecificData(uint8_t subType,
124 uint32_t name,
125 const uint8_t* data,
126 uint16_t length);
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000127
danilchap162abd32015-12-10 02:39:40 -0800128 void SendRtcpXrReceiverReferenceTime(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000129
danilchap162abd32015-12-10 02:39:40 -0800130 bool RtcpXrReceiverReferenceTime() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000131
danilchap162abd32015-12-10 02:39:40 -0800132 void SetCsrcs(const std::vector<uint32_t>& csrcs);
niklase@google.com470e71d2011-07-07 08:21:25 +0000133
danilchap162abd32015-12-10 02:39:40 -0800134 void SetTargetBitrate(unsigned int target_bitrate);
Erik Språng566124a2018-04-23 12:32:22 +0200135 void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate);
danilchap162abd32015-12-10 02:39:40 -0800136 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
mflodman@webrtc.org117c1192012-01-13 08:52:58 +0000137
Jiawei Ou3587b832018-01-31 22:08:26 -0800138 int64_t RtcpAudioReportInverval() const;
139 int64_t RtcpVideoReportInverval() const;
140
danilchap162abd32015-12-10 02:39:40 -0800141 private:
142 class RtcpContext;
Erik Språng242e22b2015-05-11 10:17:43 +0200143
danilchap162abd32015-12-10 02:39:40 -0800144 // Determine which RTCP messages should be sent and setup flags.
Danil Chapovalov70ffead2016-07-20 15:26:59 +0200145 void PrepareReport(const FeedbackState& feedback_state)
danilchap56359be2017-09-07 07:53:45 -0700146 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000147
danilchap96b69bd2017-07-25 09:15:14 -0700148 std::vector<rtcp::ReportBlock> CreateReportBlocks(
149 const FeedbackState& feedback_state)
danilchap56359be2017-09-07 07:53:45 -0700150 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000151
danilchap56036ff2016-03-22 11:14:09 -0700152 std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700153 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700154 std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700155 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700156 std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700157 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700158 std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700159 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700160 std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700161 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700162 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700163 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700164 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700165 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700166 std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700167 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
sprang5e38c962016-12-01 05:18:09 -0800168 std::unique_ptr<rtcp::RtcpPacket> BuildExtendedReports(
169 const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700170 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700171 std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700172 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700173 std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700174 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700175 std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context)
danilchap56359be2017-09-07 07:53:45 -0700176 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000177
danilchap162abd32015-12-10 02:39:40 -0800178 private:
179 const bool audio_;
180 Clock* const clock_;
danilchap56359be2017-09-07 07:53:45 -0700181 Random random_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
182 RtcpMode method_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000183
terelius429c3452016-01-21 05:42:04 -0800184 RtcEventLog* const event_log_;
danilchap162abd32015-12-10 02:39:40 -0800185 Transport* const transport_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000186
Jiawei Ou3587b832018-01-31 22:08:26 -0800187 const RtcpIntervalConfig interval_config_;
188
danilchap56036ff2016-03-22 11:14:09 -0700189 rtc::CriticalSection critical_section_rtcp_sender_;
danilchap56359be2017-09-07 07:53:45 -0700190 bool using_nack_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
191 bool sending_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000192
danilchap56359be2017-09-07 07:53:45 -0700193 int64_t next_time_to_send_rtcp_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000194
danilchap56359be2017-09-07 07:53:45 -0700195 uint32_t timestamp_offset_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
196 uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
197 int64_t last_frame_capture_time_ms_
198 RTC_GUARDED_BY(critical_section_rtcp_sender_);
199 uint32_t ssrc_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800200 // SSRC that we receive on our RTP channel
danilchap56359be2017-09-07 07:53:45 -0700201 uint32_t remote_ssrc_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
202 std::string cname_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000203
danilchapf5f793c2017-07-27 04:44:18 -0700204 ReceiveStatisticsProvider* receive_statistics_
danilchap56359be2017-09-07 07:53:45 -0700205 RTC_GUARDED_BY(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800206 std::map<uint32_t, std::string> csrc_cnames_
danilchap56359be2017-09-07 07:53:45 -0700207 RTC_GUARDED_BY(critical_section_rtcp_sender_);
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000208
danilchap162abd32015-12-10 02:39:40 -0800209 // send CSRCs
danilchap56359be2017-09-07 07:53:45 -0700210 std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000211
danilchap162abd32015-12-10 02:39:40 -0800212 // Full intra request
danilchap56359be2017-09-07 07:53:45 -0700213 uint8_t sequence_number_fir_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000214
danilchap162abd32015-12-10 02:39:40 -0800215 // REMB
Danil Chapovalov1de4b622017-12-13 13:35:10 +0100216 int64_t remb_bitrate_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
danilchap56359be2017-09-07 07:53:45 -0700217 std::vector<uint32_t> remb_ssrcs_
218 RTC_GUARDED_BY(critical_section_rtcp_sender_);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000219
danilchap6eaa3a42016-05-09 10:59:50 -0700220 std::vector<rtcp::TmmbItem> tmmbn_to_send_
danilchap56359be2017-09-07 07:53:45 -0700221 RTC_GUARDED_BY(critical_section_rtcp_sender_);
222 uint32_t tmmbr_send_bps_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
223 uint32_t packet_oh_send_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
224 size_t max_packet_size_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000225
danilchap162abd32015-12-10 02:39:40 -0800226 // APP
danilchap56359be2017-09-07 07:53:45 -0700227 uint8_t app_sub_type_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
228 uint32_t app_name_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700229 std::unique_ptr<uint8_t[]> app_data_
danilchap56359be2017-09-07 07:53:45 -0700230 RTC_GUARDED_BY(critical_section_rtcp_sender_);
231 uint16_t app_length_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000232
danilchap162abd32015-12-10 02:39:40 -0800233 // True if sending of XR Receiver reference time report is enabled.
234 bool xr_send_receiver_reference_time_enabled_
danilchap56359be2017-09-07 07:53:45 -0700235 RTC_GUARDED_BY(critical_section_rtcp_sender_);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000236
danilchap162abd32015-12-10 02:39:40 -0800237 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
238 RtcpPacketTypeCounter packet_type_counter_
danilchap56359be2017-09-07 07:53:45 -0700239 RTC_GUARDED_BY(critical_section_rtcp_sender_);
asapersson@webrtc.org2dd31342014-10-29 12:42:30 +0000240
danilchap56359be2017-09-07 07:53:45 -0700241 RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng242e22b2015-05-11 10:17:43 +0200242
Erik Språng8782a582018-10-04 15:36:06 +0200243 VideoBitrateAllocation video_bitrate_allocation_
danilchap56359be2017-09-07 07:53:45 -0700244 RTC_GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng8782a582018-10-04 15:36:06 +0200245 bool send_video_bitrate_allocation_
246 RTC_GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng1cd73912018-10-05 12:57:59 +0200247 absl::optional<VideoBitrateAllocation> CheckAndUpdateLayerStructure(
248 const VideoBitrateAllocation& bitrate) const
Erik Språng8782a582018-10-04 15:36:06 +0200249 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
sprang5e38c962016-12-01 05:18:09 -0800250
251 void SetFlag(uint32_t type, bool is_volatile)
danilchap56359be2017-09-07 07:53:45 -0700252 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800253 void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile)
danilchap56359be2017-09-07 07:53:45 -0700254 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
sprang5e38c962016-12-01 05:18:09 -0800255 bool IsFlagPresent(uint32_t type) const
danilchap56359be2017-09-07 07:53:45 -0700256 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
sprang5e38c962016-12-01 05:18:09 -0800257 bool ConsumeFlag(uint32_t type, bool forced = false)
danilchap56359be2017-09-07 07:53:45 -0700258 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800259 bool AllVolatileFlagsConsumed() const
danilchap56359be2017-09-07 07:53:45 -0700260 RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800261 struct ReportFlag {
sprang5e38c962016-12-01 05:18:09 -0800262 ReportFlag(uint32_t type, bool is_volatile)
danilchap162abd32015-12-10 02:39:40 -0800263 : type(type), is_volatile(is_volatile) {}
264 bool operator<(const ReportFlag& flag) const { return type < flag.type; }
265 bool operator==(const ReportFlag& flag) const { return type == flag.type; }
sprang5e38c962016-12-01 05:18:09 -0800266 const uint32_t type;
danilchap162abd32015-12-10 02:39:40 -0800267 const bool is_volatile;
268 };
Erik Språng242e22b2015-05-11 10:17:43 +0200269
danilchap56359be2017-09-07 07:53:45 -0700270 std::set<ReportFlag> report_flags_
271 RTC_GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng242e22b2015-05-11 10:17:43 +0200272
danilchap56036ff2016-03-22 11:14:09 -0700273 typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)(
danilchap162abd32015-12-10 02:39:40 -0800274 const RtcpContext&);
sprang5e38c962016-12-01 05:18:09 -0800275 // Map from RTCPPacketType to builder.
276 std::map<uint32_t, BuilderFunc> builders_;
terelius429c3452016-01-21 05:42:04 -0800277
278 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000279};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000280} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000281
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200282#endif // MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_