| File: | root/firefox-clang/third_party/libwebrtc/modules/rtp_rtcp/source/rtcp_sender.h |
| Warning: | line 50, column 7 Excessive padding in 'class webrtc::RTCPSender' (46 padding bytes, where 6 is optimal). Optimal fields order: random_, transport_, report_interval_, receive_statistics_, remb_bitrate_, max_packet_size_, packet_type_counter_observer_, next_time_to_send_rtcp_, last_frame_capture_time_, csrcs_, loss_notification_, remb_ssrcs_, tmmbn_to_send_, schedule_next_rtcp_send_evaluation_function_, cname_, env_, rtp_clock_rates_khz_, report_flags_, builders_, mutex_rtcp_sender_, ssrc_, method_, timestamp_offset_, last_rtp_timestamp_, remote_ssrc_, tmmbr_send_bps_, packet_oh_send_, nack_stats_, packet_type_counter_, video_bitrate_allocation_, audio_, sending_, sequence_number_fir_, xr_send_receiver_reference_time_enabled_, send_video_bitrate_allocation_, last_payload_type_, consider reordering the fields or adding explicit padding members |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 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 MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| 12 | #define MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| 13 | |
| 14 | #include <cstddef> |
| 15 | #include <cstdint> |
| 16 | #include <functional> |
| 17 | #include <map> |
| 18 | #include <memory> |
| 19 | #include <optional> |
| 20 | #include <set> |
| 21 | #include <string> |
| 22 | #include <vector> |
| 23 | |
| 24 | #include "absl/strings/string_view.h" |
| 25 | #include "api/call/transport.h" |
| 26 | #include "api/environment/environment.h" |
| 27 | #include "api/rtp_headers.h" |
| 28 | #include "api/units/data_rate.h" |
| 29 | #include "api/units/time_delta.h" |
| 30 | #include "api/units/timestamp.h" |
| 31 | #include "api/video/video_bitrate_allocation.h" |
| 32 | #include "modules/rtp_rtcp/include/receive_statistics.h" |
| 33 | #include "modules/rtp_rtcp/include/rtcp_statistics.h" |
| 34 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 35 | #include "modules/rtp_rtcp/source/rtcp_nack_stats.h" |
| 36 | #include "modules/rtp_rtcp/source/rtcp_packet.h" |
| 37 | #include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
| 38 | #include "modules/rtp_rtcp/source/rtcp_packet/loss_notification.h" |
| 39 | #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
| 40 | #include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
| 41 | #include "modules/rtp_rtcp/source/rtcp_receiver.h" |
| 42 | #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" |
| 43 | #include "rtc_base/random.h" |
| 44 | #include "rtc_base/synchronization/mutex.h" |
| 45 | #include "rtc_base/thread_annotations.h" |
| 46 | #include "system_wrappers/include/ntp_time.h" |
| 47 | |
| 48 | namespace webrtc { |
| 49 | |
| 50 | class RTCPSender final { |
Excessive padding in 'class webrtc::RTCPSender' (46 padding bytes, where 6 is optimal). Optimal fields order: random_, transport_, report_interval_, receive_statistics_, remb_bitrate_, max_packet_size_, packet_type_counter_observer_, next_time_to_send_rtcp_, last_frame_capture_time_, csrcs_, loss_notification_, remb_ssrcs_, tmmbn_to_send_, schedule_next_rtcp_send_evaluation_function_, cname_, env_, rtp_clock_rates_khz_, report_flags_, builders_, mutex_rtcp_sender_, ssrc_, method_, timestamp_offset_, last_rtp_timestamp_, remote_ssrc_, tmmbr_send_bps_, packet_oh_send_, nack_stats_, packet_type_counter_, video_bitrate_allocation_, audio_, sending_, sequence_number_fir_, xr_send_receiver_reference_time_enabled_, send_video_bitrate_allocation_, last_payload_type_, consider reordering the fields or adding explicit padding members | |
| 51 | public: |
| 52 | struct Configuration { |
| 53 | // TODO(bugs.webrtc.org/11581): Remove this temporary conversion utility |
| 54 | // once rtc_rtcp_impl.cc/h are gone. |
| 55 | static Configuration FromRtpRtcpConfiguration( |
| 56 | const RtpRtcpInterface::Configuration& config); |
| 57 | |
| 58 | // True for a audio version of the RTP/RTCP module object false will create |
| 59 | // a video version. |
| 60 | bool audio = false; |
| 61 | // SSRCs for media and retransmission, respectively. |
| 62 | // FlexFec SSRC is fetched from `flexfec_sender`. |
| 63 | uint32_t local_media_ssrc = 0; |
| 64 | |
| 65 | // Transport object that will be called when packets are ready to be sent |
| 66 | // out on the network. |
| 67 | Transport* outgoing_transport = nullptr; |
| 68 | // Estimate RTT as non-sender as described in |
| 69 | // https://tools.ietf.org/html/rfc3611#section-4.4 and #section-4.5 |
| 70 | bool non_sender_rtt_measurement = false; |
| 71 | // Optional callback which, if specified, is used by RTCPSender to schedule |
| 72 | // the next time to evaluate if RTCP should be sent by means of |
| 73 | // TimeToSendRTCPReport/SendRTCP. |
| 74 | // The RTCPSender client still needs to call TimeToSendRTCPReport/SendRTCP |
| 75 | // to actually get RTCP sent. |
| 76 | // |
| 77 | // Note: It's recommended to use the callback to ensure program design that |
| 78 | // doesn't use polling. |
| 79 | // TODO(bugs.webrtc.org/11581): Make mandatory once downstream consumers |
| 80 | // have migrated to the callback solution. |
| 81 | std::function<void(TimeDelta)> schedule_next_rtcp_send_evaluation_function; |
| 82 | |
| 83 | std::optional<TimeDelta> rtcp_report_interval; |
| 84 | ReceiveStatisticsProvider* receive_statistics = nullptr; |
| 85 | RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer = nullptr; |
| 86 | }; |
| 87 | struct FeedbackState { |
| 88 | FeedbackState(); |
| 89 | FeedbackState(const FeedbackState&); |
| 90 | FeedbackState(FeedbackState&&); |
| 91 | |
| 92 | ~FeedbackState(); |
| 93 | |
| 94 | uint32_t packets_sent; |
| 95 | size_t media_bytes_sent; |
| 96 | DataRate send_bitrate; |
| 97 | |
| 98 | uint32_t remote_sr; |
| 99 | NtpTime last_rr; |
| 100 | |
| 101 | std::vector<rtcp::ReceiveTimeInfo> last_xr_rtis; |
| 102 | |
| 103 | // Used when generating TMMBR. |
| 104 | RTCPReceiver* receiver; |
| 105 | }; |
| 106 | |
| 107 | RTCPSender(const Environment& env, Configuration config); |
| 108 | |
| 109 | RTCPSender() = delete; |
| 110 | RTCPSender(const RTCPSender&) = delete; |
| 111 | RTCPSender& operator=(const RTCPSender&) = delete; |
| 112 | |
| 113 | ~RTCPSender(); |
| 114 | |
| 115 | RtcpMode Status() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 116 | void SetRTCPStatus(RtcpMode method) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 117 | |
| 118 | bool Sending() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 119 | void SetSendingStatus(const FeedbackState& feedback_state, |
| 120 | bool enabled) |
| 121 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); // combine the functions |
| 122 | |
| 123 | void SetNonSenderRttMeasurement(bool enabled) |
| 124 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 125 | |
| 126 | void SetTimestampOffset(uint32_t timestamp_offset) |
| 127 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 128 | |
| 129 | void SetLastRtpTime(uint32_t rtp_timestamp, |
| 130 | std::optional<Timestamp> capture_time, |
| 131 | std::optional<int8_t> payload_type) |
| 132 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 133 | |
| 134 | void SetRtpClockRate(int8_t payload_type, int rtp_clock_rate_hz) |
| 135 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 136 | |
| 137 | uint32_t SSRC() const; |
| 138 | void SetSsrc(uint32_t ssrc); |
| 139 | |
| 140 | void SetRemoteSSRC(uint32_t ssrc) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 141 | |
| 142 | int32_t SetCNAME(absl::string_view cName) |
| 143 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 144 | |
| 145 | bool TimeToSendRTCPReport(bool send_keyframe_before_rtp = false) const |
| 146 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 147 | |
| 148 | int32_t SendRTCP(const FeedbackState& feedback_state, |
| 149 | RTCPPacketType packetType, |
| 150 | int32_t nackSize = 0, |
| 151 | const uint16_t* nackList = 0) |
| 152 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 153 | |
| 154 | int32_t SendLossNotification(const FeedbackState& feedback_state, |
| 155 | uint16_t last_decoded_seq_num, |
| 156 | uint16_t last_received_seq_num, |
| 157 | bool decodability_flag, |
| 158 | bool buffering_allowed) |
| 159 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 160 | |
| 161 | void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) |
| 162 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 163 | |
| 164 | void UnsetRemb() RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 165 | |
| 166 | bool TMMBR() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 167 | |
| 168 | void SetMaxRtpPacketSize(size_t max_packet_size) |
| 169 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 170 | |
| 171 | void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) |
| 172 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 173 | |
| 174 | void SetCsrcs(const std::vector<uint32_t>& csrcs) |
| 175 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 176 | |
| 177 | void SetTargetBitrate(unsigned int target_bitrate) |
| 178 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 179 | void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate) |
| 180 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 181 | void SendCombinedRtcpPacket( |
| 182 | std::vector<std::unique_ptr<rtcp::RtcpPacket>> rtcp_packets) |
| 183 | RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_)__attribute__((locks_excluded(mutex_rtcp_sender_))); |
| 184 | |
| 185 | private: |
| 186 | class RtcpContext; |
| 187 | class PacketSender; |
| 188 | |
| 189 | std::optional<int32_t> ComputeCompoundRTCPPacket( |
| 190 | const FeedbackState& feedback_state, |
| 191 | RTCPPacketType packet_type, |
| 192 | int32_t nack_size, |
| 193 | const uint16_t* nack_list, |
| 194 | PacketSender& sender) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 195 | |
| 196 | TimeDelta ComputeTimeUntilNextReport(DataRate send_bitrate) |
| 197 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 198 | |
| 199 | // Determine which RTCP messages should be sent and setup flags. |
| 200 | void PrepareReport(const FeedbackState& feedback_state) |
| 201 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 202 | |
| 203 | std::vector<rtcp::ReportBlock> CreateReportBlocks( |
| 204 | const FeedbackState& feedback_state) |
| 205 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 206 | |
| 207 | void BuildSR(const RtcpContext& context, PacketSender& sender) |
| 208 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 209 | void BuildRR(const RtcpContext& context, PacketSender& sender) |
| 210 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 211 | void BuildSDES(const RtcpContext& context, PacketSender& sender) |
| 212 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 213 | void BuildPLI(const RtcpContext& context, PacketSender& sender) |
| 214 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 215 | void BuildREMB(const RtcpContext& context, PacketSender& sender) |
| 216 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 217 | void BuildTMMBR(const RtcpContext& context, PacketSender& sender) |
| 218 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 219 | void BuildTMMBN(const RtcpContext& context, PacketSender& sender) |
| 220 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 221 | void BuildAPP(const RtcpContext& context, PacketSender& sender) |
| 222 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 223 | void BuildLossNotification(const RtcpContext& context, PacketSender& sender) |
| 224 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 225 | void BuildExtendedReports(const RtcpContext& context, PacketSender& sender) |
| 226 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 227 | void BuildBYE(const RtcpContext& context, PacketSender& sender) |
| 228 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 229 | void BuildFIR(const RtcpContext& context, PacketSender& sender) |
| 230 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 231 | void BuildNACK(const RtcpContext& context, PacketSender& sender) |
| 232 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 233 | |
| 234 | // `duration` being TimeDelta::Zero() means schedule immediately. |
| 235 | void SetNextRtcpSendEvaluationDuration(TimeDelta duration) |
| 236 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 237 | |
| 238 | const Environment env_; |
| 239 | const bool audio_; |
| 240 | // TODO(bugs.webrtc.org/11581): `mutex_rtcp_sender_` shouldn't be required if |
| 241 | // we consistently run network related operations on the network thread. |
| 242 | // This is currently not possible due to callbacks from the process thread in |
| 243 | // ModuleRtpRtcpImpl2. |
| 244 | uint32_t ssrc_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 245 | Random random_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 246 | RtcpMode method_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 247 | |
| 248 | Transport* const transport_; |
| 249 | |
| 250 | const TimeDelta report_interval_; |
| 251 | // Set from |
| 252 | // RTCPSender::Configuration::schedule_next_rtcp_send_evaluation_function. |
| 253 | const std::function<void(TimeDelta)> |
| 254 | schedule_next_rtcp_send_evaluation_function_; |
| 255 | |
| 256 | mutable Mutex mutex_rtcp_sender_; |
| 257 | bool sending_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 258 | |
| 259 | std::optional<Timestamp> next_time_to_send_rtcp_ |
| 260 | RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 261 | |
| 262 | uint32_t timestamp_offset_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 263 | uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 264 | std::optional<Timestamp> last_frame_capture_time_ |
| 265 | RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 266 | // SSRC that we receive on our RTP channel |
| 267 | uint32_t remote_ssrc_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 268 | std::string cname_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 269 | |
| 270 | ReceiveStatisticsProvider* receive_statistics_ |
| 271 | RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 272 | |
| 273 | // send CSRCs |
| 274 | std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 275 | |
| 276 | // Full intra request |
| 277 | uint8_t sequence_number_fir_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 278 | |
| 279 | rtcp::LossNotification loss_notification_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 280 | |
| 281 | // REMB |
| 282 | int64_t remb_bitrate_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 283 | std::vector<uint32_t> remb_ssrcs_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 284 | |
| 285 | std::vector<rtcp::TmmbItem> tmmbn_to_send_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 286 | uint32_t tmmbr_send_bps_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 287 | uint32_t packet_oh_send_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 288 | size_t max_packet_size_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 289 | |
| 290 | // True if sending of XR Receiver reference time report is enabled. |
| 291 | bool xr_send_receiver_reference_time_enabled_ |
| 292 | RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 293 | |
| 294 | RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
| 295 | RtcpPacketTypeCounter packet_type_counter_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 296 | |
| 297 | RtcpNackStats nack_stats_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 298 | |
| 299 | VideoBitrateAllocation video_bitrate_allocation_ |
| 300 | RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 301 | bool send_video_bitrate_allocation_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 302 | |
| 303 | std::map<int8_t, int> rtp_clock_rates_khz_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 304 | int8_t last_payload_type_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 305 | |
| 306 | std::optional<VideoBitrateAllocation> CheckAndUpdateLayerStructure( |
| 307 | const VideoBitrateAllocation& bitrate) const |
| 308 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 309 | |
| 310 | void SetFlag(uint32_t type, bool is_volatile) |
| 311 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 312 | bool IsFlagPresent(uint32_t type) const |
| 313 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 314 | bool ConsumeFlag(uint32_t type, bool forced = false) |
| 315 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 316 | bool AllVolatileFlagsConsumed() const |
| 317 | RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_)__attribute__((exclusive_locks_required(mutex_rtcp_sender_))); |
| 318 | struct ReportFlag { |
| 319 | ReportFlag(uint32_t type, bool is_volatile) |
| 320 | : type(type), is_volatile(is_volatile) {} |
| 321 | bool operator<(const ReportFlag& flag) const { return type < flag.type; } |
| 322 | bool operator==(const ReportFlag& flag) const { return type == flag.type; } |
| 323 | const uint32_t type; |
| 324 | const bool is_volatile; |
| 325 | }; |
| 326 | |
| 327 | std::set<ReportFlag> report_flags_ RTC_GUARDED_BY(mutex_rtcp_sender_)__attribute__((guarded_by(mutex_rtcp_sender_))); |
| 328 | |
| 329 | typedef void (RTCPSender::*BuilderFunc)(const RtcpContext&, PacketSender&); |
| 330 | // Map from RTCPPacketType to builder. |
| 331 | std::map<uint32_t, BuilderFunc> builders_; |
| 332 | }; |
| 333 | } // namespace webrtc |
| 334 | |
| 335 | #endif // MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |