blob: 9fb8199adecca20f92bef78db4983f7623f0f32d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_
12#define WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_
13
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +000014#include <vector>
15
turaj@webrtc.orgb7edd062013-03-12 22:27:27 +000016#include "webrtc/modules/interface/module.h"
17#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19namespace webrtc {
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000020// Forward declarations.
21class PacedSender;
wu@webrtc.org822fbd82013-08-15 23:38:54 +000022class ReceiveStatistics;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000023class RemoteBitrateEstimator;
wu@webrtc.org822fbd82013-08-15 23:38:54 +000024class RtpReceiver;
niklase@google.com470e71d2011-07-07 08:21:25 +000025class Transport;
26
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000027class RtpRtcp : public Module {
28 public:
29 struct Configuration {
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000030 Configuration();
31
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000032 /* id - Unique identifier of this RTP/RTCP module object
33 * audio - True for a audio version of the RTP/RTCP module
34 * object false will create a video version
35 * clock - The clock to use to read time. If NULL object
36 * will be using the system clock.
37 * incoming_data - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000038 * data. May not be NULL; default callback will do
39 * nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000040 * incoming_messages - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000041 * RTP messages. May not be NULL; default callback
42 * will do nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000043 * outgoing_transport - Transport object that will be called when packets
44 * are ready to be sent out on the network
45 * rtcp_feedback - Callback object that will receive the incoming
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000046 * RTCP messages.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000047 * intra_frame_callback - Called when the receiver request a intra frame.
48 * bandwidth_callback - Called when we receive a changed estimate from
49 * the receiver of out stream.
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000050 * audio_messages - Telehone events. May not be NULL; default callback
51 * will do nothing.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000052 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
53 * streams from the same client.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000054 * paced_sender - Spread any bursts of packets into smaller
55 * bursts to minimize packet loss.
niklase@google.com470e71d2011-07-07 08:21:25 +000056 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000057 int32_t id;
58 bool audio;
stefan@webrtc.org20ed36d2013-01-17 14:01:20 +000059 Clock* clock;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000060 RtpRtcp* default_module;
wu@webrtc.org822fbd82013-08-15 23:38:54 +000061 ReceiveStatistics* receive_statistics;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000062 Transport* outgoing_transport;
63 RtcpFeedback* rtcp_feedback;
64 RtcpIntraFrameObserver* intra_frame_callback;
65 RtcpBandwidthObserver* bandwidth_callback;
asapersson@webrtc.org1ae1d0c2013-11-20 12:46:11 +000066 RtcpRttStats* rtt_stats;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000067 RtpAudioFeedback* audio_messages;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000068 RemoteBitrateEstimator* remote_bitrate_estimator;
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000069 PacedSender* paced_sender;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000070 };
wu@webrtc.org822fbd82013-08-15 23:38:54 +000071
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000072 /*
73 * Create a RTP/RTCP module object using the system clock.
74 *
75 * configuration - Configuration of the RTP/RTCP module.
76 */
77 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000078
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000079 /**************************************************************************
80 *
81 * Receiver functions
82 *
83 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000084
stefan@webrtc.orga5cb98c2013-05-29 12:12:51 +000085 virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet,
86 uint16_t incoming_packet_length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000087
wu@webrtc.org822fbd82013-08-15 23:38:54 +000088 virtual void SetRemoteSSRC(const uint32_t ssrc) = 0;
89
niklase@google.com470e71d2011-07-07 08:21:25 +000090 /**************************************************************************
91 *
92 * Sender
93 *
94 ***************************************************************************/
95
96 /*
niklase@google.com470e71d2011-07-07 08:21:25 +000097 * set MTU
98 *
99 * size - Max transfer unit in bytes, default is 1500
100 *
101 * return -1 on failure else 0
102 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000103 virtual int32_t SetMaxTransferUnit(const uint16_t size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000104
105 /*
106 * set transtport overhead
107 * default is IPv4 and UDP with no encryption
108 *
109 * TCP - true for TCP false UDP
110 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000111 * authenticationOverhead - number of bytes to leave for an
112 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000113 *
114 * return -1 on failure else 0
115 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000116 virtual int32_t SetTransportOverhead(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000117 const bool TCP,
118 const bool IPV6,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000119 const uint8_t authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000120
121 /*
122 * Get max payload length
123 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000124 * A combination of the configuration MaxTransferUnit and
125 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000126 * Does not account FEC/ULP/RED overhead if FEC is enabled.
127 * Does not account for RTP headers
128 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000129 virtual uint16_t MaxPayloadLength() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000130
131 /*
132 * Get max data payload length
133 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000134 * A combination of the configuration MaxTransferUnit, headers and
135 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000136 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
137 * Takes into account RTP headers
138 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000139 virtual uint16_t MaxDataPayloadLength() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000140
141 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000142 * set codec name and payload type
143 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000144 * return -1 on failure else 0
145 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000146 virtual int32_t RegisterSendPayload(
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000147 const CodecInst& voiceCodec) = 0;
148
149 /*
150 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000151 *
152 * return -1 on failure else 0
153 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000154 virtual int32_t RegisterSendPayload(
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000155 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000156
157 /*
158 * Unregister a send payload
159 *
160 * payloadType - payload type of codec
161 *
162 * return -1 on failure else 0
163 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000164 virtual int32_t DeRegisterSendPayload(
165 const int8_t payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000166
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000167 /*
168 * (De)register RTP header extension type and id.
169 *
170 * return -1 on failure else 0
171 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000172 virtual int32_t RegisterSendRtpHeaderExtension(
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000173 const RTPExtensionType type,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000174 const uint8_t id) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000175
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000176 virtual int32_t DeregisterSendRtpHeaderExtension(
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000177 const RTPExtensionType type) = 0;
178
niklase@google.com470e71d2011-07-07 08:21:25 +0000179 /*
180 * get start timestamp
181 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000182 virtual uint32_t StartTimestamp() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000183
184 /*
185 * configure start timestamp, default is a random number
186 *
187 * timestamp - start timestamp
188 *
189 * return -1 on failure else 0
190 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000191 virtual int32_t SetStartTimestamp(
192 const uint32_t timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000193
194 /*
195 * Get SequenceNumber
196 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000197 virtual uint16_t SequenceNumber() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000198
199 /*
200 * Set SequenceNumber, default is a random number
201 *
202 * return -1 on failure else 0
203 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000204 virtual int32_t SetSequenceNumber(const uint16_t seq) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000205
206 /*
207 * Get SSRC
208 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000209 virtual uint32_t SSRC() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000210
211 /*
212 * configure SSRC, default is a random number
213 *
214 * return -1 on failure else 0
215 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000216 virtual int32_t SetSSRC(const uint32_t ssrc) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000217
218 /*
219 * Get CSRC
220 *
221 * arrOfCSRC - array of CSRCs
222 *
223 * return -1 on failure else number of valid entries in the array
224 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000225 virtual int32_t CSRCs(
226 uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000227
228 /*
229 * Set CSRC
230 *
231 * arrOfCSRC - array of CSRCs
232 * arrLength - number of valid entries in the array
233 *
234 * return -1 on failure else 0
235 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000236 virtual int32_t SetCSRCs(
237 const uint32_t arrOfCSRC[kRtpCsrcSize],
238 const uint8_t arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000239
240 /*
241 * includes CSRCs in RTP header if enabled
242 *
243 * include CSRC - on/off
244 *
245 * default:on
246 *
247 * return -1 on failure else 0
248 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000249 virtual int32_t SetCSRCStatus(const bool include) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000250
251 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000252 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
253 */
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000254 virtual int32_t SetRTXSendStatus(int modes, bool set_ssrc,
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000255 uint32_t ssrc) = 0;
256
257 // Sets the payload type to use when sending RTX packets. Note that this
258 // doesn't enable RTX, only the payload type is set.
259 virtual void SetRtxSendPayloadType(int payload_type) = 0;
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000260
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000261 /*
262 * Get status of sending RTX (RFC 4588) on a specific SSRC.
263 */
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000264 virtual int32_t RTXSendStatus(int* modes, uint32_t* ssrc,
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000265 int* payloadType) const = 0;
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000266
267 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000268 * sends kRtcpByeCode when going from true to false
269 *
270 * sending - on/off
271 *
272 * return -1 on failure else 0
273 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000274 virtual int32_t SetSendingStatus(const bool sending) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000275
276 /*
277 * get send status
278 */
279 virtual bool Sending() const = 0;
280
281 /*
282 * Starts/Stops media packets, on by default
283 *
284 * sending - on/off
285 *
286 * return -1 on failure else 0
287 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000288 virtual int32_t SetSendingMediaStatus(const bool sending) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000289
290 /*
291 * get send status
292 */
293 virtual bool SendingMedia() const = 0;
294
295 /*
296 * get sent bitrate in Kbit/s
297 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000298 virtual void BitrateSent(uint32_t* totalRate,
299 uint32_t* videoRate,
300 uint32_t* fecRate,
301 uint32_t* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000302
303 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000304 * Used by the codec module to deliver a video or audio frame for
305 * packetization.
niklase@google.com470e71d2011-07-07 08:21:25 +0000306 *
307 * frameType - type of frame to send
308 * payloadType - payload type of frame to send
309 * timestamp - timestamp of frame to send
310 * payloadData - payload buffer of frame to send
311 * payloadSize - size of payload buffer to send
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000312 * fragmentation - fragmentation offset data for fragmented frames such
313 * as layers or RED
niklase@google.com470e71d2011-07-07 08:21:25 +0000314 *
315 * return -1 on failure else 0
316 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000317 virtual int32_t SendOutgoingData(
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000318 const FrameType frameType,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000319 const int8_t payloadType,
320 const uint32_t timeStamp,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +0000321 int64_t capture_time_ms,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000322 const uint8_t* payloadData,
323 const uint32_t payloadSize,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000324 const RTPFragmentationHeader* fragmentation = NULL,
325 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000326
stefan@webrtc.org9b82f5a2013-11-13 15:29:21 +0000327 virtual bool TimeToSendPacket(uint32_t ssrc,
328 uint16_t sequence_number,
329 int64_t capture_time_ms,
330 bool retransmission) = 0;
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000331
stefan@webrtc.org508a84b2013-06-17 12:53:37 +0000332 virtual int TimeToSendPadding(int bytes) = 0;
333
sprang@webrtc.org71f055f2013-12-04 15:09:27 +0000334 virtual void RegisterSendFrameCountObserver(
335 FrameCountObserver* observer) = 0;
336 virtual FrameCountObserver* GetSendFrameCountObserver() const = 0;
337
niklase@google.com470e71d2011-07-07 08:21:25 +0000338 /**************************************************************************
339 *
340 * RTCP
341 *
342 ***************************************************************************/
343
344 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000345 * Get RTCP status
346 */
347 virtual RTCPMethod RTCP() const = 0;
348
349 /*
350 * configure RTCP status i.e on(compound or non- compound)/off
351 *
352 * method - RTCP method to use
353 *
354 * return -1 on failure else 0
355 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000356 virtual int32_t SetRTCPStatus(const RTCPMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000357
358 /*
359 * Set RTCP CName (i.e unique identifier)
360 *
361 * return -1 on failure else 0
362 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000363 virtual int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000364
365 /*
366 * Get RTCP CName (i.e unique identifier)
367 *
368 * return -1 on failure else 0
369 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000370 virtual int32_t CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000371
372 /*
373 * Get remote CName
374 *
375 * return -1 on failure else 0
376 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000377 virtual int32_t RemoteCNAME(
378 const uint32_t remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000379 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000380
381 /*
382 * Get remote NTP
383 *
384 * return -1 on failure else 0
385 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000386 virtual int32_t RemoteNTP(
387 uint32_t *ReceivedNTPsecs,
388 uint32_t *ReceivedNTPfrac,
389 uint32_t *RTCPArrivalTimeSecs,
390 uint32_t *RTCPArrivalTimeFrac,
391 uint32_t *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000392
393 /*
394 * AddMixedCNAME
395 *
396 * return -1 on failure else 0
397 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000398 virtual int32_t AddMixedCNAME(
399 const uint32_t SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000400 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000401
402 /*
403 * RemoveMixedCNAME
404 *
405 * return -1 on failure else 0
406 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000407 virtual int32_t RemoveMixedCNAME(const uint32_t SSRC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000408
409 /*
410 * Get RoundTripTime
411 *
412 * return -1 on failure else 0
413 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000414 virtual int32_t RTT(const uint32_t remoteSSRC,
415 uint16_t* RTT,
416 uint16_t* avgRTT,
417 uint16_t* minRTT,
418 uint16_t* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000419
420 /*
421 * Reset RoundTripTime statistics
422 *
423 * return -1 on failure else 0
424 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000425 virtual int32_t ResetRTT(const uint32_t remoteSSRC)= 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000426
427 /*
428 * Force a send of a RTCP packet
429 * normal SR and RR are triggered via the process function
430 *
431 * return -1 on failure else 0
432 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000433 virtual int32_t SendRTCP(
434 uint32_t rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000435
436 /*
437 * Good state of RTP receiver inform sender
438 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000439 virtual int32_t SendRTCPReferencePictureSelection(
440 const uint64_t pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000441
442 /*
443 * Send a RTCP Slice Loss Indication (SLI)
444 * 6 least significant bits of pictureID
445 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000446 virtual int32_t SendRTCPSliceLossIndication(
447 const uint8_t pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000448
449 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000450 * Reset RTP data counters for the sending side
451 *
452 * return -1 on failure else 0
453 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000454 virtual int32_t ResetSendDataCountersRTP() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000455
456 /*
457 * statistics of the amount of data sent and received
458 *
459 * return -1 on failure else 0
460 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000461 virtual int32_t DataCountersRTP(
462 uint32_t* bytesSent,
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000463 uint32_t* packetsSent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000464 /*
465 * Get received RTCP sender info
466 *
467 * return -1 on failure else 0
468 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000469 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000470
471 /*
472 * Get received RTCP report block
473 *
474 * return -1 on failure else 0
475 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000476 virtual int32_t RemoteRTCPStat(
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000477 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000478 /*
479 * Set received RTCP report block
480 *
481 * return -1 on failure else 0
482 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000483 virtual int32_t AddRTCPReportBlock(
484 const uint32_t SSRC,
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000485 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000486
487 /*
488 * RemoveRTCPReportBlock
489 *
490 * return -1 on failure else 0
491 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000492 virtual int32_t RemoveRTCPReportBlock(const uint32_t SSRC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000493
494 /*
495 * (APP) Application specific data
496 *
497 * return -1 on failure else 0
498 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000499 virtual int32_t SetRTCPApplicationSpecificData(
500 const uint8_t subType,
501 const uint32_t name,
502 const uint8_t* data,
503 const uint16_t length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000504 /*
505 * (XR) VOIP metric
506 *
507 * return -1 on failure else 0
508 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000509 virtual int32_t SetRTCPVoIPMetrics(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000510 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000511
512 /*
asapersson@webrtc.org7d6bd222013-10-31 12:14:34 +0000513 * (XR) Receiver Reference Time Report
514 */
515 virtual void SetRtcpXrRrtrStatus(bool enable) = 0;
516
asapersson@webrtc.org8d02f5d2013-11-21 08:57:04 +0000517 virtual bool RtcpXrRrtrStatus() const = 0;
518
asapersson@webrtc.org7d6bd222013-10-31 12:14:34 +0000519 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000520 * (REMB) Receiver Estimated Max Bitrate
521 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000522 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000523
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000524 virtual int32_t SetREMBStatus(const bool enable) = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000525
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000526 virtual int32_t SetREMBData(const uint32_t bitrate,
527 const uint8_t numberOfSSRC,
528 const uint32_t* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000529
530 /*
531 * (IJ) Extended jitter report.
532 */
533 virtual bool IJ() const = 0;
534
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000535 virtual int32_t SetIJStatus(const bool enable) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000536
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000537 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000538 * (TMMBR) Temporary Max Media Bit Rate
539 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000540 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000541
542 /*
543 *
544 * return -1 on failure else 0
545 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000546 virtual int32_t SetTMMBRStatus(const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000547
548 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000549 * (NACK)
550 */
niklase@google.com470e71d2011-07-07 08:21:25 +0000551
552 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000553 * TODO(holmer): Propagate this API to VideoEngine.
554 * Returns the currently configured selective retransmission settings.
555 */
556 virtual int SelectiveRetransmissions() const = 0;
557
558 /*
559 * TODO(holmer): Propagate this API to VideoEngine.
560 * Sets the selective retransmission settings, which will decide which
561 * packets will be retransmitted if NACKed. Settings are constructed by
562 * combining the constants in enum RetransmissionMode with bitwise OR.
563 * All packets are retransmitted if kRetransmitAllPackets is set, while no
564 * packets are retransmitted if kRetransmitOff is set.
565 * By default all packets except FEC packets are retransmitted. For VP8
566 * with temporal scalability only base layer packets are retransmitted.
567 *
568 * Returns -1 on failure, otherwise 0.
569 */
570 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
571
572 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000573 * Send a Negative acknowledgement packet
574 *
575 * return -1 on failure else 0
576 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000577 virtual int32_t SendNACK(const uint16_t* nackList,
578 const uint16_t size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000579
580 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000581 * Store the sent packets, needed to answer to a Negative acknowledgement
582 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000583 *
584 * return -1 on failure else 0
585 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000586 virtual int32_t SetStorePacketsStatus(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000587 const bool enable,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000588 const uint16_t numberToStore) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000589
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000590 // Returns true if the module is configured to store packets.
591 virtual bool StorePackets() const = 0;
592
niklase@google.com470e71d2011-07-07 08:21:25 +0000593 /**************************************************************************
594 *
595 * Audio
596 *
597 ***************************************************************************/
598
599 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000600 * set audio packet size, used to determine when it's time to send a DTMF
601 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000602 *
603 * return -1 on failure else 0
604 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000605 virtual int32_t SetAudioPacketSize(
606 const uint16_t packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000607
608 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000609 * SendTelephoneEventActive
610 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000611 * return true if we currently send a telephone event and 100 ms after an
612 * event is sent used to prevent the telephone event tone to be recorded
613 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000614 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000615 virtual bool SendTelephoneEventActive(
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000616 int8_t& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000617
618 /*
619 * Send a TelephoneEvent tone using RFC 2833 (4733)
620 *
621 * return -1 on failure else 0
622 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000623 virtual int32_t SendTelephoneEventOutband(
624 const uint8_t key,
625 const uint16_t time_ms,
626 const uint8_t level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000627
628 /*
629 * Set payload type for Redundant Audio Data RFC 2198
630 *
631 * return -1 on failure else 0
632 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000633 virtual int32_t SetSendREDPayloadType(
634 const int8_t payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000635
636 /*
637 * Get payload type for Redundant Audio Data RFC 2198
638 *
639 * return -1 on failure else 0
640 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000641 virtual int32_t SendREDPayloadType(
642 int8_t& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000643
644 /*
645 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000646 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000647 *
648 * return -1 on failure else 0
649 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000650 virtual int32_t SetRTPAudioLevelIndicationStatus(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000651 const bool enable,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000652 const uint8_t ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000653
654 /*
655 * Get status and ID for header-extension-for-audio-level-indication.
656 *
657 * return -1 on failure else 0
658 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000659 virtual int32_t GetRTPAudioLevelIndicationStatus(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000660 bool& enable,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000661 uint8_t& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000662
663 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000664 * Store the audio level in dBov for header-extension-for-audio-level-
665 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000666 * This API shall be called before transmision of an RTP packet to ensure
667 * that the |level| part of the extended RTP header is updated.
668 *
669 * return -1 on failure else 0.
670 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000671 virtual int32_t SetAudioLevel(const uint8_t level_dBov) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000672
673 /**************************************************************************
674 *
675 * Video
676 *
677 ***************************************************************************/
678
679 /*
stefan@webrtc.org7da34592013-04-09 14:56:29 +0000680 * Set the estimated camera delay in MS
681 *
682 * return -1 on failure else 0
683 */
684 virtual int32_t SetCameraDelay(const int32_t delayMS) = 0;
685
686 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000687 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000688 */
stefan@webrtc.orgb2c8a952013-09-06 13:58:01 +0000689 virtual void SetTargetSendBitrate(
690 const std::vector<uint32_t>& stream_bitrates) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000691
692 /*
693 * Turn on/off generic FEC
694 *
695 * return -1 on failure else 0
696 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000697 virtual int32_t SetGenericFECStatus(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000698 const bool enable,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000699 const uint8_t payloadTypeRED,
700 const uint8_t payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000701
702 /*
703 * Get generic FEC setting
704 *
705 * return -1 on failure else 0
706 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000707 virtual int32_t GenericFECStatus(bool& enable,
708 uint8_t& payloadTypeRED,
709 uint8_t& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000710
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000711
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000712 virtual int32_t SetFecParameters(
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000713 const FecProtectionParams* delta_params,
714 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000715
niklase@google.com470e71d2011-07-07 08:21:25 +0000716 /*
717 * Set method for requestion a new key frame
718 *
719 * return -1 on failure else 0
720 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000721 virtual int32_t SetKeyFrameRequestMethod(
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000722 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000723
724 /*
725 * send a request for a keyframe
726 *
727 * return -1 on failure else 0
728 */
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000729 virtual int32_t RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000730};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000731} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000732#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_