| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 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 | 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 | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 148 | 148 | 
| 149   void SetTargetBitrate(unsigned int target_bitrate); | 149   void SetTargetBitrate(unsigned int target_bitrate); | 
| 150   void SetVideoBitrateAllocation(const BitrateAllocation& bitrate); | 150   void SetVideoBitrateAllocation(const BitrateAllocation& bitrate); | 
| 151   bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); | 151   bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); | 
| 152 | 152 | 
| 153  private: | 153  private: | 
| 154   class RtcpContext; | 154   class RtcpContext; | 
| 155 | 155 | 
| 156   // Determine which RTCP messages should be sent and setup flags. | 156   // Determine which RTCP messages should be sent and setup flags. | 
| 157   void PrepareReport(const FeedbackState& feedback_state) | 157   void PrepareReport(const FeedbackState& feedback_state) | 
| 158       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 158       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 159 | 159 | 
| 160   std::vector<rtcp::ReportBlock> CreateReportBlocks( | 160   std::vector<rtcp::ReportBlock> CreateReportBlocks( | 
| 161       const FeedbackState& feedback_state) | 161       const FeedbackState& feedback_state) | 
| 162       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 162       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 163 | 163 | 
| 164   std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context) | 164   std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context) | 
| 165       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 165       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 166   std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context) | 166   std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context) | 
| 167       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 167       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 168   std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context) | 168   std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context) | 
| 169       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 169       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 170   std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context) | 170   std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context) | 
| 171       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 171       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 172   std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context) | 172   std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context) | 
| 173       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 173       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 174   std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context) | 174   std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context) | 
| 175       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 175       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 176   std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context) | 176   std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context) | 
| 177       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 177       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 178   std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context) | 178   std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context) | 
| 179       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 179       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 180   std::unique_ptr<rtcp::RtcpPacket> BuildExtendedReports( | 180   std::unique_ptr<rtcp::RtcpPacket> BuildExtendedReports( | 
| 181       const RtcpContext& context) | 181       const RtcpContext& context) | 
| 182       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 182       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 183   std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context) | 183   std::unique_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context) | 
| 184       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 184       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 185   std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context) | 185   std::unique_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context) | 
| 186       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 186       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 187   std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) | 187   std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) | 
| 188       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 188       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 189 | 189 | 
| 190  private: | 190  private: | 
| 191   const bool audio_; | 191   const bool audio_; | 
| 192   Clock* const clock_; | 192   Clock* const clock_; | 
| 193   Random random_ GUARDED_BY(critical_section_rtcp_sender_); | 193   Random random_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 194   RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); | 194   RtcpMode method_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 195 | 195 | 
| 196   RtcEventLog* const event_log_; | 196   RtcEventLog* const event_log_; | 
| 197   Transport* const transport_; | 197   Transport* const transport_; | 
| 198 | 198 | 
| 199   rtc::CriticalSection critical_section_rtcp_sender_; | 199   rtc::CriticalSection critical_section_rtcp_sender_; | 
| 200   bool using_nack_ GUARDED_BY(critical_section_rtcp_sender_); | 200   bool using_nack_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 201   bool sending_ GUARDED_BY(critical_section_rtcp_sender_); | 201   bool sending_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 202   bool remb_enabled_ GUARDED_BY(critical_section_rtcp_sender_); | 202   bool remb_enabled_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 203 | 203 | 
| 204   int64_t next_time_to_send_rtcp_ GUARDED_BY(critical_section_rtcp_sender_); | 204   int64_t next_time_to_send_rtcp_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 205 | 205 | 
| 206   uint32_t timestamp_offset_ GUARDED_BY(critical_section_rtcp_sender_); | 206   uint32_t timestamp_offset_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 207   uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); | 207   uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 208   int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); | 208   int64_t last_frame_capture_time_ms_ | 
| 209   uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); | 209       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
|  | 210   uint32_t ssrc_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 210   // SSRC that we receive on our RTP channel | 211   // SSRC that we receive on our RTP channel | 
| 211   uint32_t remote_ssrc_ GUARDED_BY(critical_section_rtcp_sender_); | 212   uint32_t remote_ssrc_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 212   std::string cname_ GUARDED_BY(critical_section_rtcp_sender_); | 213   std::string cname_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 213 | 214 | 
| 214   ReceiveStatisticsProvider* receive_statistics_ | 215   ReceiveStatisticsProvider* receive_statistics_ | 
| 215       GUARDED_BY(critical_section_rtcp_sender_); | 216       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 216   std::map<uint32_t, std::string> csrc_cnames_ | 217   std::map<uint32_t, std::string> csrc_cnames_ | 
| 217       GUARDED_BY(critical_section_rtcp_sender_); | 218       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 218 | 219 | 
| 219   // send CSRCs | 220   // send CSRCs | 
| 220   std::vector<uint32_t> csrcs_ GUARDED_BY(critical_section_rtcp_sender_); | 221   std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 221 | 222 | 
| 222   // Full intra request | 223   // Full intra request | 
| 223   uint8_t sequence_number_fir_ GUARDED_BY(critical_section_rtcp_sender_); | 224   uint8_t sequence_number_fir_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 224 | 225 | 
| 225   // REMB | 226   // REMB | 
| 226   uint32_t remb_bitrate_ GUARDED_BY(critical_section_rtcp_sender_); | 227   uint32_t remb_bitrate_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 227   std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(critical_section_rtcp_sender_); | 228   std::vector<uint32_t> remb_ssrcs_ | 
|  | 229       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 228 | 230 | 
| 229   std::vector<rtcp::TmmbItem> tmmbn_to_send_ | 231   std::vector<rtcp::TmmbItem> tmmbn_to_send_ | 
| 230       GUARDED_BY(critical_section_rtcp_sender_); | 232       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 231   uint32_t tmmbr_send_bps_ GUARDED_BY(critical_section_rtcp_sender_); | 233   uint32_t tmmbr_send_bps_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 232   uint32_t packet_oh_send_ GUARDED_BY(critical_section_rtcp_sender_); | 234   uint32_t packet_oh_send_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 233   size_t max_packet_size_ GUARDED_BY(critical_section_rtcp_sender_); | 235   size_t max_packet_size_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 234 | 236 | 
| 235   // APP | 237   // APP | 
| 236   uint8_t app_sub_type_ GUARDED_BY(critical_section_rtcp_sender_); | 238   uint8_t app_sub_type_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 237   uint32_t app_name_ GUARDED_BY(critical_section_rtcp_sender_); | 239   uint32_t app_name_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 238   std::unique_ptr<uint8_t[]> app_data_ | 240   std::unique_ptr<uint8_t[]> app_data_ | 
| 239       GUARDED_BY(critical_section_rtcp_sender_); | 241       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 240   uint16_t app_length_ GUARDED_BY(critical_section_rtcp_sender_); | 242   uint16_t app_length_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 241 | 243 | 
| 242   // True if sending of XR Receiver reference time report is enabled. | 244   // True if sending of XR Receiver reference time report is enabled. | 
| 243   bool xr_send_receiver_reference_time_enabled_ | 245   bool xr_send_receiver_reference_time_enabled_ | 
| 244       GUARDED_BY(critical_section_rtcp_sender_); | 246       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 245 | 247 | 
| 246   // XR VoIP metric | 248   // XR VoIP metric | 
| 247   rtc::Optional<RTCPVoIPMetric> xr_voip_metric_ | 249   rtc::Optional<RTCPVoIPMetric> xr_voip_metric_ | 
| 248       GUARDED_BY(critical_section_rtcp_sender_); | 250       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 249 | 251 | 
| 250   RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; | 252   RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; | 
| 251   RtcpPacketTypeCounter packet_type_counter_ | 253   RtcpPacketTypeCounter packet_type_counter_ | 
| 252       GUARDED_BY(critical_section_rtcp_sender_); | 254       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 253 | 255 | 
| 254   RtcpNackStats nack_stats_ GUARDED_BY(critical_section_rtcp_sender_); | 256   RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 255 | 257 | 
| 256   rtc::Optional<BitrateAllocation> video_bitrate_allocation_ | 258   rtc::Optional<BitrateAllocation> video_bitrate_allocation_ | 
| 257       GUARDED_BY(critical_section_rtcp_sender_); | 259       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 258 | 260 | 
| 259   void SetFlag(uint32_t type, bool is_volatile) | 261   void SetFlag(uint32_t type, bool is_volatile) | 
| 260       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 262       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 261   void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile) | 263   void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile) | 
| 262       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 264       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 263   bool IsFlagPresent(uint32_t type) const | 265   bool IsFlagPresent(uint32_t type) const | 
| 264       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 266       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 265   bool ConsumeFlag(uint32_t type, bool forced = false) | 267   bool ConsumeFlag(uint32_t type, bool forced = false) | 
| 266       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 268       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 267   bool AllVolatileFlagsConsumed() const | 269   bool AllVolatileFlagsConsumed() const | 
| 268       EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 270       RTC_EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 
| 269   struct ReportFlag { | 271   struct ReportFlag { | 
| 270     ReportFlag(uint32_t type, bool is_volatile) | 272     ReportFlag(uint32_t type, bool is_volatile) | 
| 271         : type(type), is_volatile(is_volatile) {} | 273         : type(type), is_volatile(is_volatile) {} | 
| 272     bool operator<(const ReportFlag& flag) const { return type < flag.type; } | 274     bool operator<(const ReportFlag& flag) const { return type < flag.type; } | 
| 273     bool operator==(const ReportFlag& flag) const { return type == flag.type; } | 275     bool operator==(const ReportFlag& flag) const { return type == flag.type; } | 
| 274     const uint32_t type; | 276     const uint32_t type; | 
| 275     const bool is_volatile; | 277     const bool is_volatile; | 
| 276   }; | 278   }; | 
| 277 | 279 | 
| 278   std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); | 280   std::set<ReportFlag> report_flags_ | 
|  | 281       RTC_GUARDED_BY(critical_section_rtcp_sender_); | 
| 279 | 282 | 
| 280   typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( | 283   typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( | 
| 281       const RtcpContext&); | 284       const RtcpContext&); | 
| 282   // Map from RTCPPacketType to builder. | 285   // Map from RTCPPacketType to builder. | 
| 283   std::map<uint32_t, BuilderFunc> builders_; | 286   std::map<uint32_t, BuilderFunc> builders_; | 
| 284 | 287 | 
| 285   RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); | 288   RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); | 
| 286 }; | 289 }; | 
| 287 }  // namespace webrtc | 290 }  // namespace webrtc | 
| 288 | 291 | 
| 289 #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 292 #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 
| OLD | NEW | 
|---|