blob: 648b1b0f5540eb47e3203a45f7615b0c32aa845e [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;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000022class RemoteBitrateEstimator;
23class RemoteBitrateObserver;
niklase@google.com470e71d2011-07-07 08:21:25 +000024class Transport;
25
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000026class RtpRtcp : public Module {
27 public:
28 struct Configuration {
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000029 Configuration();
30
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000031 /* id - Unique identifier of this RTP/RTCP module object
32 * audio - True for a audio version of the RTP/RTCP module
33 * object false will create a video version
34 * clock - The clock to use to read time. If NULL object
35 * will be using the system clock.
36 * incoming_data - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000037 * data. May not be NULL; default callback will do
38 * nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000039 * incoming_messages - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000040 * RTP messages. May not be NULL; default callback
41 * will do nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000042 * outgoing_transport - Transport object that will be called when packets
43 * are ready to be sent out on the network
44 * rtcp_feedback - Callback object that will receive the incoming
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000045 * RTCP messages.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000046 * intra_frame_callback - Called when the receiver request a intra frame.
47 * bandwidth_callback - Called when we receive a changed estimate from
48 * the receiver of out stream.
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000049 * audio_messages - Telehone events. May not be NULL; default callback
50 * will do nothing.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000051 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
52 * streams from the same client.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000053 * paced_sender - Spread any bursts of packets into smaller
54 * bursts to minimize packet loss.
niklase@google.com470e71d2011-07-07 08:21:25 +000055 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000056 int32_t id;
57 bool audio;
stefan@webrtc.org20ed36d2013-01-17 14:01:20 +000058 Clock* clock;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000059 RtpRtcp* default_module;
60 RtpData* incoming_data;
61 RtpFeedback* incoming_messages;
62 Transport* outgoing_transport;
63 RtcpFeedback* rtcp_feedback;
64 RtcpIntraFrameObserver* intra_frame_callback;
65 RtcpBandwidthObserver* bandwidth_callback;
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000066 RtcpRttObserver* rtt_observer;
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 };
71 /*
72 * Create a RTP/RTCP module object using the system clock.
73 *
74 * configuration - Configuration of the RTP/RTCP module.
75 */
76 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000077
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000078 /**************************************************************************
79 *
80 * Receiver functions
81 *
82 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000083
84 /*
85 * configure a RTP packet timeout value
86 *
87 * RTPtimeoutMS - time in milliseconds after last received RTP packet
88 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
89 *
90 * return -1 on failure else 0
91 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000092 virtual WebRtc_Word32 SetPacketTimeout(
93 const WebRtc_UWord32 RTPtimeoutMS,
94 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000095
96 /*
97 * Set periodic dead or alive notification
98 *
99 * enable - turn periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000100 * sampleTimeSeconds - sample interval in seconds for dead or alive
101 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000102 *
103 * return -1 on failure else 0
104 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000105 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
106 const bool enable,
107 const WebRtc_UWord8 sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000108
109 /*
110 * Get periodic dead or alive notification status
111 *
112 * enable - periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000113 * sampleTimeSeconds - sample interval in seconds for dead or alive
114 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000115 *
116 * return -1 on failure else 0
117 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000118 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
119 bool& enable,
120 WebRtc_UWord8& sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000121
122 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000123 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000124 *
125 * return -1 on failure else 0
126 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000127 virtual WebRtc_Word32 RegisterReceivePayload(
128 const CodecInst& voiceCodec) = 0;
129
130 /*
131 * set video codec name and payload type
132 *
133 * return -1 on failure else 0
134 */
135 virtual WebRtc_Word32 RegisterReceivePayload(
136 const VideoCodec& videoCodec) = 0;
137
138 /*
139 * get payload type for a voice codec
140 *
141 * return -1 on failure else 0
142 */
143 virtual WebRtc_Word32 ReceivePayloadType(
144 const CodecInst& voiceCodec,
145 WebRtc_Word8* plType) = 0;
146
147 /*
148 * get payload type for a video codec
149 *
150 * return -1 on failure else 0
151 */
152 virtual WebRtc_Word32 ReceivePayloadType(
153 const VideoCodec& videoCodec,
154 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000155
156 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000157 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000158 *
159 * payloadType - payload type of codec
160 *
161 * return -1 on failure else 0
162 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000163 virtual WebRtc_Word32 DeRegisterReceivePayload(
164 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000165
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000166 /*
167 * (De)register RTP header extension type and id.
168 *
169 * return -1 on failure else 0
170 */
171 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
172 const RTPExtensionType type,
173 const WebRtc_UWord8 id) = 0;
174
175 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
176 const RTPExtensionType type) = 0;
177
niklase@google.com470e71d2011-07-07 08:21:25 +0000178 /*
179 * Get last received remote timestamp
180 */
181 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
182
183 /*
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000184 * Get the local time of the last received remote timestamp
185 */
186 virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0;
187
188 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000189 * Get the current estimated remote timestamp
190 *
191 * timestamp - estimated timestamp
192 *
193 * return -1 on failure else 0
194 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000195 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
196 WebRtc_UWord32& timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000197
198 /*
199 * Get incoming SSRC
200 */
201 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
202
203 /*
204 * Get remote CSRC
205 *
206 * arrOfCSRC - array that will receive the CSRCs
207 *
208 * return -1 on failure else the number of valid entries in the list
209 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000210 virtual WebRtc_Word32 RemoteCSRCs(
211 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000212
213 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000214 * get the currently configured SSRC filter
215 *
216 * allowedSSRC - SSRC that will be allowed through
217 *
218 * return -1 on failure else 0
219 */
220 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
221
222 /*
223 * set a SSRC to be used as a filter for incoming RTP streams
224 *
225 * allowedSSRC - SSRC that will be allowed through
226 *
227 * return -1 on failure else 0
228 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000229 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
230 const WebRtc_UWord32 allowedSSRC) = 0;
231
232 /*
233 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
234 */
235 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
236 const WebRtc_UWord32 SSRC) = 0;
237
238 /*
239 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
240 */
241 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
242 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000243
244 /*
245 * called by the network module when we receive a packet
246 *
247 * incomingPacket - incoming packet buffer
248 * packetLength - length of incoming buffer
249 *
250 * return -1 on failure else 0
251 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000252 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
253 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000254
niklase@google.com470e71d2011-07-07 08:21:25 +0000255 /**************************************************************************
256 *
257 * Sender
258 *
259 ***************************************************************************/
260
261 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000262 * set MTU
263 *
264 * size - Max transfer unit in bytes, default is 1500
265 *
266 * return -1 on failure else 0
267 */
268 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
269
270 /*
271 * set transtport overhead
272 * default is IPv4 and UDP with no encryption
273 *
274 * TCP - true for TCP false UDP
275 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000276 * authenticationOverhead - number of bytes to leave for an
277 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000278 *
279 * return -1 on failure else 0
280 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000281 virtual WebRtc_Word32 SetTransportOverhead(
282 const bool TCP,
283 const bool IPV6,
284 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000285
286 /*
287 * Get max payload length
288 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000289 * A combination of the configuration MaxTransferUnit and
290 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000291 * Does not account FEC/ULP/RED overhead if FEC is enabled.
292 * Does not account for RTP headers
293 */
294 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
295
296 /*
297 * Get max data payload length
298 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000299 * A combination of the configuration MaxTransferUnit, headers and
300 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000301 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
302 * Takes into account RTP headers
303 */
304 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
305
306 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000307 * set codec name and payload type
308 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000309 * return -1 on failure else 0
310 */
311 virtual WebRtc_Word32 RegisterSendPayload(
312 const CodecInst& voiceCodec) = 0;
313
314 /*
315 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000316 *
317 * return -1 on failure else 0
318 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000319 virtual WebRtc_Word32 RegisterSendPayload(
320 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000321
322 /*
323 * Unregister a send payload
324 *
325 * payloadType - payload type of codec
326 *
327 * return -1 on failure else 0
328 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000329 virtual WebRtc_Word32 DeRegisterSendPayload(
330 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000331
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000332 /*
333 * (De)register RTP header extension type and id.
334 *
335 * return -1 on failure else 0
336 */
337 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
338 const RTPExtensionType type,
339 const WebRtc_UWord8 id) = 0;
340
341 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
342 const RTPExtensionType type) = 0;
343
niklase@google.com470e71d2011-07-07 08:21:25 +0000344 /*
345 * get start timestamp
346 */
347 virtual WebRtc_UWord32 StartTimestamp() const = 0;
348
349 /*
350 * configure start timestamp, default is a random number
351 *
352 * timestamp - start timestamp
353 *
354 * return -1 on failure else 0
355 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000356 virtual WebRtc_Word32 SetStartTimestamp(
357 const WebRtc_UWord32 timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000358
359 /*
360 * Get SequenceNumber
361 */
362 virtual WebRtc_UWord16 SequenceNumber() const = 0;
363
364 /*
365 * Set SequenceNumber, default is a random number
366 *
367 * return -1 on failure else 0
368 */
369 virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
370
371 /*
372 * Get SSRC
373 */
374 virtual WebRtc_UWord32 SSRC() const = 0;
375
376 /*
377 * configure SSRC, default is a random number
378 *
379 * return -1 on failure else 0
380 */
381 virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
382
383 /*
384 * Get CSRC
385 *
386 * arrOfCSRC - array of CSRCs
387 *
388 * return -1 on failure else number of valid entries in the array
389 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000390 virtual WebRtc_Word32 CSRCs(
391 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000392
393 /*
394 * Set CSRC
395 *
396 * arrOfCSRC - array of CSRCs
397 * arrLength - number of valid entries in the array
398 *
399 * return -1 on failure else 0
400 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000401 virtual WebRtc_Word32 SetCSRCs(
402 const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
403 const WebRtc_UWord8 arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000404
405 /*
406 * includes CSRCs in RTP header if enabled
407 *
408 * include CSRC - on/off
409 *
410 * default:on
411 *
412 * return -1 on failure else 0
413 */
414 virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
415
416 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000417 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
418 */
mikhal@webrtc.orgbda7f302013-03-15 23:21:52 +0000419 virtual WebRtc_Word32 SetRTXSendStatus(const RtxMode mode,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000420 const bool setSSRC,
421 const WebRtc_UWord32 SSRC) = 0;
422
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000423 /*
424 * Get status of sending RTX (RFC 4588) on a specific SSRC.
425 */
mikhal@webrtc.orgbda7f302013-03-15 23:21:52 +0000426 virtual WebRtc_Word32 RTXSendStatus(RtxMode* mode,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000427 WebRtc_UWord32* SSRC) const = 0;
428
429 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000430 * sends kRtcpByeCode when going from true to false
431 *
432 * sending - on/off
433 *
434 * return -1 on failure else 0
435 */
436 virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
437
438 /*
439 * get send status
440 */
441 virtual bool Sending() const = 0;
442
443 /*
444 * Starts/Stops media packets, on by default
445 *
446 * sending - on/off
447 *
448 * return -1 on failure else 0
449 */
450 virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
451
452 /*
453 * get send status
454 */
455 virtual bool SendingMedia() const = 0;
456
457 /*
458 * get sent bitrate in Kbit/s
459 */
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000460 virtual void BitrateSent(WebRtc_UWord32* totalRate,
stefan@webrtc.orgfbea4e52011-10-27 16:08:29 +0000461 WebRtc_UWord32* videoRate,
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000462 WebRtc_UWord32* fecRate,
463 WebRtc_UWord32* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000464
465 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000466 * Used by the codec module to deliver a video or audio frame for
467 * packetization.
niklase@google.com470e71d2011-07-07 08:21:25 +0000468 *
469 * frameType - type of frame to send
470 * payloadType - payload type of frame to send
471 * timestamp - timestamp of frame to send
472 * payloadData - payload buffer of frame to send
473 * payloadSize - size of payload buffer to send
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000474 * fragmentation - fragmentation offset data for fragmented frames such
475 * as layers or RED
niklase@google.com470e71d2011-07-07 08:21:25 +0000476 *
477 * return -1 on failure else 0
478 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000479 virtual WebRtc_Word32 SendOutgoingData(
480 const FrameType frameType,
481 const WebRtc_Word8 payloadType,
482 const WebRtc_UWord32 timeStamp,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +0000483 int64_t capture_time_ms,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000484 const WebRtc_UWord8* payloadData,
485 const WebRtc_UWord32 payloadSize,
486 const RTPFragmentationHeader* fragmentation = NULL,
487 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000488
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000489 virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
490 int64_t capture_time_ms) = 0;
491
niklase@google.com470e71d2011-07-07 08:21:25 +0000492 /**************************************************************************
493 *
494 * RTCP
495 *
496 ***************************************************************************/
497
498 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000499 * Get RTCP status
500 */
501 virtual RTCPMethod RTCP() const = 0;
502
503 /*
504 * configure RTCP status i.e on(compound or non- compound)/off
505 *
506 * method - RTCP method to use
507 *
508 * return -1 on failure else 0
509 */
510 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
511
512 /*
513 * Set RTCP CName (i.e unique identifier)
514 *
515 * return -1 on failure else 0
516 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000517 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000518
519 /*
520 * Get RTCP CName (i.e unique identifier)
521 *
522 * return -1 on failure else 0
523 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000524 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000525
526 /*
527 * Get remote CName
528 *
529 * return -1 on failure else 0
530 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000531 virtual WebRtc_Word32 RemoteCNAME(
532 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000533 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000534
535 /*
536 * Get remote NTP
537 *
538 * return -1 on failure else 0
539 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000540 virtual WebRtc_Word32 RemoteNTP(
541 WebRtc_UWord32 *ReceivedNTPsecs,
542 WebRtc_UWord32 *ReceivedNTPfrac,
543 WebRtc_UWord32 *RTCPArrivalTimeSecs,
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000544 WebRtc_UWord32 *RTCPArrivalTimeFrac,
545 WebRtc_UWord32 *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000546
547 /*
548 * AddMixedCNAME
549 *
550 * return -1 on failure else 0
551 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000552 virtual WebRtc_Word32 AddMixedCNAME(
553 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000554 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000555
556 /*
557 * RemoveMixedCNAME
558 *
559 * return -1 on failure else 0
560 */
561 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
562
563 /*
564 * Get RoundTripTime
565 *
566 * return -1 on failure else 0
567 */
568 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000569 WebRtc_UWord16* RTT,
570 WebRtc_UWord16* avgRTT,
571 WebRtc_UWord16* minRTT,
572 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000573
574 /*
575 * Reset RoundTripTime statistics
576 *
577 * return -1 on failure else 0
578 */
579 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
580
581 /*
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +0000582 * Sets the estimated RTT, to be used for receive only modules without
583 * possibility of calculating its own RTT.
584 */
585 virtual void SetRtt(uint32_t rtt) = 0;
586
587 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000588 * Force a send of a RTCP packet
589 * normal SR and RR are triggered via the process function
590 *
591 * return -1 on failure else 0
592 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000593 virtual WebRtc_Word32 SendRTCP(
594 WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000595
596 /*
597 * Good state of RTP receiver inform sender
598 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000599 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
600 const WebRtc_UWord64 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000601
602 /*
603 * Send a RTCP Slice Loss Indication (SLI)
604 * 6 least significant bits of pictureID
605 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000606 virtual WebRtc_Word32 SendRTCPSliceLossIndication(
607 const WebRtc_UWord8 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000608
609 /*
610 * Reset RTP statistics
611 *
612 * return -1 on failure else 0
613 */
614 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
615
616 /*
617 * statistics of our localy created statistics of the received RTP stream
618 *
619 * return -1 on failure else 0
620 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000621 virtual WebRtc_Word32 StatisticsRTP(
622 WebRtc_UWord8* fraction_lost, // scale 0 to 255
623 WebRtc_UWord32* cum_lost, // number of lost packets
624 WebRtc_UWord32* ext_max, // highest sequence number received
625 WebRtc_UWord32* jitter,
626 WebRtc_UWord32* max_jitter = NULL) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000627
628 /*
629 * Reset RTP data counters for the receiving side
630 *
631 * return -1 on failure else 0
632 */
633 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
634
635 /*
636 * Reset RTP data counters for the sending side
637 *
638 * return -1 on failure else 0
639 */
640 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
641
642 /*
643 * statistics of the amount of data sent and received
644 *
645 * return -1 on failure else 0
646 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000647 virtual WebRtc_Word32 DataCountersRTP(
648 WebRtc_UWord32* bytesSent,
649 WebRtc_UWord32* packetsSent,
650 WebRtc_UWord32* bytesReceived,
651 WebRtc_UWord32* packetsReceived) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000652 /*
653 * Get received RTCP sender info
654 *
655 * return -1 on failure else 0
656 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000657 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000658
659 /*
660 * Get received RTCP report block
661 *
662 * return -1 on failure else 0
663 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000664 virtual WebRtc_Word32 RemoteRTCPStat(
665 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000666 /*
667 * Set received RTCP report block
668 *
669 * return -1 on failure else 0
670 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000671 virtual WebRtc_Word32 AddRTCPReportBlock(
672 const WebRtc_UWord32 SSRC,
673 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000674
675 /*
676 * RemoveRTCPReportBlock
677 *
678 * return -1 on failure else 0
679 */
680 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
681
682 /*
683 * (APP) Application specific data
684 *
685 * return -1 on failure else 0
686 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000687 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
688 const WebRtc_UWord8 subType,
689 const WebRtc_UWord32 name,
690 const WebRtc_UWord8* data,
691 const WebRtc_UWord16 length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000692 /*
693 * (XR) VOIP metric
694 *
695 * return -1 on failure else 0
696 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000697 virtual WebRtc_Word32 SetRTCPVoIPMetrics(
698 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000699
700 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000701 * (REMB) Receiver Estimated Max Bitrate
702 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000703 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000704
705 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
706
707 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
708 const WebRtc_UWord8 numberOfSSRC,
709 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000710
711 /*
712 * (IJ) Extended jitter report.
713 */
714 virtual bool IJ() const = 0;
715
716 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
717
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000718 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000719 * (TMMBR) Temporary Max Media Bit Rate
720 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000721 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000722
723 /*
724 *
725 * return -1 on failure else 0
726 */
727 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
728
729 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000730 * (NACK)
731 */
732 virtual NACKMethod NACK() const = 0;
733
734 /*
735 * Turn negative acknowledgement requests on/off
stefan@webrtc.orgbecf9c82013-02-01 15:09:57 +0000736 * |max_reordering_threshold| should be set to how much a retransmitted
737 * packet can be expected to be reordered (in sequence numbers) compared to
738 * a packet which has not been retransmitted.
niklase@google.com470e71d2011-07-07 08:21:25 +0000739 *
740 * return -1 on failure else 0
741 */
stefan@webrtc.orgbecf9c82013-02-01 15:09:57 +0000742 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method,
743 int max_reordering_threshold) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000744
745 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000746 * TODO(holmer): Propagate this API to VideoEngine.
747 * Returns the currently configured selective retransmission settings.
748 */
749 virtual int SelectiveRetransmissions() const = 0;
750
751 /*
752 * TODO(holmer): Propagate this API to VideoEngine.
753 * Sets the selective retransmission settings, which will decide which
754 * packets will be retransmitted if NACKed. Settings are constructed by
755 * combining the constants in enum RetransmissionMode with bitwise OR.
756 * All packets are retransmitted if kRetransmitAllPackets is set, while no
757 * packets are retransmitted if kRetransmitOff is set.
758 * By default all packets except FEC packets are retransmitted. For VP8
759 * with temporal scalability only base layer packets are retransmitted.
760 *
761 * Returns -1 on failure, otherwise 0.
762 */
763 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
764
765 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000766 * Send a Negative acknowledgement packet
767 *
768 * return -1 on failure else 0
769 */
770 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000771 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000772
773 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000774 * Store the sent packets, needed to answer to a Negative acknowledgement
775 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000776 *
777 * return -1 on failure else 0
778 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000779 virtual WebRtc_Word32 SetStorePacketsStatus(
780 const bool enable,
stefan@webrtc.orgbecf9c82013-02-01 15:09:57 +0000781 const WebRtc_UWord16 numberToStore) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000782
783 /**************************************************************************
784 *
785 * Audio
786 *
787 ***************************************************************************/
788
789 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000790 * set audio packet size, used to determine when it's time to send a DTMF
791 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000792 *
793 * return -1 on failure else 0
794 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000795 virtual WebRtc_Word32 SetAudioPacketSize(
796 const WebRtc_UWord16 packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000797
798 /*
turaj@webrtc.orgb7edd062013-03-12 22:27:27 +0000799 * Forward DTMF to decoder for playout.
niklase@google.com470e71d2011-07-07 08:21:25 +0000800 *
801 * return -1 on failure else 0
802 */
turaj@webrtc.orgb7edd062013-03-12 22:27:27 +0000803 virtual int SetTelephoneEventForwardToDecoder(bool forwardToDecoder) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000804
805 /*
806 * Returns true if received DTMF events are forwarded to the decoder using
807 * the OnPlayTelephoneEvent callback.
808 */
809 virtual bool TelephoneEventForwardToDecoder() const = 0;
810
811 /*
812 * SendTelephoneEventActive
813 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000814 * return true if we currently send a telephone event and 100 ms after an
815 * event is sent used to prevent the telephone event tone to be recorded
816 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000817 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000818 virtual bool SendTelephoneEventActive(
819 WebRtc_Word8& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000820
821 /*
822 * Send a TelephoneEvent tone using RFC 2833 (4733)
823 *
824 * return -1 on failure else 0
825 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000826 virtual WebRtc_Word32 SendTelephoneEventOutband(
827 const WebRtc_UWord8 key,
828 const WebRtc_UWord16 time_ms,
829 const WebRtc_UWord8 level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000830
831 /*
832 * Set payload type for Redundant Audio Data RFC 2198
833 *
834 * return -1 on failure else 0
835 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000836 virtual WebRtc_Word32 SetSendREDPayloadType(
837 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000838
839 /*
840 * Get payload type for Redundant Audio Data RFC 2198
841 *
842 * return -1 on failure else 0
843 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000844 virtual WebRtc_Word32 SendREDPayloadType(
845 WebRtc_Word8& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000846
847 /*
848 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000849 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000850 *
851 * return -1 on failure else 0
852 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000853 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
854 const bool enable,
855 const WebRtc_UWord8 ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000856
857 /*
858 * Get status and ID for header-extension-for-audio-level-indication.
859 *
860 * return -1 on failure else 0
861 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000862 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
863 bool& enable,
864 WebRtc_UWord8& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000865
866 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000867 * Store the audio level in dBov for header-extension-for-audio-level-
868 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000869 * This API shall be called before transmision of an RTP packet to ensure
870 * that the |level| part of the extended RTP header is updated.
871 *
872 * return -1 on failure else 0.
873 */
874 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
875
876 /**************************************************************************
877 *
878 * Video
879 *
880 ***************************************************************************/
881
882 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000883 * Set the estimated camera delay in MS
884 *
885 * return -1 on failure else 0
886 */
887 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
888
889 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000890 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000891 */
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000892 virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000893
894 /*
895 * Turn on/off generic FEC
896 *
897 * return -1 on failure else 0
898 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000899 virtual WebRtc_Word32 SetGenericFECStatus(
900 const bool enable,
901 const WebRtc_UWord8 payloadTypeRED,
902 const WebRtc_UWord8 payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000903
904 /*
905 * Get generic FEC setting
906 *
907 * return -1 on failure else 0
908 */
909 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000910 WebRtc_UWord8& payloadTypeRED,
911 WebRtc_UWord8& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000912
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000913
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000914 virtual WebRtc_Word32 SetFecParameters(
915 const FecProtectionParams* delta_params,
916 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000917
niklase@google.com470e71d2011-07-07 08:21:25 +0000918 /*
919 * Set method for requestion a new key frame
920 *
921 * return -1 on failure else 0
922 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000923 virtual WebRtc_Word32 SetKeyFrameRequestMethod(
924 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000925
926 /*
927 * send a request for a keyframe
928 *
929 * return -1 on failure else 0
930 */
pwestin@webrtc.org5e954812012-02-10 12:13:12 +0000931 virtual WebRtc_Word32 RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000932};
933} // namespace webrtc
934#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_