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

Side by Side Diff: webrtc/modules/rtp_rtcp/include/rtp_rtcp.h

Issue 2067673004: Style cleanups in RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 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_INCLUDE_RTP_RTCP_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
13 13
14 #include <set> 14 #include <set>
15 #include <string> 15 #include <string>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/base/constructormagic.h" 19 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/modules/include/module.h" 20 #include "webrtc/modules/include/module.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/video_coding/include/video_coding_defines.h" 22 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
23 23
24 namespace webrtc { 24 namespace webrtc {
25
25 // Forward declarations. 26 // Forward declarations.
26 class RateLimiter; 27 class RateLimiter;
27 class ReceiveStatistics; 28 class ReceiveStatistics;
28 class RemoteBitrateEstimator; 29 class RemoteBitrateEstimator;
29 class RtcEventLog; 30 class RtcEventLog;
30 class RtpReceiver; 31 class RtpReceiver;
31 class Transport; 32 class Transport;
32 33
33 RTPExtensionType StringToRtpExtensionType(const std::string& extension); 34 RTPExtensionType StringToRtpExtensionType(const std::string& extension);
34 35
35 namespace rtcp { 36 namespace rtcp {
36 class TransportFeedback; 37 class TransportFeedback;
37 } 38 }
38 39
39 class RtpRtcp : public Module { 40 class RtpRtcp : public Module {
40 public: 41 public:
41 struct Configuration { 42 struct Configuration {
42 Configuration(); 43 Configuration();
43 44
44 /* id - Unique identifier of this RTP/RTCP module object 45 // True for a audio version of the RTP/RTCP module object false will create
45 * audio - True for a audio version of the RTP/RTCP module 46 // a video version.
46 * object false will create a video version 47 bool audio = false;
47 * clock - The clock to use to read time. If NULL object 48 bool receiver_only = false;
48 * will be using the system clock. 49
49 * incoming_data - Callback object that will receive the incoming 50 // The clock to use to read time. If nullptr then system clock will be used.
50 * data. May not be NULL; default callback will do 51 Clock* clock = nullptr;
51 * nothing. 52
52 * incoming_messages - Callback object that will receive the incoming
53 * RTP messages. May not be NULL; default callback
54 * will do nothing.
55 * outgoing_transport - Transport object that will be called when packets
56 * are ready to be sent out on the network
57 * intra_frame_callback - Called when the receiver request a intra frame.
58 * bandwidth_callback - Called when we receive a changed estimate from
59 * the receiver of out stream.
60 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
61 * streams from the same client.
62 * paced_sender - Spread any bursts of packets into smaller
63 * bursts to minimize packet loss.
64 */
65 bool audio;
66 bool receiver_only;
67 Clock* clock;
68 ReceiveStatistics* receive_statistics; 53 ReceiveStatistics* receive_statistics;
69 Transport* outgoing_transport; 54
70 RtcpIntraFrameObserver* intra_frame_callback; 55 // Transport object that will be called when packets are ready to be sent
71 RtcpBandwidthObserver* bandwidth_callback; 56 // out on the network.
72 TransportFeedbackObserver* transport_feedback_callback; 57 Transport* outgoing_transport = nullptr;
73 RtcpRttStats* rtt_stats; 58
74 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer; 59 // Called when the receiver request a intra frame.
75 RemoteBitrateEstimator* remote_bitrate_estimator; 60 RtcpIntraFrameObserver* intra_frame_callback = nullptr;
76 RtpPacketSender* paced_sender; 61
77 TransportSequenceNumberAllocator* transport_sequence_number_allocator; 62 // Called when we receive a changed estimate from the receiver of out
78 BitrateStatisticsObserver* send_bitrate_observer; 63 // stream.
79 FrameCountObserver* send_frame_count_observer; 64 RtcpBandwidthObserver* bandwidth_callback = nullptr;
80 SendSideDelayObserver* send_side_delay_observer; 65
81 RtcEventLog* event_log; 66 TransportFeedbackObserver* transport_feedback_callback = nullptr;
82 SendPacketObserver* send_packet_observer; 67 RtcpRttStats* rtt_stats = nullptr;
83 RateLimiter* retransmission_rate_limiter; 68 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer = nullptr;
69
70 // Estimates the bandwidth available for a set of streams from the same
71 // client.
72 RemoteBitrateEstimator* remote_bitrate_estimator = nullptr;
73
74 // Spread any bursts of packets into smaller bursts to minimize packet loss.
75 RtpPacketSender* paced_sender = nullptr;
76
77 TransportSequenceNumberAllocator* transport_sequence_number_allocator =
78 nullptr;
79 BitrateStatisticsObserver* send_bitrate_observer = nullptr;
80 FrameCountObserver* send_frame_count_observer = nullptr;
81 SendSideDelayObserver* send_side_delay_observer = nullptr;
82 RtcEventLog* event_log = nullptr;
83 SendPacketObserver* send_packet_observer = nullptr;
84 RateLimiter* retransmission_rate_limiter = nullptr;
85
86 private:
84 RTC_DISALLOW_COPY_AND_ASSIGN(Configuration); 87 RTC_DISALLOW_COPY_AND_ASSIGN(Configuration);
85 }; 88 };
86 89
87 /* 90 // Create a RTP/RTCP module object using the system clock.
88 * Create a RTP/RTCP module object using the system clock. 91 // |configuration| - Configuration of the RTP/RTCP module.
89 *
90 * configuration - Configuration of the RTP/RTCP module.
91 */
92 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration); 92 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
93 93
94 /************************************************************************** 94 // **************************************************************************
95 * 95 // Receiver functions
96 * Receiver functions 96 // **************************************************************************
97 * 97
98 ***************************************************************************/ 98 virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet,
99 99 size_t incoming_packet_length) = 0;
100 virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet, 100
101 size_t incoming_packet_length) = 0; 101 virtual void SetRemoteSSRC(uint32_t ssrc) = 0;
102 102
103 virtual void SetRemoteSSRC(uint32_t ssrc) = 0; 103 // **************************************************************************
104 104 // Sender
105 /************************************************************************** 105 // **************************************************************************
106 * 106
107 * Sender 107 // Sets MTU.
108 * 108 // |size| - Max transfer unit in bytes, default is 1500.
109 ***************************************************************************/ 109 // Returns -1 on failure else 0.
110 110 virtual int32_t SetMaxTransferUnit(uint16_t size) = 0;
111 /* 111
112 * set MTU 112 // Sets transtport overhead. Default is IPv4 and UDP with no encryption.
113 * 113 // |tcp| - true for TCP false UDP.
114 * size - Max transfer unit in bytes, default is 1500 114 // |ipv6| - true for IP version 6 false for version 4.
115 * 115 // |authentication_overhead| - number of bytes to leave for an authentication
116 * return -1 on failure else 0 116 // header.
117 */ 117 // Returns -1 on failure else 0
118 virtual int32_t SetMaxTransferUnit(uint16_t size) = 0; 118 virtual int32_t SetTransportOverhead(bool tcp,
119 119 bool ipv6,
120 /* 120 uint8_t authentication_overhead = 0) = 0;
121 * set transtport overhead 121
122 * default is IPv4 and UDP with no encryption 122 // Returns max payload length, which is a combination of the configuration
123 * 123 // MaxTransferUnit and TransportOverhead.
124 * TCP - true for TCP false UDP 124 // Does not account for RTP headers and FEC/ULP/RED overhead (when FEC is
125 * IPv6 - true for IP version 6 false for version 4 125 // enabled).
126 * authenticationOverhead - number of bytes to leave for an 126 virtual uint16_t MaxPayloadLength() const = 0;
127 * authentication header 127
128 * 128 // Returns max data payload length, which is a combination of the
129 * return -1 on failure else 0 129 // configuration MaxTransferUnit, headers and TransportOverhead.
130 */ 130 // Takes into account RTP headers and FEC/ULP/RED overhead (when FEC is
131 virtual int32_t SetTransportOverhead( 131 // enabled).
132 bool TCP, 132 virtual uint16_t MaxDataPayloadLength() const = 0;
133 bool IPV6, 133
134 uint8_t authenticationOverhead = 0) = 0; 134 // Sets codec name and payload type. Returns -1 on failure else 0.
135 135 virtual int32_t RegisterSendPayload(const CodecInst& voice_codec) = 0;
136 /* 136
137 * Get max payload length 137 // Sets codec name and payload type. Return -1 on failure else 0.
138 * 138 virtual int32_t RegisterSendPayload(const VideoCodec& video_codec) = 0;
139 * A combination of the configuration MaxTransferUnit and 139
140 * TransportOverhead. 140 virtual void RegisterVideoSendPayload(int payload_type,
141 * Does not account FEC/ULP/RED overhead if FEC is enabled. 141 const char* payload_name) = 0;
142 * Does not account for RTP headers 142
143 */ 143 // Unregisters a send payload.
144 virtual uint16_t MaxPayloadLength() const = 0; 144 // |payload_type| - payload type of codec
145 145 // Returns -1 on failure else 0.
146 /* 146 virtual int32_t DeRegisterSendPayload(int8_t payload_type) = 0;
147 * Get max data payload length 147
148 * 148 // (De)registers RTP header extension type and id.
149 * A combination of the configuration MaxTransferUnit, headers and 149 // Returns -1 on failure else 0.
150 * TransportOverhead. 150 virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type,
151 * Takes into account FEC/ULP/RED overhead if FEC is enabled. 151 uint8_t id) = 0;
152 * Takes into account RTP headers 152
153 */ 153 virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0;
154 virtual uint16_t MaxDataPayloadLength() const = 0; 154
155 155 // Returns start timestamp.
156 /* 156 virtual uint32_t StartTimestamp() const = 0;
157 * set codec name and payload type 157
158 * 158 // Sets start timestamp. Start timestamp is set to a random value if this
159 * return -1 on failure else 0 159 // function is never called.
160 */ 160 virtual void SetStartTimestamp(uint32_t timestamp) = 0;
161 virtual int32_t RegisterSendPayload( 161
162 const CodecInst& voiceCodec) = 0; 162 // Returns SequenceNumber.
163 163 virtual uint16_t SequenceNumber() const = 0;
164 /* 164
165 * set codec name and payload type 165 // Sets SequenceNumber, default is a random number.
166 * 166 virtual void SetSequenceNumber(uint16_t seq) = 0;
167 * return -1 on failure else 0 167
168 */ 168 virtual void SetRtpState(const RtpState& rtp_state) = 0;
169 virtual int32_t RegisterSendPayload( 169 virtual void SetRtxState(const RtpState& rtp_state) = 0;
170 const VideoCodec& videoCodec) = 0; 170 virtual RtpState GetRtpState() const = 0;
171 171 virtual RtpState GetRtxState() const = 0;
172 virtual void RegisterVideoSendPayload(int payload_type, 172
173 const char* payload_name) = 0; 173 // Returns SSRC.
174 174 virtual uint32_t SSRC() const = 0;
175 /* 175
176 * Unregister a send payload 176 // Sets SSRC, default is a random number.
177 * 177 virtual void SetSSRC(uint32_t ssrc) = 0;
178 * payloadType - payload type of codec 178
179 * 179 // Sets CSRC.
180 * return -1 on failure else 0 180 // |csrcs| - vector of CSRCs
181 */ 181 virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) = 0;
182 virtual int32_t DeRegisterSendPayload(int8_t payloadType) = 0; 182
183 183 // Turns on/off sending RTX (RFC 4588). The modes can be set as a combination
184 /* 184 // of values of the enumerator RtxMode.
185 * (De)register RTP header extension type and id. 185 virtual void SetRtxSendStatus(int modes) = 0;
186 * 186
187 * return -1 on failure else 0 187 // Returns status of sending RTX (RFC 4588). The returned value can be
188 */ 188 // a combination of values of the enumerator RtxMode.
189 virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, 189 virtual int RtxSendStatus() const = 0;
190 uint8_t id) = 0; 190
191 191 // Sets the SSRC to use when sending RTX packets. This doesn't enable RTX,
192 virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0; 192 // only the SSRC is set.
193 193 virtual void SetRtxSsrc(uint32_t ssrc) = 0;
194 /* 194
195 * get start timestamp 195 // Sets the payload type to use when sending RTX packets. Note that this
196 */ 196 // doesn't enable RTX, only the payload type is set.
197 virtual uint32_t StartTimestamp() const = 0; 197 virtual void SetRtxSendPayloadType(int payload_type,
198 198 int associated_payload_type) = 0;
199 /* 199
200 * configure start timestamp, default is a random number 200 // Sets sending status. Sends kRtcpByeCode when going from true to false.
201 * 201 // Returns -1 on failure else 0.
202 * timestamp - start timestamp 202 virtual int32_t SetSendingStatus(bool sending) = 0;
203 */ 203
204 virtual void SetStartTimestamp(uint32_t timestamp) = 0; 204 // Returns current sending status.
205 205 virtual bool Sending() const = 0;
206 /* 206
207 * Get SequenceNumber 207 // Starts/Stops media packets. On by default.
208 */ 208 virtual void SetSendingMediaStatus(bool sending) = 0;
209 virtual uint16_t SequenceNumber() const = 0; 209
210 210 // Returns current media sending status.
211 /* 211 virtual bool SendingMedia() const = 0;
212 * Set SequenceNumber, default is a random number 212
213 */ 213 // Returns current bitrate in Kbit/s.
214 virtual void SetSequenceNumber(uint16_t seq) = 0; 214 virtual void BitrateSent(uint32_t* total_rate,
215 215 uint32_t* video_rate,
216 virtual void SetRtpState(const RtpState& rtp_state) = 0; 216 uint32_t* fec_rate,
217 virtual void SetRtxState(const RtpState& rtp_state) = 0; 217 uint32_t* nack_rate) const = 0;
218 virtual RtpState GetRtpState() const = 0; 218
219 virtual RtpState GetRtxState() const = 0; 219 // Used by the codec module to deliver a video or audio frame for
220 220 // packetization.
221 /* 221 // |frame_type| - type of frame to send
222 * Get SSRC 222 // |payload_type| - payload type of frame to send
223 */ 223 // |timestamp| - timestamp of frame to send
224 virtual uint32_t SSRC() const = 0; 224 // |payload_data| - payload buffer of frame to send
225 225 // |payload_size| - size of payload buffer to send
226 /* 226 // |fragmentation| - fragmentation offset data for fragmented frames such
227 * configure SSRC, default is a random number 227 // as layers or RED
228 */ 228 // Returns -1 on failure else 0.
229 virtual void SetSSRC(uint32_t ssrc) = 0; 229 virtual int32_t SendOutgoingData(
230 230 FrameType frame_type,
231 /* 231 int8_t payload_type,
232 * Set CSRC 232 uint32_t timestamp,
233 * 233 int64_t capture_time_ms,
234 * csrcs - vector of CSRCs 234 const uint8_t* payload_data,
235 */ 235 size_t payload_size,
236 virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) = 0; 236 const RTPFragmentationHeader* fragmentation = nullptr,
237 237 const RTPVideoHeader* rtp_video_header = nullptr) = 0;
238 /* 238
239 * Turn on/off sending RTX (RFC 4588). The modes can be set as a combination 239 virtual bool TimeToSendPacket(uint32_t ssrc,
240 * of values of the enumerator RtxMode. 240 uint16_t sequence_number,
241 */ 241 int64_t capture_time_ms,
242 virtual void SetRtxSendStatus(int modes) = 0; 242 bool retransmission,
243 243 int probe_cluster_id) = 0;
244 /* 244
245 * Get status of sending RTX (RFC 4588). The returned value can be 245 virtual size_t TimeToSendPadding(size_t bytes, int probe_cluster_id) = 0;
246 * a combination of values of the enumerator RtxMode. 246
247 */ 247 // Called on generation of new statistics after an RTP send.
248 virtual int RtxSendStatus() const = 0; 248 virtual void RegisterSendChannelRtpStatisticsCallback(
249 249 StreamDataCountersCallback* callback) = 0;
250 // Sets the SSRC to use when sending RTX packets. This doesn't enable RTX, 250 virtual StreamDataCountersCallback* GetSendChannelRtpStatisticsCallback()
251 // only the SSRC is set. 251 const = 0;
252 virtual void SetRtxSsrc(uint32_t ssrc) = 0; 252
253 253 // **************************************************************************
254 // Sets the payload type to use when sending RTX packets. Note that this 254 // RTCP
255 // doesn't enable RTX, only the payload type is set. 255 // **************************************************************************
256 virtual void SetRtxSendPayloadType(int payload_type, 256
257 int associated_payload_type) = 0; 257 // Returns RTCP status.
258 258 virtual RtcpMode RTCP() const = 0;
259 /* 259
260 * sends kRtcpByeCode when going from true to false 260 // Sets RTCP status i.e on(compound or non-compound)/off.
261 * 261 // |method| - RTCP method to use.
262 * sending - on/off 262 virtual void SetRTCPStatus(RtcpMode method) = 0;
263 * 263
264 * return -1 on failure else 0 264 // Sets RTCP CName (i.e unique identifier).
265 */ 265 // Returns -1 on failure else 0.
266 virtual int32_t SetSendingStatus(bool sending) = 0; 266 virtual int32_t SetCNAME(const char* cname) = 0;
267 267
268 /* 268 // Returns remote CName.
269 * get send status 269 // Returns -1 on failure else 0.
270 */ 270 virtual int32_t RemoteCNAME(uint32_t remote_ssrc,
271 virtual bool Sending() const = 0; 271 char cname[RTCP_CNAME_SIZE]) const = 0;
272 272
273 /* 273 // Returns remote NTP.
274 * Starts/Stops media packets, on by default 274 // Returns -1 on failure else 0.
275 * 275 virtual int32_t RemoteNTP(uint32_t* received_ntp_secs,
276 * sending - on/off 276 uint32_t* received_ntp_frac,
277 */ 277 uint32_t* rtcp_arrival_time_secs,
278 virtual void SetSendingMediaStatus(bool sending) = 0; 278 uint32_t* rtcp_arrival_time_frac,
279 279 uint32_t* rtcp_timestamp) const = 0;
280 /* 280
281 * get send status 281 // Returns -1 on failure else 0.
282 */ 282 virtual int32_t AddMixedCNAME(uint32_t ssrc, const char* cname) = 0;
283 virtual bool SendingMedia() const = 0; 283
284 284 // Returns -1 on failure else 0.
285 /* 285 virtual int32_t RemoveMixedCNAME(uint32_t ssrc) = 0;
286 * get sent bitrate in Kbit/s 286
287 */ 287 // Returns current RTT (round-trip time) estimate.
288 virtual void BitrateSent(uint32_t* totalRate, 288 // Returns -1 on failure else 0.
289 uint32_t* videoRate, 289 virtual int32_t RTT(uint32_t remote_ssrc,
290 uint32_t* fecRate, 290 int64_t* rtt,
291 uint32_t* nackRate) const = 0; 291 int64_t* avg_rtt,
292 292 int64_t* min_rtt,
293 /* 293 int64_t* max_rtt) const = 0;
294 * Used by the codec module to deliver a video or audio frame for 294
295 * packetization. 295 // Forces a send of a RTCP packet. Periodic SR and RR are triggered via the
296 * 296 // process function.
297 * frameType - type of frame to send 297 // Returns -1 on failure else 0.
298 * payloadType - payload type of frame to send 298 virtual int32_t SendRTCP(RTCPPacketType rtcp_packet_type) = 0;
299 * timestamp - timestamp of frame to send 299
300 * payloadData - payload buffer of frame to send 300 // Forces a send of a RTCP packet with more than one packet type.
301 * payloadSize - size of payload buffer to send 301 // periodic SR and RR are triggered via the process function
302 * fragmentation - fragmentation offset data for fragmented frames such 302 // Returns -1 on failure else 0.
303 * as layers or RED 303 virtual int32_t SendCompoundRTCP(
304 * 304 const std::set<RTCPPacketType>& rtcp_packet_types) = 0;
305 * return -1 on failure else 0 305
306 */ 306 // Notifies the sender about good state of the RTP receiver.
307 virtual int32_t SendOutgoingData( 307 virtual int32_t SendRTCPReferencePictureSelection(uint64_t picture_id) = 0;
308 FrameType frameType, 308
309 int8_t payloadType, 309 // Send a RTCP Slice Loss Indication (SLI).
310 uint32_t timeStamp, 310 // |picture_id| - 6 least significant bits of picture_id.
311 int64_t capture_time_ms, 311 virtual int32_t SendRTCPSliceLossIndication(uint8_t picture_id) = 0;
312 const uint8_t* payloadData, 312
313 size_t payloadSize, 313 // Returns statistics of the amount of data sent.
314 const RTPFragmentationHeader* fragmentation = NULL, 314 // Returns -1 on failure else 0.
315 const RTPVideoHeader* rtpVideoHdr = NULL) = 0; 315 virtual int32_t DataCountersRTP(size_t* bytes_sent,
316 316 uint32_t* packets_sent) const = 0;
317 virtual bool TimeToSendPacket(uint32_t ssrc, 317
318 uint16_t sequence_number, 318 // Returns send statistics for the RTP and RTX stream.
319 int64_t capture_time_ms, 319 virtual void GetSendStreamDataCounters(
320 bool retransmission, 320 StreamDataCounters* rtp_counters,
321 int probe_cluster_id) = 0; 321 StreamDataCounters* rtx_counters) const = 0;
322 322
323 virtual size_t TimeToSendPadding(size_t bytes, int probe_cluster_id) = 0; 323 // Returns packet loss statistics for the RTP stream.
324 324 virtual void GetRtpPacketLossStats(
325 // Called on generation of new statistics after an RTP send. 325 bool outgoing,
326 virtual void RegisterSendChannelRtpStatisticsCallback( 326 uint32_t ssrc,
327 StreamDataCountersCallback* callback) = 0; 327 struct RtpPacketLossStats* loss_stats) const = 0;
328 virtual StreamDataCountersCallback* 328
329 GetSendChannelRtpStatisticsCallback() const = 0; 329 // Returns received RTCP sender info.
330 330 // Returns -1 on failure else 0.
331 /************************************************************************** 331 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* sender_info) = 0;
332 * 332
333 * RTCP 333 // Returns received RTCP report block.
334 * 334 // Returns -1 on failure else 0.
335 ***************************************************************************/ 335 virtual int32_t RemoteRTCPStat(
336 336 std::vector<RTCPReportBlock>* receive_blocks) const = 0;
337 /* 337
338 * Get RTCP status 338 // (APP) Sets application specific data.
339 */ 339 // Returns -1 on failure else 0.
340 virtual RtcpMode RTCP() const = 0; 340 virtual int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
341 341 uint32_t name,
342 /* 342 const uint8_t* data,
343 * configure RTCP status i.e on(compound or non- compound)/off 343 uint16_t length) = 0;
344 * 344 // (XR) Sets VOIP metric.
345 * method - RTCP method to use 345 // Returns -1 on failure else 0.
346 */ 346 virtual int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) = 0;
347 virtual void SetRTCPStatus(RtcpMode method) = 0; 347
348 348 // (XR) Sets Receiver Reference Time Report (RTTR) status.
349 /* 349 virtual void SetRtcpXrRrtrStatus(bool enable) = 0;
350 * Set RTCP CName (i.e unique identifier) 350
351 * 351 // Returns current Receiver Reference Time Report (RTTR) status.
352 * return -1 on failure else 0 352 virtual bool RtcpXrRrtrStatus() const = 0;
353 */ 353
354 virtual int32_t SetCNAME(const char* c_name) = 0; 354 // (REMB) Receiver Estimated Max Bitrate.
355 355 virtual bool REMB() const = 0;
356 /* 356
357 * Get remote CName 357 virtual void SetREMBStatus(bool enable) = 0;
358 * 358
359 * return -1 on failure else 0 359 virtual void SetREMBData(uint32_t bitrate,
360 */ 360 const std::vector<uint32_t>& ssrcs) = 0;
361 virtual int32_t RemoteCNAME(uint32_t remoteSSRC, 361
362 char cName[RTCP_CNAME_SIZE]) const = 0; 362 // (TMMBR) Temporary Max Media Bit Rate
363 363 virtual bool TMMBR() const = 0;
364 /* 364
365 * Get remote NTP 365 virtual void SetTMMBRStatus(bool enable) = 0;
366 * 366
367 * return -1 on failure else 0 367 // (NACK)
368 */ 368
369 virtual int32_t RemoteNTP( 369 // TODO(holmer): Propagate this API to VideoEngine.
370 uint32_t *ReceivedNTPsecs, 370 // Returns the currently configured selective retransmission settings.
371 uint32_t *ReceivedNTPfrac, 371 virtual int SelectiveRetransmissions() const = 0;
372 uint32_t *RTCPArrivalTimeSecs, 372
373 uint32_t *RTCPArrivalTimeFrac, 373 // TODO(holmer): Propagate this API to VideoEngine.
374 uint32_t *rtcp_timestamp) const = 0; 374 // Sets the selective retransmission settings, which will decide which
375 375 // packets will be retransmitted if NACKed. Settings are constructed by
376 /* 376 // combining the constants in enum RetransmissionMode with bitwise OR.
377 * AddMixedCNAME 377 // All packets are retransmitted if kRetransmitAllPackets is set, while no
378 * 378 // packets are retransmitted if kRetransmitOff is set.
379 * return -1 on failure else 0 379 // By default all packets except FEC packets are retransmitted. For VP8
380 */ 380 // with temporal scalability only base layer packets are retransmitted.
381 virtual int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name) = 0; 381 // Returns -1 on failure, otherwise 0.
382 382 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
383 /* 383
384 * RemoveMixedCNAME 384 // Sends a Negative acknowledgement packet.
385 * 385 // Returns -1 on failure else 0.
386 * return -1 on failure else 0 386 // TODO(philipel): Deprecate this and start using SendNack instead, mostly
387 */ 387 // because we want a function that actually send NACK for the specified
388 virtual int32_t RemoveMixedCNAME(uint32_t SSRC) = 0; 388 // packets.
389 389 virtual int32_t SendNACK(const uint16_t* nack_list, uint16_t size) = 0;
390 /* 390
391 * Get RoundTripTime 391 // Sends NACK for the packets specified.
392 * 392 // Note: This assumes the caller keeps track of timing and doesn't rely on
393 * return -1 on failure else 0 393 // the RTP module to do this.
394 */ 394 virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0;
395 virtual int32_t RTT(uint32_t remoteSSRC, 395
396 int64_t* RTT, 396 // Store the sent packets, needed to answer to a Negative acknowledgment
397 int64_t* avgRTT, 397 // requests.
398 int64_t* minRTT, 398 virtual void SetStorePacketsStatus(bool enable, uint16_t numberToStore) = 0;
399 int64_t* maxRTT) const = 0; 399
400 400 // Returns true if the module is configured to store packets.
401 /* 401 virtual bool StorePackets() const = 0;
402 * Force a send of a RTCP packet 402
403 * periodic SR and RR are triggered via the process function 403 // Called on receipt of RTCP report block from remote side.
404 * 404 virtual void RegisterRtcpStatisticsCallback(
405 * return -1 on failure else 0 405 RtcpStatisticsCallback* callback) = 0;
406 */ 406 virtual RtcpStatisticsCallback* GetRtcpStatisticsCallback() = 0;
407 virtual int32_t SendRTCP(RTCPPacketType rtcpPacketType) = 0; 407 // BWE feedback packets.
408 408 virtual bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) = 0;
409 /* 409
410 * Force a send of a RTCP packet with more than one packet type. 410 // **************************************************************************
411 * periodic SR and RR are triggered via the process function 411 // Audio
412 * 412 // **************************************************************************
413 * return -1 on failure else 0 413
414 */ 414 // Sets audio packet size, used to determine when it's time to send a DTMF
415 virtual int32_t SendCompoundRTCP( 415 // packet in silence (CNG).
416 const std::set<RTCPPacketType>& rtcpPacketTypes) = 0; 416 // Returns -1 on failure else 0.
417 417 virtual int32_t SetAudioPacketSize(uint16_t packet_size_samples) = 0;
418 /* 418
419 * Good state of RTP receiver inform sender 419 // Sends a TelephoneEvent tone using RFC 2833 (4733).
420 */ 420 // Returns -1 on failure else 0.
421 virtual int32_t SendRTCPReferencePictureSelection(uint64_t pictureID) = 0; 421 virtual int32_t SendTelephoneEventOutband(uint8_t key,
422 422 uint16_t time_ms,
423 /* 423 uint8_t level) = 0;
424 * Send a RTCP Slice Loss Indication (SLI) 424
425 * 6 least significant bits of pictureID 425 // Sets payload type for Redundant Audio Data RFC 2198.
426 */ 426 // Returns -1 on failure else 0.
427 virtual int32_t SendRTCPSliceLossIndication(uint8_t pictureID) = 0; 427 virtual int32_t SetSendREDPayloadType(int8_t payload_type) = 0;
428 428
429 /* 429 // Get payload type for Redundant Audio Data RFC 2198.
430 * Statistics of the amount of data sent 430 // Returns -1 on failure else 0.
431 * 431 virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0;
432 * return -1 on failure else 0 432
433 */ 433 // Store the audio level in dBov for header-extension-for-audio-level-
434 virtual int32_t DataCountersRTP( 434 // indication.
435 size_t* bytesSent, 435 // This API shall be called before transmision of an RTP packet to ensure
436 uint32_t* packetsSent) const = 0; 436 // that the |level| part of the extended RTP header is updated.
437 437 // return -1 on failure else 0.
438 /* 438 virtual int32_t SetAudioLevel(uint8_t level_dbov) = 0;
439 * Get send statistics for the RTP and RTX stream. 439
440 */ 440 // **************************************************************************
441 virtual void GetSendStreamDataCounters( 441 // Video
442 StreamDataCounters* rtp_counters, 442 // **************************************************************************
443 StreamDataCounters* rtx_counters) const = 0; 443
444 444 // Turn on/off generic FEC.
445 /* 445 virtual void SetGenericFECStatus(bool enable,
446 * Get packet loss statistics for the RTP stream. 446 uint8_t payload_type_red,
447 */ 447 uint8_t payload_type_fec) = 0;
448 virtual void GetRtpPacketLossStats( 448
449 bool outgoing, 449 // Get generic FEC setting.
450 uint32_t ssrc, 450 virtual void GenericFECStatus(bool* enable,
451 struct RtpPacketLossStats* loss_stats) const = 0; 451 uint8_t* payload_type_red,
452 452 uint8_t* payload_type_fec) = 0;
453 /* 453
454 * Get received RTCP sender info 454 virtual int32_t SetFecParameters(const FecProtectionParams* delta_params,
455 * 455 const FecProtectionParams* key_params) = 0;
456 * return -1 on failure else 0 456
457 */ 457 // Set method for requestion a new key frame.
458 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0; 458 // Returns -1 on failure else 0.
459 459 virtual int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) = 0;
460 /* 460
461 * Get received RTCP report block 461 // Sends a request for a keyframe.
462 * 462 // Returns -1 on failure else 0.
463 * return -1 on failure else 0 463 virtual int32_t RequestKeyFrame() = 0;
464 */
465 virtual int32_t RemoteRTCPStat(
466 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
467
468 /*
469 * (APP) Application specific data
470 *
471 * return -1 on failure else 0
472 */
473 virtual int32_t SetRTCPApplicationSpecificData(uint8_t subType,
474 uint32_t name,
475 const uint8_t* data,
476 uint16_t length) = 0;
477 /*
478 * (XR) VOIP metric
479 *
480 * return -1 on failure else 0
481 */
482 virtual int32_t SetRTCPVoIPMetrics(
483 const RTCPVoIPMetric* VoIPMetric) = 0;
484
485 /*
486 * (XR) Receiver Reference Time Report
487 */
488 virtual void SetRtcpXrRrtrStatus(bool enable) = 0;
489
490 virtual bool RtcpXrRrtrStatus() const = 0;
491
492 /*
493 * (REMB) Receiver Estimated Max Bitrate
494 */
495 virtual bool REMB() const = 0;
496
497 virtual void SetREMBStatus(bool enable) = 0;
498
499 virtual void SetREMBData(uint32_t bitrate,
500 const std::vector<uint32_t>& ssrcs) = 0;
501
502 /*
503 * (TMMBR) Temporary Max Media Bit Rate
504 */
505 virtual bool TMMBR() const = 0;
506
507 virtual void SetTMMBRStatus(bool enable) = 0;
508
509 /*
510 * (NACK)
511 */
512
513 /*
514 * TODO(holmer): Propagate this API to VideoEngine.
515 * Returns the currently configured selective retransmission settings.
516 */
517 virtual int SelectiveRetransmissions() const = 0;
518
519 /*
520 * TODO(holmer): Propagate this API to VideoEngine.
521 * Sets the selective retransmission settings, which will decide which
522 * packets will be retransmitted if NACKed. Settings are constructed by
523 * combining the constants in enum RetransmissionMode with bitwise OR.
524 * All packets are retransmitted if kRetransmitAllPackets is set, while no
525 * packets are retransmitted if kRetransmitOff is set.
526 * By default all packets except FEC packets are retransmitted. For VP8
527 * with temporal scalability only base layer packets are retransmitted.
528 *
529 * Returns -1 on failure, otherwise 0.
530 */
531 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
532
533 /*
534 * Send a Negative acknowledgement packet
535 *
536 * return -1 on failure else 0
537 */
538 // TODO(philipel): Deprecate this and start using SendNack instead,
539 // mostly because we want a function that actually send
540 // NACK for the specified packets.
541 virtual int32_t SendNACK(const uint16_t* nackList, uint16_t size) = 0;
542
543 /*
544 * Send NACK for the packets specified.
545 *
546 * Note: This assumes the caller keeps track of timing and doesn't rely on
547 * the RTP module to do this.
548 */
549 virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0;
550
551 /*
552 * Store the sent packets, needed to answer to a Negative acknowledgement
553 * requests
554 */
555 virtual void SetStorePacketsStatus(bool enable, uint16_t numberToStore) = 0;
556
557 // Returns true if the module is configured to store packets.
558 virtual bool StorePackets() const = 0;
559
560 // Called on receipt of RTCP report block from remote side.
561 virtual void RegisterRtcpStatisticsCallback(
562 RtcpStatisticsCallback* callback) = 0;
563 virtual RtcpStatisticsCallback*
564 GetRtcpStatisticsCallback() = 0;
565 // BWE feedback packets.
566 virtual bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) = 0;
567
568 /**************************************************************************
569 *
570 * Audio
571 *
572 ***************************************************************************/
573
574 /*
575 * set audio packet size, used to determine when it's time to send a DTMF
576 * packet in silence (CNG)
577 *
578 * return -1 on failure else 0
579 */
580 virtual int32_t SetAudioPacketSize(uint16_t packetSizeSamples) = 0;
581
582 /*
583 * Send a TelephoneEvent tone using RFC 2833 (4733)
584 *
585 * return -1 on failure else 0
586 */
587 virtual int32_t SendTelephoneEventOutband(uint8_t key,
588 uint16_t time_ms,
589 uint8_t level) = 0;
590
591 /*
592 * Set payload type for Redundant Audio Data RFC 2198
593 *
594 * return -1 on failure else 0
595 */
596 virtual int32_t SetSendREDPayloadType(int8_t payloadType) = 0;
597
598 /*
599 * Get payload type for Redundant Audio Data RFC 2198
600 *
601 * return -1 on failure else 0
602 */
603 virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0;
604 /*
605 * Store the audio level in dBov for header-extension-for-audio-level-
606 * indication.
607 * This API shall be called before transmision of an RTP packet to ensure
608 * that the |level| part of the extended RTP header is updated.
609 *
610 * return -1 on failure else 0.
611 */
612 virtual int32_t SetAudioLevel(uint8_t level_dBov) = 0;
613
614 /**************************************************************************
615 *
616 * Video
617 *
618 ***************************************************************************/
619
620 /*
621 * Turn on/off generic FEC
622 */
623 virtual void SetGenericFECStatus(bool enable,
624 uint8_t payload_type_red,
625 uint8_t payload_type_fec) = 0;
626
627 /*
628 * Get generic FEC setting
629 */
630 virtual void GenericFECStatus(bool* enable,
631 uint8_t* payload_type_red,
632 uint8_t* payload_type_fec) = 0;
633
634 virtual int32_t SetFecParameters(
635 const FecProtectionParams* delta_params,
636 const FecProtectionParams* key_params) = 0;
637
638 /*
639 * Set method for requestion a new key frame
640 *
641 * return -1 on failure else 0
642 */
643 virtual int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) = 0;
644
645 /*
646 * send a request for a keyframe
647 *
648 * return -1 on failure else 0
649 */
650 virtual int32_t RequestKeyFrame() = 0;
651 }; 464 };
465
652 } // namespace webrtc 466 } // namespace webrtc
467
653 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ 468 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h ('k') | webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698