| 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 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <memory> |
| 15 #include <set> | 16 #include <set> |
| 16 #include <sstream> | 17 #include <sstream> |
| 17 #include <string> | 18 #include <string> |
| 18 #include <vector> | 19 #include <vector> |
| 19 | 20 |
| 21 #include "webrtc/base/criticalsection.h" |
| 20 #include "webrtc/base/random.h" | 22 #include "webrtc/base/random.h" |
| 21 #include "webrtc/base/scoped_ptr.h" | |
| 22 #include "webrtc/base/thread_annotations.h" | 23 #include "webrtc/base/thread_annotations.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 24 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 25 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 26 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
| 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | |
| 31 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" | 31 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
| 32 #include "webrtc/transport.h" | 32 #include "webrtc/transport.h" |
| 33 #include "webrtc/typedefs.h" | 33 #include "webrtc/typedefs.h" |
| 34 | 34 |
| 35 namespace webrtc { | 35 namespace webrtc { |
| 36 | 36 |
| 37 class ModuleRtpRtcpImpl; | 37 class ModuleRtpRtcpImpl; |
| 38 class RTCPReceiver; | 38 class RTCPReceiver; |
| 39 class RtcEventLog; | 39 class RtcEventLog; |
| 40 | 40 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Determine which RTCP messages should be sent and setup flags. | 155 // Determine which RTCP messages should be sent and setup flags. |
| 156 void PrepareReport(const std::set<RTCPPacketType>& packetTypes, | 156 void PrepareReport(const std::set<RTCPPacketType>& packetTypes, |
| 157 const FeedbackState& feedback_state) | 157 const FeedbackState& feedback_state) |
| 158 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 158 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 159 | 159 |
| 160 bool AddReportBlock(const FeedbackState& feedback_state, | 160 bool AddReportBlock(const FeedbackState& feedback_state, |
| 161 uint32_t ssrc, | 161 uint32_t ssrc, |
| 162 StreamStatistician* statistician) | 162 StreamStatistician* statistician) |
| 163 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 163 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 164 | 164 |
| 165 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context) | 165 std::unique_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context) |
| 166 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 166 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 167 rtc::scoped_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context) | 167 std::unique_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context) |
| 168 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 168 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 169 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context) | 169 std::unique_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context) |
| 170 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 170 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 171 rtc::scoped_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context) | 171 std::unique_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context) |
| 172 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 172 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 173 rtc::scoped_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context) | 173 std::unique_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context) |
| 174 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 174 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 175 rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context) | 175 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context) |
| 176 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 176 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 177 rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context) | 177 std::unique_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context) |
| 178 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 178 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 179 rtc::scoped_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context) | 179 std::unique_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context) |
| 180 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 180 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 181 rtc::scoped_ptr<rtcp::RtcpPacket> BuildVoIPMetric(const RtcpContext& context) | 181 std::unique_ptr<rtcp::RtcpPacket> BuildVoIPMetric(const RtcpContext& context) |
| 182 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 182 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 183 rtc::scoped_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 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 185 rtc::scoped_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 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 187 rtc::scoped_ptr<rtcp::RtcpPacket> BuildSLI(const RtcpContext& context) | 187 std::unique_ptr<rtcp::RtcpPacket> BuildSLI(const RtcpContext& context) |
| 188 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 188 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 189 rtc::scoped_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context) | 189 std::unique_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context) |
| 190 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 190 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 191 rtc::scoped_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) | 191 std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) |
| 192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 193 rtc::scoped_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime( | 193 std::unique_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime( |
| 194 const RtcpContext& context) | 194 const RtcpContext& context) |
| 195 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 195 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 196 rtc::scoped_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context) | 196 std::unique_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context) |
| 197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 198 | 198 |
| 199 private: | 199 private: |
| 200 const bool audio_; | 200 const bool audio_; |
| 201 Clock* const clock_; | 201 Clock* const clock_; |
| 202 Random random_ GUARDED_BY(critical_section_rtcp_sender_); | 202 Random random_ GUARDED_BY(critical_section_rtcp_sender_); |
| 203 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); | 203 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); |
| 204 | 204 |
| 205 RtcEventLog* const event_log_; | 205 RtcEventLog* const event_log_; |
| 206 Transport* const transport_; | 206 Transport* const transport_; |
| 207 | 207 |
| 208 rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_; | 208 rtc::CriticalSection critical_section_rtcp_sender_; |
| 209 bool using_nack_ GUARDED_BY(critical_section_rtcp_sender_); | 209 bool using_nack_ GUARDED_BY(critical_section_rtcp_sender_); |
| 210 bool sending_ GUARDED_BY(critical_section_rtcp_sender_); | 210 bool sending_ GUARDED_BY(critical_section_rtcp_sender_); |
| 211 bool remb_enabled_ GUARDED_BY(critical_section_rtcp_sender_); | 211 bool remb_enabled_ GUARDED_BY(critical_section_rtcp_sender_); |
| 212 | 212 |
| 213 int64_t next_time_to_send_rtcp_ GUARDED_BY(critical_section_rtcp_sender_); | 213 int64_t next_time_to_send_rtcp_ GUARDED_BY(critical_section_rtcp_sender_); |
| 214 | 214 |
| 215 uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); | 215 uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
| 216 uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); | 216 uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
| 217 int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); | 217 int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); |
| 218 uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); | 218 uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 237 uint32_t remb_bitrate_ GUARDED_BY(critical_section_rtcp_sender_); | 237 uint32_t remb_bitrate_ GUARDED_BY(critical_section_rtcp_sender_); |
| 238 std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(critical_section_rtcp_sender_); | 238 std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(critical_section_rtcp_sender_); |
| 239 | 239 |
| 240 TMMBRHelp tmmbr_help_ GUARDED_BY(critical_section_rtcp_sender_); | 240 TMMBRHelp tmmbr_help_ GUARDED_BY(critical_section_rtcp_sender_); |
| 241 uint32_t tmmbr_send_ GUARDED_BY(critical_section_rtcp_sender_); | 241 uint32_t tmmbr_send_ GUARDED_BY(critical_section_rtcp_sender_); |
| 242 uint32_t packet_oh_send_ GUARDED_BY(critical_section_rtcp_sender_); | 242 uint32_t packet_oh_send_ GUARDED_BY(critical_section_rtcp_sender_); |
| 243 | 243 |
| 244 // APP | 244 // APP |
| 245 uint8_t app_sub_type_ GUARDED_BY(critical_section_rtcp_sender_); | 245 uint8_t app_sub_type_ GUARDED_BY(critical_section_rtcp_sender_); |
| 246 uint32_t app_name_ GUARDED_BY(critical_section_rtcp_sender_); | 246 uint32_t app_name_ GUARDED_BY(critical_section_rtcp_sender_); |
| 247 rtc::scoped_ptr<uint8_t[]> app_data_ | 247 std::unique_ptr<uint8_t[]> app_data_ |
| 248 GUARDED_BY(critical_section_rtcp_sender_); | 248 GUARDED_BY(critical_section_rtcp_sender_); |
| 249 uint16_t app_length_ GUARDED_BY(critical_section_rtcp_sender_); | 249 uint16_t app_length_ GUARDED_BY(critical_section_rtcp_sender_); |
| 250 | 250 |
| 251 // True if sending of XR Receiver reference time report is enabled. | 251 // True if sending of XR Receiver reference time report is enabled. |
| 252 bool xr_send_receiver_reference_time_enabled_ | 252 bool xr_send_receiver_reference_time_enabled_ |
| 253 GUARDED_BY(critical_section_rtcp_sender_); | 253 GUARDED_BY(critical_section_rtcp_sender_); |
| 254 | 254 |
| 255 // XR VoIP metric | 255 // XR VoIP metric |
| 256 RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_); | 256 RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_); |
| 257 | 257 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 275 ReportFlag(RTCPPacketType type, bool is_volatile) | 275 ReportFlag(RTCPPacketType type, bool is_volatile) |
| 276 : type(type), is_volatile(is_volatile) {} | 276 : type(type), is_volatile(is_volatile) {} |
| 277 bool operator<(const ReportFlag& flag) const { return type < flag.type; } | 277 bool operator<(const ReportFlag& flag) const { return type < flag.type; } |
| 278 bool operator==(const ReportFlag& flag) const { return type == flag.type; } | 278 bool operator==(const ReportFlag& flag) const { return type == flag.type; } |
| 279 const RTCPPacketType type; | 279 const RTCPPacketType type; |
| 280 const bool is_volatile; | 280 const bool is_volatile; |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); | 283 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); |
| 284 | 284 |
| 285 typedef rtc::scoped_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( | 285 typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( |
| 286 const RtcpContext&); | 286 const RtcpContext&); |
| 287 std::map<RTCPPacketType, BuilderFunc> builders_; | 287 std::map<RTCPPacketType, BuilderFunc> builders_; |
| 288 | 288 |
| 289 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); | 289 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); |
| 290 }; | 290 }; |
| 291 } // namespace webrtc | 291 } // namespace webrtc |
| 292 | 292 |
| 293 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 293 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
| OLD | NEW |