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 <memory> |
16 #include <set> | 16 #include <set> |
17 #include <sstream> | 17 #include <sstream> |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "webrtc/api/call/transport.h" | 21 #include "webrtc/api/call/transport.h" |
22 #include "webrtc/base/constructormagic.h" | 22 #include "webrtc/base/constructormagic.h" |
23 #include "webrtc/base/criticalsection.h" | 23 #include "webrtc/base/criticalsection.h" |
| 24 #include "webrtc/base/optional.h" |
24 #include "webrtc/base/random.h" | 25 #include "webrtc/base/random.h" |
25 #include "webrtc/base/thread_annotations.h" | 26 #include "webrtc/base/thread_annotations.h" |
26 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 27 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
27 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 28 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
28 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 29 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 uint16_t length); | 144 uint16_t length); |
144 int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); | 145 int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); |
145 | 146 |
146 void SendRtcpXrReceiverReferenceTime(bool enable); | 147 void SendRtcpXrReceiverReferenceTime(bool enable); |
147 | 148 |
148 bool RtcpXrReceiverReferenceTime() const; | 149 bool RtcpXrReceiverReferenceTime() const; |
149 | 150 |
150 void SetCsrcs(const std::vector<uint32_t>& csrcs); | 151 void SetCsrcs(const std::vector<uint32_t>& csrcs); |
151 | 152 |
152 void SetTargetBitrate(unsigned int target_bitrate); | 153 void SetTargetBitrate(unsigned int target_bitrate); |
| 154 void SetVideoBitrateAllocation(const BitrateAllocation& bitrate); |
153 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); | 155 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); |
154 | 156 |
155 private: | 157 private: |
156 class RtcpContext; | 158 class RtcpContext; |
157 | 159 |
158 // Determine which RTCP messages should be sent and setup flags. | 160 // Determine which RTCP messages should be sent and setup flags. |
159 void PrepareReport(const FeedbackState& feedback_state) | 161 void PrepareReport(const FeedbackState& feedback_state) |
160 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 162 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
161 | 163 |
162 bool AddReportBlock(const FeedbackState& feedback_state, | 164 bool AddReportBlock(const FeedbackState& feedback_state, |
(...skipping 27 matching lines...) Expand all Loading... |
190 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
191 std::unique_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context) | 193 std::unique_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context) |
192 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 194 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
193 std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) | 195 std::unique_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) |
194 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 196 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
195 std::unique_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime( | 197 std::unique_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime( |
196 const RtcpContext& context) | 198 const RtcpContext& context) |
197 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 199 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
198 std::unique_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context) | 200 std::unique_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context) |
199 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 201 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 202 std::unique_ptr<rtcp::RtcpPacket> BuildTargetBitrate( |
| 203 const RtcpContext& context) |
| 204 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
200 | 205 |
201 private: | 206 private: |
202 const bool audio_; | 207 const bool audio_; |
203 Clock* const clock_; | 208 Clock* const clock_; |
204 Random random_ GUARDED_BY(critical_section_rtcp_sender_); | 209 Random random_ GUARDED_BY(critical_section_rtcp_sender_); |
205 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); | 210 RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); |
206 | 211 |
207 RtcEventLog* const event_log_; | 212 RtcEventLog* const event_log_; |
208 Transport* const transport_; | 213 Transport* const transport_; |
209 | 214 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 263 |
259 // XR VoIP metric | 264 // XR VoIP metric |
260 RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_); | 265 RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_); |
261 | 266 |
262 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; | 267 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
263 RtcpPacketTypeCounter packet_type_counter_ | 268 RtcpPacketTypeCounter packet_type_counter_ |
264 GUARDED_BY(critical_section_rtcp_sender_); | 269 GUARDED_BY(critical_section_rtcp_sender_); |
265 | 270 |
266 RTCPUtility::NackStats nack_stats_ GUARDED_BY(critical_section_rtcp_sender_); | 271 RTCPUtility::NackStats nack_stats_ GUARDED_BY(critical_section_rtcp_sender_); |
267 | 272 |
| 273 rtc::Optional<BitrateAllocation> video_bitrate_allocation_ |
| 274 GUARDED_BY(critical_section_rtcp_sender_); |
| 275 |
268 void SetFlag(RTCPPacketType type, bool is_volatile) | 276 void SetFlag(RTCPPacketType type, bool is_volatile) |
269 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 277 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
270 void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile) | 278 void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile) |
271 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 279 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
272 bool IsFlagPresent(RTCPPacketType type) const | 280 bool IsFlagPresent(RTCPPacketType type) const |
273 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 281 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
274 bool ConsumeFlag(RTCPPacketType type, bool forced = false) | 282 bool ConsumeFlag(RTCPPacketType type, bool forced = false) |
275 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 283 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
276 bool AllVolatileFlagsConsumed() const | 284 bool AllVolatileFlagsConsumed() const |
277 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 285 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
(...skipping 10 matching lines...) Expand all Loading... |
288 | 296 |
289 typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( | 297 typedef std::unique_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( |
290 const RtcpContext&); | 298 const RtcpContext&); |
291 std::map<RTCPPacketType, BuilderFunc> builders_; | 299 std::map<RTCPPacketType, BuilderFunc> builders_; |
292 | 300 |
293 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); | 301 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); |
294 }; | 302 }; |
295 } // namespace webrtc | 303 } // namespace webrtc |
296 | 304 |
297 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 305 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
OLD | NEW |