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_receiver_help.h" | |
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
25 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
26 | 25 |
27 namespace webrtc { | 26 namespace webrtc { |
28 namespace rtcp { | 27 namespace rtcp { |
29 class CommonHeader; | 28 class CommonHeader; |
30 class ReportBlock; | 29 class ReportBlock; |
31 class Rrtr; | 30 class Rrtr; |
32 class TmmbItem; | 31 class TmmbItem; |
33 } // namespace rtcp | 32 } // namespace rtcp |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 68 |
70 // get received NTP | 69 // get received NTP |
71 bool NTP(uint32_t* ReceivedNTPsecs, | 70 bool NTP(uint32_t* ReceivedNTPsecs, |
72 uint32_t* ReceivedNTPfrac, | 71 uint32_t* ReceivedNTPfrac, |
73 uint32_t* RTCPArrivalTimeSecs, | 72 uint32_t* RTCPArrivalTimeSecs, |
74 uint32_t* RTCPArrivalTimeFrac, | 73 uint32_t* RTCPArrivalTimeFrac, |
75 uint32_t* rtcp_timestamp) const; | 74 uint32_t* rtcp_timestamp) const; |
76 | 75 |
77 bool LastReceivedXrReferenceTimeInfo(rtcp::ReceiveTimeInfo* info) const; | 76 bool LastReceivedXrReferenceTimeInfo(rtcp::ReceiveTimeInfo* info) const; |
78 | 77 |
79 // get rtt | 78 // Get rtt. |
80 int32_t RTT(uint32_t remoteSSRC, | 79 int32_t RTT(uint32_t remote_ssrc, |
81 int64_t* RTT, | 80 int64_t* last_rtt_ms, |
82 int64_t* avgRTT, | 81 int64_t* avg_rtt_ms, |
83 int64_t* minRTT, | 82 int64_t* min_rtt_ms, |
84 int64_t* maxRTT) const; | 83 int64_t* max_rtt_ms) const; |
85 | 84 |
86 int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const; | 85 int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const; |
87 | 86 |
88 void SetRtcpXrRrtrStatus(bool enable); | 87 void SetRtcpXrRrtrStatus(bool enable); |
89 bool GetAndResetXrRrRtt(int64_t* rtt_ms); | 88 bool GetAndResetXrRrRtt(int64_t* rtt_ms); |
90 | 89 |
91 // get statistics | 90 // get statistics |
92 int32_t StatisticsReceived(std::vector<RTCPReportBlock>* receiveBlocks) const; | 91 int32_t StatisticsReceived(std::vector<RTCPReportBlock>* receiveBlocks) const; |
93 | 92 |
94 // Returns true if we haven't received an RTCP RR for several RTCP | 93 // Returns true if we haven't received an RTCP RR for several RTCP |
(...skipping 13 matching lines...) Expand all Loading... |
108 std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner); | 107 std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner); |
109 | 108 |
110 void UpdateTmmbr(); | 109 void UpdateTmmbr(); |
111 | 110 |
112 void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback); | 111 void RegisterRtcpStatisticsCallback(RtcpStatisticsCallback* callback); |
113 RtcpStatisticsCallback* GetRtcpStatisticsCallback(); | 112 RtcpStatisticsCallback* GetRtcpStatisticsCallback(); |
114 | 113 |
115 private: | 114 private: |
116 struct PacketInformation; | 115 struct PacketInformation; |
117 struct ReceiveInformation; | 116 struct ReceiveInformation; |
| 117 struct ReportBlockWithRtt; |
118 // Mapped by remote ssrc. | 118 // Mapped by remote ssrc. |
119 using ReceivedInfoMap = std::map<uint32_t, ReceiveInformation>; | 119 using ReceivedInfoMap = std::map<uint32_t, ReceiveInformation>; |
120 // RTCP report block information mapped by remote SSRC. | 120 // RTCP report blocks mapped by remote SSRC. |
121 using ReportBlockInfoMap = | 121 using ReportBlockInfoMap = std::map<uint32_t, ReportBlockWithRtt>; |
122 std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>; | 122 // RTCP report blocks map mapped by source SSRC. |
123 // RTCP report block information map mapped by source SSRC. | |
124 using ReportBlockMap = std::map<uint32_t, ReportBlockInfoMap>; | 123 using ReportBlockMap = std::map<uint32_t, ReportBlockInfoMap>; |
125 | 124 |
126 bool ParseCompoundPacket(const uint8_t* packet_begin, | 125 bool ParseCompoundPacket(const uint8_t* packet_begin, |
127 const uint8_t* packet_end, | 126 const uint8_t* packet_end, |
128 PacketInformation* packet_information); | 127 PacketInformation* packet_information); |
129 | 128 |
130 void TriggerCallbacksFromRTCPPacket( | 129 void TriggerCallbacksFromRTCPPacket( |
131 const PacketInformation& packet_information); | 130 const PacketInformation& packet_information); |
132 | 131 |
133 void CreateReceiveInformation(uint32_t remote_ssrc) | 132 void CreateReceiveInformation(uint32_t remote_ssrc) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 198 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
200 | 199 |
201 void HandleFIR(const rtcp::CommonHeader& rtcp_block, | 200 void HandleFIR(const rtcp::CommonHeader& rtcp_block, |
202 PacketInformation* packet_information) | 201 PacketInformation* packet_information) |
203 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 202 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
204 | 203 |
205 void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block, | 204 void HandleTransportFeedback(const rtcp::CommonHeader& rtcp_block, |
206 PacketInformation* packet_information) | 205 PacketInformation* packet_information) |
207 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | 206 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); |
208 | 207 |
209 RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation( | |
210 uint32_t remote_ssrc, | |
211 uint32_t source_ssrc) | |
212 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | |
213 RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation( | |
214 uint32_t remote_ssrc, | |
215 uint32_t source_ssrc) const | |
216 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); | |
217 | |
218 Clock* const _clock; | 208 Clock* const _clock; |
219 const bool receiver_only_; | 209 const bool receiver_only_; |
220 ModuleRtpRtcp& _rtpRtcp; | 210 ModuleRtpRtcp& _rtpRtcp; |
221 | 211 |
222 rtc::CriticalSection _criticalSectionFeedbacks; | 212 rtc::CriticalSection _criticalSectionFeedbacks; |
223 RtcpBandwidthObserver* const _cbRtcpBandwidthObserver; | 213 RtcpBandwidthObserver* const _cbRtcpBandwidthObserver; |
224 RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver; | 214 RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver; |
225 TransportFeedbackObserver* const _cbTransportFeedbackObserver; | 215 TransportFeedbackObserver* const _cbTransportFeedbackObserver; |
226 | 216 |
227 rtc::CriticalSection _criticalSectionRTCPReceiver; | 217 rtc::CriticalSection _criticalSectionRTCPReceiver; |
(...skipping 10 matching lines...) Expand all Loading... |
238 // Received XR receive time report. | 228 // Received XR receive time report. |
239 rtcp::ReceiveTimeInfo remote_time_info_; | 229 rtcp::ReceiveTimeInfo remote_time_info_; |
240 // Time when the report was received. | 230 // Time when the report was received. |
241 uint32_t _lastReceivedXRNTPsecs; | 231 uint32_t _lastReceivedXRNTPsecs; |
242 uint32_t _lastReceivedXRNTPfrac; | 232 uint32_t _lastReceivedXRNTPfrac; |
243 // Estimated rtt, zero when there is no valid estimate. | 233 // Estimated rtt, zero when there is no valid estimate. |
244 bool xr_rrtr_status_ GUARDED_BY(_criticalSectionRTCPReceiver); | 234 bool xr_rrtr_status_ GUARDED_BY(_criticalSectionRTCPReceiver); |
245 int64_t xr_rr_rtt_ms_; | 235 int64_t xr_rr_rtt_ms_; |
246 | 236 |
247 // Received report blocks. | 237 // Received report blocks. |
248 ReportBlockMap _receivedReportBlockMap | 238 ReportBlockMap received_report_blocks_ |
249 GUARDED_BY(_criticalSectionRTCPReceiver); | 239 GUARDED_BY(_criticalSectionRTCPReceiver); |
250 ReceivedInfoMap received_infos_ GUARDED_BY(_criticalSectionRTCPReceiver); | 240 ReceivedInfoMap received_infos_ GUARDED_BY(_criticalSectionRTCPReceiver); |
251 std::map<uint32_t, std::string> received_cnames_ | 241 std::map<uint32_t, std::string> received_cnames_ |
252 GUARDED_BY(_criticalSectionRTCPReceiver); | 242 GUARDED_BY(_criticalSectionRTCPReceiver); |
253 | 243 |
254 // The last time we received an RTCP RR. | 244 // The last time we received an RTCP RR. |
255 int64_t _lastReceivedRrMs; | 245 int64_t _lastReceivedRrMs; |
256 | 246 |
257 // The time we last received an RTCP RR telling we have successfully | 247 // The time we last received an RTCP RR telling we have successfully |
258 // delivered RTP packet to the remote side. | 248 // delivered RTP packet to the remote side. |
259 int64_t _lastIncreasedSequenceNumberMs; | 249 int64_t _lastIncreasedSequenceNumberMs; |
260 | 250 |
261 RtcpStatisticsCallback* stats_callback_ GUARDED_BY(_criticalSectionFeedbacks); | 251 RtcpStatisticsCallback* stats_callback_ GUARDED_BY(_criticalSectionFeedbacks); |
262 | 252 |
263 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; | 253 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
264 RtcpPacketTypeCounter packet_type_counter_; | 254 RtcpPacketTypeCounter packet_type_counter_; |
265 | 255 |
266 RTCPUtility::NackStats nack_stats_; | 256 RTCPUtility::NackStats nack_stats_; |
267 | 257 |
268 size_t num_skipped_packets_; | 258 size_t num_skipped_packets_; |
269 int64_t last_skipped_packets_warning_; | 259 int64_t last_skipped_packets_warning_; |
270 }; | 260 }; |
271 } // namespace webrtc | 261 } // namespace webrtc |
272 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ | 262 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ |
OLD | NEW |