blob: 09761d9170804a0d1db544d4ee61bd3a93b60ce5 [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
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000016#include "modules/interface/module.h"
17#include "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 {
29 Configuration()
30 : id(-1),
31 audio(false),
32 clock(NULL),
33 default_module(NULL),
34 incoming_data(NULL),
35 incoming_messages(NULL),
36 outgoing_transport(NULL),
37 rtcp_feedback(NULL),
38 intra_frame_callback(NULL),
39 bandwidth_callback(NULL),
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000040 rtt_observer(NULL),
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000041 audio_messages(NULL),
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000042 remote_bitrate_estimator(NULL),
43 paced_sender(NULL) {
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000044 }
45 /* id - Unique identifier of this RTP/RTCP module object
46 * audio - True for a audio version of the RTP/RTCP module
47 * object false will create a video version
48 * clock - The clock to use to read time. If NULL object
49 * will be using the system clock.
50 * incoming_data - Callback object that will receive the incoming
51 * data
52 * incoming_messages - Callback object that will receive the incoming
53 * RTP messages.
54 * outgoing_transport - Transport object that will be called when packets
55 * are ready to be sent out on the network
56 * rtcp_feedback - Callback object that will receive the incoming
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000057 * RTCP messages.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000058 * intra_frame_callback - Called when the receiver request a intra frame.
59 * bandwidth_callback - Called when we receive a changed estimate from
60 * the receiver of out stream.
61 * audio_messages - Telehone events.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000062 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
63 * streams from the same client.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000064 * paced_sender - Spread any bursts of packets into smaller
65 * bursts to minimize packet loss.
niklase@google.com470e71d2011-07-07 08:21:25 +000066 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000067 int32_t id;
68 bool audio;
69 RtpRtcpClock* clock;
70 RtpRtcp* default_module;
71 RtpData* incoming_data;
72 RtpFeedback* incoming_messages;
73 Transport* outgoing_transport;
74 RtcpFeedback* rtcp_feedback;
75 RtcpIntraFrameObserver* intra_frame_callback;
76 RtcpBandwidthObserver* bandwidth_callback;
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000077 RtcpRttObserver* rtt_observer;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000078 RtpAudioFeedback* audio_messages;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000079 RemoteBitrateEstimator* remote_bitrate_estimator;
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000080 PacedSender* paced_sender;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000081 };
82 /*
83 * Create a RTP/RTCP module object using the system clock.
84 *
85 * configuration - Configuration of the RTP/RTCP module.
86 */
87 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000088
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000089 /**************************************************************************
90 *
91 * Receiver functions
92 *
93 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000094
95 /*
96 * configure a RTP packet timeout value
97 *
98 * RTPtimeoutMS - time in milliseconds after last received RTP packet
99 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
100 *
101 * return -1 on failure else 0
102 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000103 virtual WebRtc_Word32 SetPacketTimeout(
104 const WebRtc_UWord32 RTPtimeoutMS,
105 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000106
107 /*
108 * Set periodic dead or alive notification
109 *
110 * enable - turn periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000111 * sampleTimeSeconds - sample interval in seconds for dead or alive
112 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000113 *
114 * return -1 on failure else 0
115 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000116 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
117 const bool enable,
118 const WebRtc_UWord8 sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000119
120 /*
121 * Get periodic dead or alive notification status
122 *
123 * enable - periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000124 * sampleTimeSeconds - sample interval in seconds for dead or alive
125 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000126 *
127 * return -1 on failure else 0
128 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000129 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
130 bool& enable,
131 WebRtc_UWord8& sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000132
133 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000134 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000135 *
136 * return -1 on failure else 0
137 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000138 virtual WebRtc_Word32 RegisterReceivePayload(
139 const CodecInst& voiceCodec) = 0;
140
141 /*
142 * set video codec name and payload type
143 *
144 * return -1 on failure else 0
145 */
146 virtual WebRtc_Word32 RegisterReceivePayload(
147 const VideoCodec& videoCodec) = 0;
148
149 /*
150 * get payload type for a voice codec
151 *
152 * return -1 on failure else 0
153 */
154 virtual WebRtc_Word32 ReceivePayloadType(
155 const CodecInst& voiceCodec,
156 WebRtc_Word8* plType) = 0;
157
158 /*
159 * get payload type for a video codec
160 *
161 * return -1 on failure else 0
162 */
163 virtual WebRtc_Word32 ReceivePayloadType(
164 const VideoCodec& videoCodec,
165 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000166
167 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000168 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000169 *
170 * payloadType - payload type of codec
171 *
172 * return -1 on failure else 0
173 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000174 virtual WebRtc_Word32 DeRegisterReceivePayload(
175 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000176
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000177 /*
178 * (De)register RTP header extension type and id.
179 *
180 * return -1 on failure else 0
181 */
182 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
183 const RTPExtensionType type,
184 const WebRtc_UWord8 id) = 0;
185
186 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
187 const RTPExtensionType type) = 0;
188
niklase@google.com470e71d2011-07-07 08:21:25 +0000189 /*
190 * Get last received remote timestamp
191 */
192 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
193
194 /*
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000195 * Get the local time of the last received remote timestamp
196 */
197 virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0;
198
199 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000200 * Get the current estimated remote timestamp
201 *
202 * timestamp - estimated timestamp
203 *
204 * return -1 on failure else 0
205 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000206 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
207 WebRtc_UWord32& timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000208
209 /*
210 * Get incoming SSRC
211 */
212 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
213
214 /*
215 * Get remote CSRC
216 *
217 * arrOfCSRC - array that will receive the CSRCs
218 *
219 * return -1 on failure else the number of valid entries in the list
220 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000221 virtual WebRtc_Word32 RemoteCSRCs(
222 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000223
224 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000225 * get the currently configured SSRC filter
226 *
227 * allowedSSRC - SSRC that will be allowed through
228 *
229 * return -1 on failure else 0
230 */
231 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
232
233 /*
234 * set a SSRC to be used as a filter for incoming RTP streams
235 *
236 * allowedSSRC - SSRC that will be allowed through
237 *
238 * return -1 on failure else 0
239 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000240 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
241 const WebRtc_UWord32 allowedSSRC) = 0;
242
243 /*
244 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
245 */
246 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
247 const WebRtc_UWord32 SSRC) = 0;
248
249 /*
250 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
251 */
252 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
253 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000254
255 /*
256 * called by the network module when we receive a packet
257 *
258 * incomingPacket - incoming packet buffer
259 * packetLength - length of incoming buffer
260 *
261 * return -1 on failure else 0
262 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000263 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
264 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000265
niklase@google.com470e71d2011-07-07 08:21:25 +0000266 /**************************************************************************
267 *
268 * Sender
269 *
270 ***************************************************************************/
271
272 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000273 * set MTU
274 *
275 * size - Max transfer unit in bytes, default is 1500
276 *
277 * return -1 on failure else 0
278 */
279 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
280
281 /*
282 * set transtport overhead
283 * default is IPv4 and UDP with no encryption
284 *
285 * TCP - true for TCP false UDP
286 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000287 * authenticationOverhead - number of bytes to leave for an
288 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000289 *
290 * return -1 on failure else 0
291 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000292 virtual WebRtc_Word32 SetTransportOverhead(
293 const bool TCP,
294 const bool IPV6,
295 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000296
297 /*
298 * Get max payload length
299 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000300 * A combination of the configuration MaxTransferUnit and
301 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000302 * Does not account FEC/ULP/RED overhead if FEC is enabled.
303 * Does not account for RTP headers
304 */
305 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
306
307 /*
308 * Get max data payload length
309 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000310 * A combination of the configuration MaxTransferUnit, headers and
311 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000312 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
313 * Takes into account RTP headers
314 */
315 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
316
317 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000318 * set codec name and payload type
319 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000320 * return -1 on failure else 0
321 */
322 virtual WebRtc_Word32 RegisterSendPayload(
323 const CodecInst& voiceCodec) = 0;
324
325 /*
326 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000327 *
328 * return -1 on failure else 0
329 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000330 virtual WebRtc_Word32 RegisterSendPayload(
331 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000332
333 /*
334 * Unregister a send payload
335 *
336 * payloadType - payload type of codec
337 *
338 * return -1 on failure else 0
339 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000340 virtual WebRtc_Word32 DeRegisterSendPayload(
341 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000342
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000343 /*
344 * (De)register RTP header extension type and id.
345 *
346 * return -1 on failure else 0
347 */
348 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
349 const RTPExtensionType type,
350 const WebRtc_UWord8 id) = 0;
351
352 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
353 const RTPExtensionType type) = 0;
354
niklase@google.com470e71d2011-07-07 08:21:25 +0000355 /*
356 * get start timestamp
357 */
358 virtual WebRtc_UWord32 StartTimestamp() const = 0;
359
360 /*
361 * configure start timestamp, default is a random number
362 *
363 * timestamp - start timestamp
364 *
365 * return -1 on failure else 0
366 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000367 virtual WebRtc_Word32 SetStartTimestamp(
368 const WebRtc_UWord32 timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000369
370 /*
371 * Get SequenceNumber
372 */
373 virtual WebRtc_UWord16 SequenceNumber() const = 0;
374
375 /*
376 * Set SequenceNumber, default is a random number
377 *
378 * return -1 on failure else 0
379 */
380 virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
381
382 /*
383 * Get SSRC
384 */
385 virtual WebRtc_UWord32 SSRC() const = 0;
386
387 /*
388 * configure SSRC, default is a random number
389 *
390 * return -1 on failure else 0
391 */
392 virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
393
394 /*
395 * Get CSRC
396 *
397 * arrOfCSRC - array of CSRCs
398 *
399 * return -1 on failure else number of valid entries in the array
400 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000401 virtual WebRtc_Word32 CSRCs(
402 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000403
404 /*
405 * Set CSRC
406 *
407 * arrOfCSRC - array of CSRCs
408 * arrLength - number of valid entries in the array
409 *
410 * return -1 on failure else 0
411 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000412 virtual WebRtc_Word32 SetCSRCs(
413 const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
414 const WebRtc_UWord8 arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000415
416 /*
417 * includes CSRCs in RTP header if enabled
418 *
419 * include CSRC - on/off
420 *
421 * default:on
422 *
423 * return -1 on failure else 0
424 */
425 virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
426
427 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000428 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
429 */
430 virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
431 const bool setSSRC,
432 const WebRtc_UWord32 SSRC) = 0;
433
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000434 /*
435 * Get status of sending RTX (RFC 4588) on a specific SSRC.
436 */
437 virtual WebRtc_Word32 RTXSendStatus(bool* enable,
438 WebRtc_UWord32* SSRC) const = 0;
439
440 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000441 * sends kRtcpByeCode when going from true to false
442 *
443 * sending - on/off
444 *
445 * return -1 on failure else 0
446 */
447 virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
448
449 /*
450 * get send status
451 */
452 virtual bool Sending() const = 0;
453
454 /*
455 * Starts/Stops media packets, on by default
456 *
457 * sending - on/off
458 *
459 * return -1 on failure else 0
460 */
461 virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
462
463 /*
464 * get send status
465 */
466 virtual bool SendingMedia() const = 0;
467
468 /*
469 * get sent bitrate in Kbit/s
470 */
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000471 virtual void BitrateSent(WebRtc_UWord32* totalRate,
stefan@webrtc.orgfbea4e52011-10-27 16:08:29 +0000472 WebRtc_UWord32* videoRate,
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000473 WebRtc_UWord32* fecRate,
474 WebRtc_UWord32* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000475
476 /*
stefan@webrtc.org439be292012-02-16 14:45:37 +0000477 * Get the receive-side estimate of the available bandwidth.
478 */
479 virtual int EstimatedReceiveBandwidth(
stefan@webrtc.org07b45a52012-02-02 08:37:48 +0000480 WebRtc_UWord32* available_bandwidth) const = 0;
481
482 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000483 * Used by the codec module to deliver a video or audio frame for
484 * packetization.
niklase@google.com470e71d2011-07-07 08:21:25 +0000485 *
486 * frameType - type of frame to send
487 * payloadType - payload type of frame to send
488 * timestamp - timestamp of frame to send
489 * payloadData - payload buffer of frame to send
490 * payloadSize - size of payload buffer to send
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000491 * fragmentation - fragmentation offset data for fragmented frames such
492 * as layers or RED
niklase@google.com470e71d2011-07-07 08:21:25 +0000493 *
494 * return -1 on failure else 0
495 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000496 virtual WebRtc_Word32 SendOutgoingData(
497 const FrameType frameType,
498 const WebRtc_Word8 payloadType,
499 const WebRtc_UWord32 timeStamp,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +0000500 int64_t capture_time_ms,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000501 const WebRtc_UWord8* payloadData,
502 const WebRtc_UWord32 payloadSize,
503 const RTPFragmentationHeader* fragmentation = NULL,
504 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000505
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000506 virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
507 int64_t capture_time_ms) = 0;
508
niklase@google.com470e71d2011-07-07 08:21:25 +0000509 /**************************************************************************
510 *
511 * RTCP
512 *
513 ***************************************************************************/
514
515 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000516 * Get RTCP status
517 */
518 virtual RTCPMethod RTCP() const = 0;
519
520 /*
521 * configure RTCP status i.e on(compound or non- compound)/off
522 *
523 * method - RTCP method to use
524 *
525 * return -1 on failure else 0
526 */
527 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
528
529 /*
530 * Set RTCP CName (i.e unique identifier)
531 *
532 * return -1 on failure else 0
533 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000534 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000535
536 /*
537 * Get RTCP CName (i.e unique identifier)
538 *
539 * return -1 on failure else 0
540 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000541 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000542
543 /*
544 * Get remote CName
545 *
546 * return -1 on failure else 0
547 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000548 virtual WebRtc_Word32 RemoteCNAME(
549 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000550 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000551
552 /*
553 * Get remote NTP
554 *
555 * return -1 on failure else 0
556 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000557 virtual WebRtc_Word32 RemoteNTP(
558 WebRtc_UWord32 *ReceivedNTPsecs,
559 WebRtc_UWord32 *ReceivedNTPfrac,
560 WebRtc_UWord32 *RTCPArrivalTimeSecs,
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000561 WebRtc_UWord32 *RTCPArrivalTimeFrac,
562 WebRtc_UWord32 *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000563
564 /*
565 * AddMixedCNAME
566 *
567 * return -1 on failure else 0
568 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000569 virtual WebRtc_Word32 AddMixedCNAME(
570 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000571 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000572
573 /*
574 * RemoveMixedCNAME
575 *
576 * return -1 on failure else 0
577 */
578 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
579
580 /*
581 * Get RoundTripTime
582 *
583 * return -1 on failure else 0
584 */
585 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000586 WebRtc_UWord16* RTT,
587 WebRtc_UWord16* avgRTT,
588 WebRtc_UWord16* minRTT,
589 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000590
591 /*
592 * Reset RoundTripTime statistics
593 *
594 * return -1 on failure else 0
595 */
596 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
597
598 /*
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +0000599 * Sets the estimated RTT, to be used for receive only modules without
600 * possibility of calculating its own RTT.
601 */
602 virtual void SetRtt(uint32_t rtt) = 0;
603
604 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000605 * Force a send of a RTCP packet
606 * normal SR and RR are triggered via the process function
607 *
608 * return -1 on failure else 0
609 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000610 virtual WebRtc_Word32 SendRTCP(
611 WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000612
613 /*
614 * Good state of RTP receiver inform sender
615 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000616 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
617 const WebRtc_UWord64 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000618
619 /*
620 * Send a RTCP Slice Loss Indication (SLI)
621 * 6 least significant bits of pictureID
622 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000623 virtual WebRtc_Word32 SendRTCPSliceLossIndication(
624 const WebRtc_UWord8 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000625
626 /*
627 * Reset RTP statistics
628 *
629 * return -1 on failure else 0
630 */
631 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
632
633 /*
634 * statistics of our localy created statistics of the received RTP stream
635 *
636 * return -1 on failure else 0
637 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000638 virtual WebRtc_Word32 StatisticsRTP(
639 WebRtc_UWord8* fraction_lost, // scale 0 to 255
640 WebRtc_UWord32* cum_lost, // number of lost packets
641 WebRtc_UWord32* ext_max, // highest sequence number received
642 WebRtc_UWord32* jitter,
643 WebRtc_UWord32* max_jitter = NULL) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000644
645 /*
646 * Reset RTP data counters for the receiving side
647 *
648 * return -1 on failure else 0
649 */
650 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
651
652 /*
653 * Reset RTP data counters for the sending side
654 *
655 * return -1 on failure else 0
656 */
657 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
658
659 /*
660 * statistics of the amount of data sent and received
661 *
662 * return -1 on failure else 0
663 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000664 virtual WebRtc_Word32 DataCountersRTP(
665 WebRtc_UWord32* bytesSent,
666 WebRtc_UWord32* packetsSent,
667 WebRtc_UWord32* bytesReceived,
668 WebRtc_UWord32* packetsReceived) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000669 /*
670 * Get received RTCP sender info
671 *
672 * return -1 on failure else 0
673 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000674 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000675
676 /*
677 * Get received RTCP report block
678 *
679 * return -1 on failure else 0
680 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000681 virtual WebRtc_Word32 RemoteRTCPStat(
682 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000683 /*
684 * Set received RTCP report block
685 *
686 * return -1 on failure else 0
687 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000688 virtual WebRtc_Word32 AddRTCPReportBlock(
689 const WebRtc_UWord32 SSRC,
690 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000691
692 /*
693 * RemoveRTCPReportBlock
694 *
695 * return -1 on failure else 0
696 */
697 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
698
699 /*
700 * (APP) Application specific data
701 *
702 * return -1 on failure else 0
703 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000704 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
705 const WebRtc_UWord8 subType,
706 const WebRtc_UWord32 name,
707 const WebRtc_UWord8* data,
708 const WebRtc_UWord16 length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000709 /*
710 * (XR) VOIP metric
711 *
712 * return -1 on failure else 0
713 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000714 virtual WebRtc_Word32 SetRTCPVoIPMetrics(
715 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000716
717 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000718 * (REMB) Receiver Estimated Max Bitrate
719 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000720 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000721
722 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
723
724 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
725 const WebRtc_UWord8 numberOfSSRC,
726 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000727
728 /*
729 * (IJ) Extended jitter report.
730 */
731 virtual bool IJ() const = 0;
732
733 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
734
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000735 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000736 * (TMMBR) Temporary Max Media Bit Rate
737 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000738 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000739
740 /*
741 *
742 * return -1 on failure else 0
743 */
744 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
745
746 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000747 * (NACK)
748 */
749 virtual NACKMethod NACK() const = 0;
750
751 /*
752 * Turn negative acknowledgement requests on/off
753 *
754 * return -1 on failure else 0
755 */
756 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method) = 0;
757
758 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000759 * TODO(holmer): Propagate this API to VideoEngine.
760 * Returns the currently configured selective retransmission settings.
761 */
762 virtual int SelectiveRetransmissions() const = 0;
763
764 /*
765 * TODO(holmer): Propagate this API to VideoEngine.
766 * Sets the selective retransmission settings, which will decide which
767 * packets will be retransmitted if NACKed. Settings are constructed by
768 * combining the constants in enum RetransmissionMode with bitwise OR.
769 * All packets are retransmitted if kRetransmitAllPackets is set, while no
770 * packets are retransmitted if kRetransmitOff is set.
771 * By default all packets except FEC packets are retransmitted. For VP8
772 * with temporal scalability only base layer packets are retransmitted.
773 *
774 * Returns -1 on failure, otherwise 0.
775 */
776 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
777
778 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000779 * Send a Negative acknowledgement packet
780 *
781 * return -1 on failure else 0
782 */
783 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000784 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000785
786 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000787 * Store the sent packets, needed to answer to a Negative acknowledgement
788 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000789 *
790 * return -1 on failure else 0
791 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000792 virtual WebRtc_Word32 SetStorePacketsStatus(
793 const bool enable,
794 const WebRtc_UWord16 numberToStore = 200) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000795
796 /**************************************************************************
797 *
798 * Audio
799 *
800 ***************************************************************************/
801
802 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000803 * set audio packet size, used to determine when it's time to send a DTMF
804 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000805 *
806 * return -1 on failure else 0
807 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000808 virtual WebRtc_Word32 SetAudioPacketSize(
809 const WebRtc_UWord16 packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000810
811 /*
812 * Outband TelephoneEvent(DTMF) detection
813 *
814 * return -1 on failure else 0
815 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000816 virtual WebRtc_Word32 SetTelephoneEventStatus(
817 const bool enable,
818 const bool forwardToDecoder,
819 const bool detectEndOfTone = false) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000820
821 /*
822 * Is outband TelephoneEvent(DTMF) turned on/off?
823 */
824 virtual bool TelephoneEvent() const = 0;
825
826 /*
827 * Returns true if received DTMF events are forwarded to the decoder using
828 * the OnPlayTelephoneEvent callback.
829 */
830 virtual bool TelephoneEventForwardToDecoder() const = 0;
831
832 /*
833 * SendTelephoneEventActive
834 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000835 * return true if we currently send a telephone event and 100 ms after an
836 * event is sent used to prevent the telephone event tone to be recorded
837 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000838 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000839 virtual bool SendTelephoneEventActive(
840 WebRtc_Word8& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000841
842 /*
843 * Send a TelephoneEvent tone using RFC 2833 (4733)
844 *
845 * return -1 on failure else 0
846 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000847 virtual WebRtc_Word32 SendTelephoneEventOutband(
848 const WebRtc_UWord8 key,
849 const WebRtc_UWord16 time_ms,
850 const WebRtc_UWord8 level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000851
852 /*
853 * Set payload type for Redundant Audio Data RFC 2198
854 *
855 * return -1 on failure else 0
856 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000857 virtual WebRtc_Word32 SetSendREDPayloadType(
858 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000859
860 /*
861 * Get payload type for Redundant Audio Data RFC 2198
862 *
863 * return -1 on failure else 0
864 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000865 virtual WebRtc_Word32 SendREDPayloadType(
866 WebRtc_Word8& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000867
868 /*
869 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000870 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000871 *
872 * return -1 on failure else 0
873 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000874 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
875 const bool enable,
876 const WebRtc_UWord8 ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000877
878 /*
879 * Get status and ID for header-extension-for-audio-level-indication.
880 *
881 * return -1 on failure else 0
882 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000883 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
884 bool& enable,
885 WebRtc_UWord8& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000886
887 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000888 * Store the audio level in dBov for header-extension-for-audio-level-
889 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000890 * This API shall be called before transmision of an RTP packet to ensure
891 * that the |level| part of the extended RTP header is updated.
892 *
893 * return -1 on failure else 0.
894 */
895 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
896
897 /**************************************************************************
898 *
899 * Video
900 *
901 ***************************************************************************/
902
903 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000904 * Set the estimated camera delay in MS
905 *
906 * return -1 on failure else 0
907 */
908 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
909
910 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000911 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000912 */
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000913 virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000914
915 /*
916 * Turn on/off generic FEC
917 *
918 * return -1 on failure else 0
919 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000920 virtual WebRtc_Word32 SetGenericFECStatus(
921 const bool enable,
922 const WebRtc_UWord8 payloadTypeRED,
923 const WebRtc_UWord8 payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000924
925 /*
926 * Get generic FEC setting
927 *
928 * return -1 on failure else 0
929 */
930 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000931 WebRtc_UWord8& payloadTypeRED,
932 WebRtc_UWord8& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000933
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000934
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000935 virtual WebRtc_Word32 SetFecParameters(
936 const FecProtectionParams* delta_params,
937 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000938
niklase@google.com470e71d2011-07-07 08:21:25 +0000939 /*
940 * Set method for requestion a new key frame
941 *
942 * return -1 on failure else 0
943 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000944 virtual WebRtc_Word32 SetKeyFrameRequestMethod(
945 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000946
947 /*
948 * send a request for a keyframe
949 *
950 * return -1 on failure else 0
951 */
pwestin@webrtc.org5e954812012-02-10 12:13:12 +0000952 virtual WebRtc_Word32 RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000953};
954} // namespace webrtc
955#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_