Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver.h

Issue 2316093002: Replace rtcp packet parsing in the RtcpReceiver. (Closed)
Patch Set: Feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
23 #include "webrtc/typedefs.h" 23 #include "webrtc/typedefs.h"
24 24
25 namespace webrtc { 25 namespace webrtc {
26 namespace rtcp { 26 namespace rtcp {
27 class CommonHeader;
28 struct ReceiveTimeInfo;
29 class ReportBlock;
30 class Rrtr;
27 class TmmbItem; 31 class TmmbItem;
28 } // namespace rtcp 32 } // namespace rtcp
29 33
30 class RTCPReceiver { 34 class RTCPReceiver {
31 public: 35 public:
32 class ModuleRtpRtcp { 36 class ModuleRtpRtcp {
33 public: 37 public:
34 virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0; 38 virtual void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) = 0;
35 virtual void OnRequestSendReport() = 0; 39 virtual void OnRequestSendReport() = 0;
36 virtual void OnReceivedNack( 40 virtual void OnReceivedNack(
37 const std::vector<uint16_t>& nack_sequence_numbers) = 0; 41 const std::vector<uint16_t>& nack_sequence_numbers) = 0;
38 virtual void OnReceivedRtcpReportBlocks( 42 virtual void OnReceivedRtcpReportBlocks(
39 const ReportBlockList& report_blocks) = 0; 43 const ReportBlockList& report_blocks) = 0;
40 44
41 protected: 45 protected:
42 virtual ~ModuleRtpRtcp() = default; 46 virtual ~ModuleRtpRtcp() = default;
43 }; 47 };
44 48
45 RTCPReceiver(Clock* clock, 49 RTCPReceiver(Clock* clock,
46 bool receiver_only, 50 bool receiver_only,
47 RtcpPacketTypeCounterObserver* packet_type_counter_observer, 51 RtcpPacketTypeCounterObserver* packet_type_counter_observer,
48 RtcpBandwidthObserver* rtcp_bandwidth_observer, 52 RtcpBandwidthObserver* rtcp_bandwidth_observer,
49 RtcpIntraFrameObserver* rtcp_intra_frame_observer, 53 RtcpIntraFrameObserver* rtcp_intra_frame_observer,
50 TransportFeedbackObserver* transport_feedback_observer, 54 TransportFeedbackObserver* transport_feedback_observer,
51 ModuleRtpRtcp* owner); 55 ModuleRtpRtcp* owner);
52 virtual ~RTCPReceiver(); 56 virtual ~RTCPReceiver();
53 57
54 bool IncomingPacket(const uint8_t* packet, size_t packet_size); 58 bool IncomingPacket(const uint8_t* packet, size_t packet_size);
55 59
56 int64_t LastReceived();
57 int64_t LastReceivedReceiverReport() const; 60 int64_t LastReceivedReceiverReport() const;
58 61
59 void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs); 62 void SetSsrcs(uint32_t main_ssrc, const std::set<uint32_t>& registered_ssrcs);
60 void SetRemoteSSRC(uint32_t ssrc); 63 void SetRemoteSSRC(uint32_t ssrc);
61 uint32_t RemoteSSRC() const; 64 uint32_t RemoteSSRC() const;
62 65
63 // get received cname 66 // get received cname
64 int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const; 67 int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const;
65 68
66 // get received NTP 69 // get received NTP
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 RtcpStatisticsCallback* GetRtcpStatisticsCallback(); 112 RtcpStatisticsCallback* GetRtcpStatisticsCallback();
110 113
111 private: 114 private:
112 using ReceivedInfoMap = std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*>; 115 using ReceivedInfoMap = std::map<uint32_t, RTCPHelp::RTCPReceiveInformation*>;
113 // RTCP report block information mapped by remote SSRC. 116 // RTCP report block information mapped by remote SSRC.
114 using ReportBlockInfoMap = 117 using ReportBlockInfoMap =
115 std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>; 118 std::map<uint32_t, RTCPHelp::RTCPReportBlockInformation*>;
116 // RTCP report block information map mapped by source SSRC. 119 // RTCP report block information map mapped by source SSRC.
117 using ReportBlockMap = std::map<uint32_t, ReportBlockInfoMap>; 120 using ReportBlockMap = std::map<uint32_t, ReportBlockInfoMap>;
118 121
119 int32_t IncomingRTCPPacket( 122 bool ParseCompoundPacket(const uint8_t* packet_begin,
120 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, 123 const uint8_t* packet_end,
121 RTCPUtility::RTCPParserV2* rtcpParser); 124 RTCPHelp::RTCPPacketInformation* packet_information);
122 125
123 void TriggerCallbacksFromRTCPPacket( 126 void TriggerCallbacksFromRTCPPacket(
124 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); 127 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
125 128
126 RTCPUtility::RTCPCnameInformation* CreateCnameInformation( 129 RTCPUtility::RTCPCnameInformation* CreateCnameInformation(
127 uint32_t remoteSSRC); 130 uint32_t remoteSSRC);
128 RTCPUtility::RTCPCnameInformation* GetCnameInformation( 131 RTCPUtility::RTCPCnameInformation* GetCnameInformation(
129 uint32_t remoteSSRC) const; 132 uint32_t remoteSSRC) const;
130 133
131 RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation( 134 RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(
132 uint32_t remoteSSRC); 135 uint32_t remoteSSRC);
133 RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC); 136 RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC);
134 137
135 void HandleSenderReport( 138 void HandleSenderReport(
136 RTCPUtility::RTCPParserV2& rtcpParser, 139 const rtcp::CommonHeader& rtcp_block,
137 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 140 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
138 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 141 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
139 142
140 void HandleReceiverReport( 143 void HandleReceiverReport(
141 RTCPUtility::RTCPParserV2& rtcpParser, 144 const rtcp::CommonHeader& rtcp_block,
142 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 145 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
143 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 146 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
144 147
145 void HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket, 148 void HandleReportBlock(const rtcp::ReportBlock& report_block,
146 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, 149 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
147 uint32_t remoteSSRC) 150 uint32_t remoteSSRC)
148 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 151 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
149 152
150 void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser, 153 void HandleSDES(const rtcp::CommonHeader& rtcp_block,
151 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 154 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
152 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 155 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
153 156
154 void HandleXrHeader(RTCPUtility::RTCPParserV2& parser, 157 void HandleXr(const rtcp::CommonHeader& rtcp_block,
155 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 158 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
156 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 159 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
157 160
158 void HandleXrReceiveReferenceTime( 161 void HandleXrReceiveReferenceTime(
159 RTCPUtility::RTCPParserV2& parser, 162 const rtcp::Rrtr& rrtr,
160 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 163 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
161 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 164 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
162 165
163 void HandleXrDlrrReportBlock( 166 void HandleXrDlrrReportBlock(
164 RTCPUtility::RTCPParserV2& parser, 167 const rtcp::ReceiveTimeInfo& rti,
165 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 168 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
166 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 169 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
167 170
168 void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser, 171 void HandleNACK(const rtcp::CommonHeader& rtcp_block,
169 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 172 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
170 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 173 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
171 174
172 void HandleBYE(RTCPUtility::RTCPParserV2& rtcpParser) 175 void HandleBYE(const rtcp::CommonHeader& rtcp_block)
173 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 176 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
174 177
175 void HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser, 178 void HandlePLI(const rtcp::CommonHeader& rtcp_block,
176 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 179 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
177 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 180 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
178 181
179 void HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser, 182 void HandleSLI(const rtcp::CommonHeader& rtcp_block,
180 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 183 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
181 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 184 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
182 185
183 void HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser, 186 void HandleRPSI(const rtcp::CommonHeader& rtcp_block,
184 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 187 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
185 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 188 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
186 189
187 void HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser, 190 void HandlePsfbApp(const rtcp::CommonHeader& rtcp_block,
188 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 191 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
189 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 192 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
190 193
191 void HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser, 194 void HandleTMMBR(const rtcp::CommonHeader& rtcp_block,
192 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 195 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
193 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 196 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
194 197
195 void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, 198 void HandleTMMBN(const rtcp::CommonHeader& rtcp_block,
196 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 199 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
197 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 200 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
198 201
199 void HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser, 202 void HandleSR_REQ(const rtcp::CommonHeader& rtcp_block,
200 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 203 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
201 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 204 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
202 205
203 void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser, 206 void HandleFIR(const rtcp::CommonHeader& rtcp_block,
204 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) 207 RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
205 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 208 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
206 209
207 void HandleTransportFeedback( 210 void HandleTransportFeedback(
208 RTCPUtility::RTCPParserV2* rtcp_parser, 211 const rtcp::CommonHeader& rtcp_block,
209 RTCPHelp::RTCPPacketInformation* rtcp_packet_information) 212 RTCPHelp::RTCPPacketInformation* rtcp_packet_information)
210 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 213 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
211 214
212 RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation( 215 RTCPHelp::RTCPReportBlockInformation* CreateOrGetReportBlockInformation(
213 uint32_t remote_ssrc, 216 uint32_t remote_ssrc,
214 uint32_t source_ssrc) 217 uint32_t source_ssrc)
215 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 218 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
216 RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation( 219 RTCPHelp::RTCPReportBlockInformation* GetReportBlockInformation(
217 uint32_t remote_ssrc, 220 uint32_t remote_ssrc,
218 uint32_t source_ssrc) const 221 uint32_t source_ssrc) const
219 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver); 222 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
220 223
221 Clock* const _clock; 224 Clock* const _clock;
222 const bool receiver_only_; 225 const bool receiver_only_;
223 int64_t _lastReceived;
224 ModuleRtpRtcp& _rtpRtcp; 226 ModuleRtpRtcp& _rtpRtcp;
225 227
226 rtc::CriticalSection _criticalSectionFeedbacks; 228 rtc::CriticalSection _criticalSectionFeedbacks;
227 RtcpBandwidthObserver* const _cbRtcpBandwidthObserver; 229 RtcpBandwidthObserver* const _cbRtcpBandwidthObserver;
228 RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver; 230 RtcpIntraFrameObserver* const _cbRtcpIntraFrameObserver;
229 TransportFeedbackObserver* const _cbTransportFeedbackObserver; 231 TransportFeedbackObserver* const _cbTransportFeedbackObserver;
230 232
231 rtc::CriticalSection _criticalSectionRTCPReceiver; 233 rtc::CriticalSection _criticalSectionRTCPReceiver;
232 uint32_t main_ssrc_ GUARDED_BY(_criticalSectionRTCPReceiver); 234 uint32_t main_ssrc_ GUARDED_BY(_criticalSectionRTCPReceiver);
233 uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPReceiver); 235 uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPReceiver);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; 268 RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
267 RtcpPacketTypeCounter packet_type_counter_; 269 RtcpPacketTypeCounter packet_type_counter_;
268 270
269 RTCPUtility::NackStats nack_stats_; 271 RTCPUtility::NackStats nack_stats_;
270 272
271 size_t num_skipped_packets_; 273 size_t num_skipped_packets_;
272 int64_t last_skipped_packets_warning_; 274 int64_t last_skipped_packets_warning_;
273 }; 275 };
274 } // namespace webrtc 276 } // namespace webrtc
275 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_ 277 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_RECEIVER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698