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_RECEIVER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
24 #include "webrtc/system_wrappers/include/ntp_time.h" | 24 #include "webrtc/system_wrappers/include/ntp_time.h" |
25 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
| 28 class VideoBitrateAllocationObserver; |
28 namespace rtcp { | 29 namespace rtcp { |
29 class CommonHeader; | 30 class CommonHeader; |
30 class ReportBlock; | 31 class ReportBlock; |
31 class Rrtr; | 32 class Rrtr; |
| 33 class TargetBitrate; |
32 class TmmbItem; | 34 class TmmbItem; |
33 } // namespace rtcp | 35 } // namespace rtcp |
34 | 36 |
35 class RTCPReceiver { | 37 class RTCPReceiver { |
36 public: | 38 public: |
37 class ModuleRtpRtcp { | 39 class ModuleRtpRtcp { |
38 public: | 40 public: |
39 virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0; | 41 virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0; |
40 virtual void OnRequestSendReport() = 0; | 42 virtual void OnRequestSendReport() = 0; |
41 virtual void OnReceivedNack( | 43 virtual void OnReceivedNack( |
42 const std::vector<uint16_t>& nack_sequence_numbers) = 0; | 44 const std::vector<uint16_t>& nack_sequence_numbers) = 0; |
43 virtual void OnReceivedRtcpReportBlocks( | 45 virtual void OnReceivedRtcpReportBlocks( |
44 const ReportBlockList& report_blocks) = 0; | 46 const ReportBlockList& report_blocks) = 0; |
45 | 47 |
46 protected: | 48 protected: |
47 virtual ~ModuleRtpRtcp() = default; | 49 virtual ~ModuleRtpRtcp() = default; |
48 }; | 50 }; |
49 | 51 |
50 RTCPReceiver(Clock* clock, | 52 RTCPReceiver(Clock* clock, |
51 bool receiver_only, | 53 bool receiver_only, |
52 RtcpPacketTypeCounterObserver* packet_type_counter_observer, | 54 RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
53 RtcpBandwidthObserver* rtcp_bandwidth_observer, | 55 RtcpBandwidthObserver* rtcp_bandwidth_observer, |
54 RtcpIntraFrameObserver* rtcp_intra_frame_observer, | 56 RtcpIntraFrameObserver* rtcp_intra_frame_observer, |
55 TransportFeedbackObserver* transport_feedback_observer, | 57 TransportFeedbackObserver* transport_feedback_observer, |
| 58 VideoBitrateAllocationObserver* bitrate_allocation_observer, |
56 ModuleRtpRtcp* owner); | 59 ModuleRtpRtcp* owner); |
57 virtual ~RTCPReceiver(); | 60 virtual ~RTCPReceiver(); |
58 | 61 |
59 bool IncomingPacket(const uint8_t* packet, size_t packet_size); | 62 bool IncomingPacket(const uint8_t* packet, size_t packet_size); |
60 | 63 |
61 int64_t LastReceivedReceiverReport() const; | 64 int64_t LastReceivedReceiverReport() const; |
62 | 65 |
63 void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs); | 66 void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs); |
64 void SetRemoteSSRC(uint32_t ssrc); | 67 void SetRemoteSSRC(uint32_t ssrc); |
65 uint32_t RemoteSSRC() const; | 68 uint32_t RemoteSSRC() const; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 PacketInformation* packet_information) | 159 PacketInformation* packet_information) |
157 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 160 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
158 | 161 |
159 void HandleXrReceiveReferenceTime(uint32_t sender_ssrc, | 162 void HandleXrReceiveReferenceTime(uint32_t sender_ssrc, |
160 const rtcp::Rrtr& rrtr) | 163 const rtcp::Rrtr& rrtr) |
161 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 164 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
162 | 165 |
163 void HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) | 166 void HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) |
164 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 167 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
165 | 168 |
| 169 void HandleXrTargetBitrate(const rtcp::TargetBitrate& target_bitrate, |
| 170 PacketInformation* packet_information) |
| 171 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
| 172 |
166 void HandleNACK(const rtcp::CommonHeader& rtcp_block, | 173 void HandleNACK(const rtcp::CommonHeader& rtcp_block, |
167 PacketInformation* packet_information) | 174 PacketInformation* packet_information) |
168 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 175 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
169 | 176 |
170 void HandleBYE(const rtcp::CommonHeader& rtcp_block) | 177 void HandleBYE(const rtcp::CommonHeader& rtcp_block) |
171 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 178 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
172 | 179 |
173 void HandlePLI(const rtcp::CommonHeader& rtcp_block, | 180 void HandlePLI(const rtcp::CommonHeader& rtcp_block, |
174 PacketInformation* packet_information) | 181 PacketInformation* packet_information) |
175 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 182 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
(...skipping 27 matching lines...) Expand all Loading... |
203 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 210 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
204 | 211 |
205 void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block, | 212 void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block, |
206 PacketInformation* packet_information) | 213 PacketInformation* packet_information) |
207 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 214 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
208 | 215 |
209 Clock* const _clock; | 216 Clock* const _clock; |
210 const bool receiver_only_; | 217 const bool receiver_only_; |
211 ModuleRtpRtcp& _rtpRtcp; | 218 ModuleRtpRtcp& _rtpRtcp; |
212 | 219 |
213 rtc::CriticalSection _criticalSectionFeedbacks; | 220 rtc::CriticalSection feedbacks_lock_; |
214 RtcpBandwidthObserver* const _cbRtcpBandwidthObserver; | 221 RtcpBandwidthObserver* const rtcp_bandwidth_observer_; |
215 RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver; | 222 RtcpIntraFrameObserver* const rtcp_intra_frame_observer_; |
216 TransportFeedbackObserver* const _cbTransportFeedbackObserver; | 223 TransportFeedbackObserver* const transport_feedback_observer_; |
| 224 VideoBitrateAllocationObserver* const bitrate_allocation_observer_; |
217 | 225 |
218 rtc::CriticalSection _criticalSectionRTCPReceiver; | 226 rtc::CriticalSection _criticalSectionRTCPReceiver; |
219 uint32_t main_ssrc_ GUARDED_BY(_criticalSectionRTCPReceiver); | 227 uint32_t main_ssrc_ GUARDED_BY(_criticalSectionRTCPReceiver); |
220 uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPReceiver); | 228 uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPReceiver); |
221 std::set<uint32_t> registered_ssrcs_ GUARDED_BY(_criticalSectionRTCPReceiver); | 229 std::set<uint32_t> registered_ssrcs_ GUARDED_BY(_criticalSectionRTCPReceiver); |
222 | 230 |
223 // Received send report | 231 // Received send report |
224 RTCPSenderInfo _remoteSenderInfo; | 232 RTCPSenderInfo _remoteSenderInfo; |
225 // When did we receive the last send report. | 233 // When did we receive the last send report. |
226 NtpTime last_received_sr_ntp_; | 234 NtpTime last_received_sr_ntp_; |
(...skipping 13 matching lines...) Expand all Loading... |
240 std::map<uint32_t, std::string> received_cnames_ | 248 std::map<uint32_t, std::string> received_cnames_ |
241 GUARDED_BY(_criticalSectionRTCPReceiver); | 249 GUARDED_BY(_criticalSectionRTCPReceiver); |
242 | 250 |
243 // The last time we received an RTCP RR. | 251 // The last time we received an RTCP RR. |
244 int64_t _lastReceivedRrMs; | 252 int64_t _lastReceivedRrMs; |
245 | 253 |
246 // The time we last received an RTCP RR telling we have successfully | 254 // The time we last received an RTCP RR telling we have successfully |
247 // delivered RTP packet to the remote side. | 255 // delivered RTP packet to the remote side. |
248 int64_t _lastIncreasedSequenceNumberMs; | 256 int64_t _lastIncreasedSequenceNumberMs; |
249 | 257 |
250 RtcpStatisticsCallback* stats_callback_ GUARDED_BY(_criticalSectionFeedbacks); | 258 RtcpStatisticsCallback* stats_callback_ GUARDED_BY(feedbacks_lock_); |
251 | 259 |
252 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; | 260 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
253 RtcpPacketTypeCounter packet_type_counter_; | 261 RtcpPacketTypeCounter packet_type_counter_; |
254 | 262 |
255 RTCPUtility::NackStats nack_stats_; | 263 RTCPUtility::NackStats nack_stats_; |
256 | 264 |
257 size_t num_skipped_packets_; | 265 size_t num_skipped_packets_; |
258 int64_t last_skipped_packets_warning_; | 266 int64_t last_skipped_packets_warning_; |
259 }; | 267 }; |
260 } // namespace webrtc | 268 } // namespace webrtc |
261 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ | 269 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
OLD | NEW |