blob: 02719aa1c50907d549a40afd71d1905898194963 [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
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
13
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 <sstream>
18#include <string>
danilchapb8b6fbb2015-12-10 05:05:27 -080019#include <vector>
pwestin@webrtc.org26f8d9c2012-01-19 15:53:09 +000020
kwiberg4485ffb2016-04-26 08:14:39 -070021#include "webrtc/base/constructormagic.h"
danilchap56036ff2016-03-22 11:14:09 -070022#include "webrtc/base/criticalsection.h"
danilchap47a740b2015-12-15 00:30:07 -080023#include "webrtc/base/random.h"
pbos@webrtc.org38344ed2014-09-24 06:05:00 +000024#include "webrtc/base/thread_annotations.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000025#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
26#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010027#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
28#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Erik Språngbdc0b0d2015-06-22 15:21:24 +020029#include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
danilchap34ed2b92016-01-18 02:43:32 -080030#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000031#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000032#include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
pbos2d566682015-09-28 09:59:31 -070033#include "webrtc/transport.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000034#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000035
36namespace webrtc {
pwestin@webrtc.org741da942011-09-20 13:52:04 +000037
wu@webrtc.org822fbd82013-08-15 23:38:54 +000038class ModuleRtpRtcpImpl;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000039class RTCPReceiver;
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 NACKStringBuilder {
43 public:
44 NACKStringBuilder();
45 ~NACKStringBuilder();
pbos@webrtc.orgf3e4cee2013-07-31 15:17:19 +000046
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +000047 void PushNACK(uint16_t nack);
48 std::string GetResult();
edjee@google.com79b02892013-04-04 19:43:34 +000049
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +000050 private:
Erik Språng242e22b2015-05-11 10:17:43 +020051 std::ostringstream stream_;
52 int count_;
53 uint16_t prevNack_;
54 bool consecutive_;
edjee@google.com79b02892013-04-04 19:43:34 +000055};
56
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +000057class RTCPSender {
danilchap162abd32015-12-10 02:39:40 -080058 public:
59 struct FeedbackState {
60 FeedbackState();
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000061
danilchap162abd32015-12-10 02:39:40 -080062 uint8_t send_payload_type;
63 uint32_t frequency_hz;
64 uint32_t packets_sent;
65 size_t media_bytes_sent;
66 uint32_t send_bitrate;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000067
danilchap162abd32015-12-10 02:39:40 -080068 uint32_t last_rr_ntp_secs;
69 uint32_t last_rr_ntp_frac;
70 uint32_t remote_sr;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000071
danilchap162abd32015-12-10 02:39:40 -080072 bool has_last_xr_rr;
73 RtcpReceiveTimeInfo last_xr_rr;
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +000074
danilchap162abd32015-12-10 02:39:40 -080075 // Used when generating TMMBR.
76 ModuleRtpRtcpImpl* module;
77 };
Erik Språng61be2a42015-04-27 13:32:52 +020078
danilchap162abd32015-12-10 02:39:40 -080079 RTCPSender(bool audio,
80 Clock* clock,
81 ReceiveStatistics* receive_statistics,
82 RtcpPacketTypeCounterObserver* packet_type_counter_observer,
terelius429c3452016-01-21 05:42:04 -080083 RtcEventLog* event_log,
danilchap162abd32015-12-10 02:39:40 -080084 Transport* outgoing_transport);
85 virtual ~RTCPSender();
niklase@google.com470e71d2011-07-07 08:21:25 +000086
danilchap162abd32015-12-10 02:39:40 -080087 RtcpMode Status() const;
88 void SetRTCPStatus(RtcpMode method);
niklase@google.com470e71d2011-07-07 08:21:25 +000089
danilchap162abd32015-12-10 02:39:40 -080090 bool Sending() const;
91 int32_t SetSendingStatus(const FeedbackState& feedback_state,
92 bool enabled); // combine the functions
niklase@google.com470e71d2011-07-07 08:21:25 +000093
danilchap162abd32015-12-10 02:39:40 -080094 int32_t SetNackStatus(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +000095
danilchap162abd32015-12-10 02:39:40 -080096 void SetStartTimestamp(uint32_t start_timestamp);
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000097
danilchap162abd32015-12-10 02:39:40 -080098 void SetLastRtpTime(uint32_t rtp_timestamp, int64_t capture_time_ms);
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000099
danilchap162abd32015-12-10 02:39:40 -0800100 void SetSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +0000101
danilchap162abd32015-12-10 02:39:40 -0800102 void SetRemoteSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +0000103
danilchap162abd32015-12-10 02:39:40 -0800104 int32_t SetCNAME(const char* cName);
niklase@google.com470e71d2011-07-07 08:21:25 +0000105
danilchap162abd32015-12-10 02:39:40 -0800106 int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name);
niklase@google.com470e71d2011-07-07 08:21:25 +0000107
danilchap162abd32015-12-10 02:39:40 -0800108 int32_t RemoveMixedCNAME(uint32_t SSRC);
niklase@google.com470e71d2011-07-07 08:21:25 +0000109
danilchap162abd32015-12-10 02:39:40 -0800110 bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000111
danilchap162abd32015-12-10 02:39:40 -0800112 int32_t SendRTCP(const FeedbackState& feedback_state,
113 RTCPPacketType packetType,
114 int32_t nackSize = 0,
115 const uint16_t* nackList = 0,
116 bool repeat = false,
117 uint64_t pictureID = 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000118
danilchap162abd32015-12-10 02:39:40 -0800119 int32_t SendCompoundRTCP(const FeedbackState& feedback_state,
120 const std::set<RTCPPacketType>& packetTypes,
121 int32_t nackSize = 0,
122 const uint16_t* nackList = 0,
123 bool repeat = false,
124 uint64_t pictureID = 0);
Erik Språng242e22b2015-05-11 10:17:43 +0200125
danilchap162abd32015-12-10 02:39:40 -0800126 bool REMB() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000127
danilchap162abd32015-12-10 02:39:40 -0800128 void SetREMBStatus(bool enable);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000129
danilchap162abd32015-12-10 02:39:40 -0800130 void SetREMBData(uint32_t bitrate, const std::vector<uint32_t>& ssrcs);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000131
danilchap162abd32015-12-10 02:39:40 -0800132 bool TMMBR() const;
mflodman@webrtc.org84dc3d12011-12-22 10:26:13 +0000133
danilchap162abd32015-12-10 02:39:40 -0800134 void SetTMMBRStatus(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000135
danilchap41befce2016-03-30 11:11:51 -0700136 void SetMaxPayloadLength(size_t max_payload_length);
137
danilchap6eaa3a42016-05-09 10:59:50 -0700138 void SetTMMBN(const std::vector<rtcp::TmmbItem>* boundingSet);
niklase@google.com470e71d2011-07-07 08:21:25 +0000139
danilchap162abd32015-12-10 02:39:40 -0800140 int32_t SetApplicationSpecificData(uint8_t subType,
141 uint32_t name,
142 const uint8_t* data,
143 uint16_t length);
144 int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000145
danilchap162abd32015-12-10 02:39:40 -0800146 void SendRtcpXrReceiverReferenceTime(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000147
danilchap162abd32015-12-10 02:39:40 -0800148 bool RtcpXrReceiverReferenceTime() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000149
danilchap162abd32015-12-10 02:39:40 -0800150 void SetCsrcs(const std::vector<uint32_t>& csrcs);
niklase@google.com470e71d2011-07-07 08:21:25 +0000151
danilchap162abd32015-12-10 02:39:40 -0800152 void SetTargetBitrate(unsigned int target_bitrate);
153 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
mflodman@webrtc.org117c1192012-01-13 08:52:58 +0000154
danilchap162abd32015-12-10 02:39:40 -0800155 private:
156 class RtcpContext;
Erik Språng242e22b2015-05-11 10:17:43 +0200157
danilchap162abd32015-12-10 02:39:40 -0800158 // Determine which RTCP messages should be sent and setup flags.
159 void PrepareReport(const std::set<RTCPPacketType>& packetTypes,
160 const FeedbackState& feedback_state)
161 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000162
danilchapa72e7342015-12-22 08:07:45 -0800163 bool AddReportBlock(const FeedbackState& feedback_state,
164 uint32_t ssrc,
165 StreamStatistician* statistician)
danilchap162abd32015-12-10 02:39:40 -0800166 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000167
danilchap56036ff2016-03-22 11:14:09 -0700168 std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800169 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700170 std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800171 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700172 std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800173 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700174 std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800175 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700176 std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800177 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700178 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800179 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700180 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800181 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700182 std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800183 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700184 std::unique_ptr<rtcp::RtcpPacket> BuildVoIPMetric(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800185 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700186 std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800187 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700188 std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800189 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700190 std::unique_ptr<rtcp::RtcpPacket> BuildSLI(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800191 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700192 std::unique_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800193 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700194 std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800195 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700196 std::unique_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime(
danilchap162abd32015-12-10 02:39:40 -0800197 const RtcpContext& context)
198 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700199 std::unique_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context)
danilchap162abd32015-12-10 02:39:40 -0800200 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000201
danilchap162abd32015-12-10 02:39:40 -0800202 private:
203 const bool audio_;
204 Clock* const clock_;
danilchap47a740b2015-12-15 00:30:07 -0800205 Random random_ GUARDED_BY(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800206 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000207
terelius429c3452016-01-21 05:42:04 -0800208 RtcEventLog* const event_log_;
danilchap162abd32015-12-10 02:39:40 -0800209 Transport* const transport_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000210
danilchap56036ff2016-03-22 11:14:09 -0700211 rtc::CriticalSection critical_section_rtcp_sender_;
danilchap162abd32015-12-10 02:39:40 -0800212 bool using_nack_ GUARDED_BY(critical_section_rtcp_sender_);
213 bool sending_ GUARDED_BY(critical_section_rtcp_sender_);
214 bool remb_enabled_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000215
danilchap162abd32015-12-10 02:39:40 -0800216 int64_t next_time_to_send_rtcp_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000217
danilchap162abd32015-12-10 02:39:40 -0800218 uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_);
219 uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_);
220 int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_);
221 uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_);
222 // SSRC that we receive on our RTP channel
223 uint32_t remote_ssrc_ GUARDED_BY(critical_section_rtcp_sender_);
224 std::string cname_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000225
danilchap162abd32015-12-10 02:39:40 -0800226 ReceiveStatistics* receive_statistics_
227 GUARDED_BY(critical_section_rtcp_sender_);
228 std::map<uint32_t, rtcp::ReportBlock> report_blocks_
229 GUARDED_BY(critical_section_rtcp_sender_);
230 std::map<uint32_t, std::string> csrc_cnames_
231 GUARDED_BY(critical_section_rtcp_sender_);
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000232
danilchap162abd32015-12-10 02:39:40 -0800233 // send CSRCs
234 std::vector<uint32_t> csrcs_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000235
danilchap162abd32015-12-10 02:39:40 -0800236 // Full intra request
237 uint8_t sequence_number_fir_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000238
danilchap162abd32015-12-10 02:39:40 -0800239 // REMB
240 uint32_t remb_bitrate_ GUARDED_BY(critical_section_rtcp_sender_);
241 std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(critical_section_rtcp_sender_);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000242
danilchap162abd32015-12-10 02:39:40 -0800243 TMMBRHelp tmmbr_help_ GUARDED_BY(critical_section_rtcp_sender_);
danilchap6eaa3a42016-05-09 10:59:50 -0700244 std::vector<rtcp::TmmbItem> tmmbn_to_send_
245 GUARDED_BY(critical_section_rtcp_sender_);
danilchap162abd32015-12-10 02:39:40 -0800246 uint32_t tmmbr_send_ GUARDED_BY(critical_section_rtcp_sender_);
247 uint32_t packet_oh_send_ GUARDED_BY(critical_section_rtcp_sender_);
danilchap41befce2016-03-30 11:11:51 -0700248 size_t max_payload_length_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000249
danilchap162abd32015-12-10 02:39:40 -0800250 // APP
251 uint8_t app_sub_type_ GUARDED_BY(critical_section_rtcp_sender_);
252 uint32_t app_name_ GUARDED_BY(critical_section_rtcp_sender_);
danilchap56036ff2016-03-22 11:14:09 -0700253 std::unique_ptr<uint8_t[]> app_data_
danilchap162abd32015-12-10 02:39:40 -0800254 GUARDED_BY(critical_section_rtcp_sender_);
255 uint16_t app_length_ GUARDED_BY(critical_section_rtcp_sender_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000256
danilchap162abd32015-12-10 02:39:40 -0800257 // True if sending of XR Receiver reference time report is enabled.
258 bool xr_send_receiver_reference_time_enabled_
259 GUARDED_BY(critical_section_rtcp_sender_);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000260
danilchap162abd32015-12-10 02:39:40 -0800261 // XR VoIP metric
262 RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_);
edjee@google.com79b02892013-04-04 19:43:34 +0000263
danilchap162abd32015-12-10 02:39:40 -0800264 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
265 RtcpPacketTypeCounter packet_type_counter_
266 GUARDED_BY(critical_section_rtcp_sender_);
asapersson@webrtc.org2dd31342014-10-29 12:42:30 +0000267
danilchap162abd32015-12-10 02:39:40 -0800268 RTCPUtility::NackStats nack_stats_ GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng242e22b2015-05-11 10:17:43 +0200269
danilchap162abd32015-12-10 02:39:40 -0800270 void SetFlag(RTCPPacketType type, bool is_volatile)
271 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
272 void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile)
273 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
274 bool IsFlagPresent(RTCPPacketType type) const
275 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
276 bool ConsumeFlag(RTCPPacketType type, bool forced = false)
277 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
278 bool AllVolatileFlagsConsumed() const
279 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_);
280 struct ReportFlag {
281 ReportFlag(RTCPPacketType type, bool is_volatile)
282 : type(type), is_volatile(is_volatile) {}
283 bool operator<(const ReportFlag& flag) const { return type < flag.type; }
284 bool operator==(const ReportFlag& flag) const { return type == flag.type; }
285 const RTCPPacketType type;
286 const bool is_volatile;
287 };
Erik Språng242e22b2015-05-11 10:17:43 +0200288
danilchap162abd32015-12-10 02:39:40 -0800289 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_);
Erik Språng242e22b2015-05-11 10:17:43 +0200290
danilchap56036ff2016-03-22 11:14:09 -0700291 typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)(
danilchap162abd32015-12-10 02:39:40 -0800292 const RtcpContext&);
293 std::map<RTCPPacketType, BuilderFunc> builders_;
terelius429c3452016-01-21 05:42:04 -0800294
295 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000296};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000297} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000298
danilchap162abd32015-12-10 02:39:40 -0800299#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_