blob: b715c0d0a44d6e625a45566b6930609d4884d26f [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),
40 audio_messages(NULL),
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000041 remote_bitrate_estimator(NULL),
42 paced_sender(NULL) {
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000043 }
44 /* id - Unique identifier of this RTP/RTCP module object
45 * audio - True for a audio version of the RTP/RTCP module
46 * object false will create a video version
47 * clock - The clock to use to read time. If NULL object
48 * will be using the system clock.
49 * incoming_data - Callback object that will receive the incoming
50 * data
51 * incoming_messages - Callback object that will receive the incoming
52 * RTP messages.
53 * outgoing_transport - Transport object that will be called when packets
54 * are ready to be sent out on the network
55 * rtcp_feedback - Callback object that will receive the incoming
56 * RTP messages.
57 * intra_frame_callback - Called when the receiver request a intra frame.
58 * bandwidth_callback - Called when we receive a changed estimate from
59 * the receiver of out stream.
60 * audio_messages - Telehone events.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000061 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
62 * streams from the same client.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000063 * paced_sender - Spread any bursts of packets into smaller
64 * bursts to minimize packet loss.
niklase@google.com470e71d2011-07-07 08:21:25 +000065 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000066 int32_t id;
67 bool audio;
68 RtpRtcpClock* clock;
69 RtpRtcp* default_module;
70 RtpData* incoming_data;
71 RtpFeedback* incoming_messages;
72 Transport* outgoing_transport;
73 RtcpFeedback* rtcp_feedback;
74 RtcpIntraFrameObserver* intra_frame_callback;
75 RtcpBandwidthObserver* bandwidth_callback;
76 RtpAudioFeedback* audio_messages;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000077 RemoteBitrateEstimator* remote_bitrate_estimator;
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000078 PacedSender* paced_sender;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000079 };
80 /*
81 * Create a RTP/RTCP module object using the system clock.
82 *
83 * configuration - Configuration of the RTP/RTCP module.
84 */
85 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000086
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000087 /**************************************************************************
88 *
89 * Receiver functions
90 *
91 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000092
93 /*
94 * configure a RTP packet timeout value
95 *
96 * RTPtimeoutMS - time in milliseconds after last received RTP packet
97 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
98 *
99 * return -1 on failure else 0
100 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000101 virtual WebRtc_Word32 SetPacketTimeout(
102 const WebRtc_UWord32 RTPtimeoutMS,
103 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000104
105 /*
106 * Set periodic dead or alive notification
107 *
108 * enable - turn periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000109 * sampleTimeSeconds - sample interval in seconds for dead or alive
110 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000111 *
112 * return -1 on failure else 0
113 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000114 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
115 const bool enable,
116 const WebRtc_UWord8 sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000117
118 /*
119 * Get periodic dead or alive notification status
120 *
121 * enable - periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000122 * sampleTimeSeconds - sample interval in seconds for dead or alive
123 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000124 *
125 * return -1 on failure else 0
126 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000127 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
128 bool& enable,
129 WebRtc_UWord8& sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000130
131 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000132 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000133 *
134 * return -1 on failure else 0
135 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000136 virtual WebRtc_Word32 RegisterReceivePayload(
137 const CodecInst& voiceCodec) = 0;
138
139 /*
140 * set video codec name and payload type
141 *
142 * return -1 on failure else 0
143 */
144 virtual WebRtc_Word32 RegisterReceivePayload(
145 const VideoCodec& videoCodec) = 0;
146
147 /*
148 * get payload type for a voice codec
149 *
150 * return -1 on failure else 0
151 */
152 virtual WebRtc_Word32 ReceivePayloadType(
153 const CodecInst& voiceCodec,
154 WebRtc_Word8* plType) = 0;
155
156 /*
157 * get payload type for a video codec
158 *
159 * return -1 on failure else 0
160 */
161 virtual WebRtc_Word32 ReceivePayloadType(
162 const VideoCodec& videoCodec,
163 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000164
165 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000166 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000167 *
168 * payloadType - payload type of codec
169 *
170 * return -1 on failure else 0
171 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000172 virtual WebRtc_Word32 DeRegisterReceivePayload(
173 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000174
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000175 /*
176 * (De)register RTP header extension type and id.
177 *
178 * return -1 on failure else 0
179 */
180 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
181 const RTPExtensionType type,
182 const WebRtc_UWord8 id) = 0;
183
184 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
185 const RTPExtensionType type) = 0;
186
niklase@google.com470e71d2011-07-07 08:21:25 +0000187 /*
188 * Get last received remote timestamp
189 */
190 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
191
192 /*
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000193 * Get the local time of the last received remote timestamp
194 */
195 virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0;
196
197 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000198 * Get the current estimated remote timestamp
199 *
200 * timestamp - estimated timestamp
201 *
202 * return -1 on failure else 0
203 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000204 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
205 WebRtc_UWord32& timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000206
207 /*
208 * Get incoming SSRC
209 */
210 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
211
212 /*
213 * Get remote CSRC
214 *
215 * arrOfCSRC - array that will receive the CSRCs
216 *
217 * return -1 on failure else the number of valid entries in the list
218 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000219 virtual WebRtc_Word32 RemoteCSRCs(
220 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000221
222 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000223 * get the currently configured SSRC filter
224 *
225 * allowedSSRC - SSRC that will be allowed through
226 *
227 * return -1 on failure else 0
228 */
229 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
230
231 /*
232 * set a SSRC to be used as a filter for incoming RTP streams
233 *
234 * allowedSSRC - SSRC that will be allowed through
235 *
236 * return -1 on failure else 0
237 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000238 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
239 const WebRtc_UWord32 allowedSSRC) = 0;
240
241 /*
242 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
243 */
244 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
245 const WebRtc_UWord32 SSRC) = 0;
246
247 /*
248 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
249 */
250 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
251 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000252
253 /*
254 * called by the network module when we receive a packet
255 *
256 * incomingPacket - incoming packet buffer
257 * packetLength - length of incoming buffer
258 *
259 * return -1 on failure else 0
260 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000261 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
262 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000263
niklase@google.com470e71d2011-07-07 08:21:25 +0000264 /**************************************************************************
265 *
266 * Sender
267 *
268 ***************************************************************************/
269
270 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000271 * set MTU
272 *
273 * size - Max transfer unit in bytes, default is 1500
274 *
275 * return -1 on failure else 0
276 */
277 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
278
279 /*
280 * set transtport overhead
281 * default is IPv4 and UDP with no encryption
282 *
283 * TCP - true for TCP false UDP
284 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000285 * authenticationOverhead - number of bytes to leave for an
286 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000287 *
288 * return -1 on failure else 0
289 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000290 virtual WebRtc_Word32 SetTransportOverhead(
291 const bool TCP,
292 const bool IPV6,
293 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000294
295 /*
296 * Get max payload length
297 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000298 * A combination of the configuration MaxTransferUnit and
299 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000300 * Does not account FEC/ULP/RED overhead if FEC is enabled.
301 * Does not account for RTP headers
302 */
303 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
304
305 /*
306 * Get max data payload length
307 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000308 * A combination of the configuration MaxTransferUnit, headers and
309 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000310 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
311 * Takes into account RTP headers
312 */
313 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
314
315 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000316 * set codec name and payload type
317 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000318 * return -1 on failure else 0
319 */
320 virtual WebRtc_Word32 RegisterSendPayload(
321 const CodecInst& voiceCodec) = 0;
322
323 /*
324 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000325 *
326 * return -1 on failure else 0
327 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000328 virtual WebRtc_Word32 RegisterSendPayload(
329 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000330
331 /*
332 * Unregister a send payload
333 *
334 * payloadType - payload type of codec
335 *
336 * return -1 on failure else 0
337 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000338 virtual WebRtc_Word32 DeRegisterSendPayload(
339 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000340
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000341 /*
342 * (De)register RTP header extension type and id.
343 *
344 * return -1 on failure else 0
345 */
346 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
347 const RTPExtensionType type,
348 const WebRtc_UWord8 id) = 0;
349
350 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
351 const RTPExtensionType type) = 0;
352
niklase@google.com470e71d2011-07-07 08:21:25 +0000353 /*
354 * get start timestamp
355 */
356 virtual WebRtc_UWord32 StartTimestamp() const = 0;
357
358 /*
359 * configure start timestamp, default is a random number
360 *
361 * timestamp - start timestamp
362 *
363 * return -1 on failure else 0
364 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000365 virtual WebRtc_Word32 SetStartTimestamp(
366 const WebRtc_UWord32 timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000367
368 /*
369 * Get SequenceNumber
370 */
371 virtual WebRtc_UWord16 SequenceNumber() const = 0;
372
373 /*
374 * Set SequenceNumber, default is a random number
375 *
376 * return -1 on failure else 0
377 */
378 virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
379
380 /*
381 * Get SSRC
382 */
383 virtual WebRtc_UWord32 SSRC() const = 0;
384
385 /*
386 * configure SSRC, default is a random number
387 *
388 * return -1 on failure else 0
389 */
390 virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
391
392 /*
393 * Get CSRC
394 *
395 * arrOfCSRC - array of CSRCs
396 *
397 * return -1 on failure else number of valid entries in the array
398 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000399 virtual WebRtc_Word32 CSRCs(
400 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000401
402 /*
403 * Set CSRC
404 *
405 * arrOfCSRC - array of CSRCs
406 * arrLength - number of valid entries in the array
407 *
408 * return -1 on failure else 0
409 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000410 virtual WebRtc_Word32 SetCSRCs(
411 const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
412 const WebRtc_UWord8 arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000413
414 /*
415 * includes CSRCs in RTP header if enabled
416 *
417 * include CSRC - on/off
418 *
419 * default:on
420 *
421 * return -1 on failure else 0
422 */
423 virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
424
425 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000426 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
427 */
428 virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
429 const bool setSSRC,
430 const WebRtc_UWord32 SSRC) = 0;
431
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000432 /*
433 * Get status of sending RTX (RFC 4588) on a specific SSRC.
434 */
435 virtual WebRtc_Word32 RTXSendStatus(bool* enable,
436 WebRtc_UWord32* SSRC) const = 0;
437
438 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000439 * sends kRtcpByeCode when going from true to false
440 *
441 * sending - on/off
442 *
443 * return -1 on failure else 0
444 */
445 virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
446
447 /*
448 * get send status
449 */
450 virtual bool Sending() const = 0;
451
452 /*
453 * Starts/Stops media packets, on by default
454 *
455 * sending - on/off
456 *
457 * return -1 on failure else 0
458 */
459 virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
460
461 /*
462 * get send status
463 */
464 virtual bool SendingMedia() const = 0;
465
466 /*
467 * get sent bitrate in Kbit/s
468 */
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000469 virtual void BitrateSent(WebRtc_UWord32* totalRate,
stefan@webrtc.orgfbea4e52011-10-27 16:08:29 +0000470 WebRtc_UWord32* videoRate,
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000471 WebRtc_UWord32* fecRate,
472 WebRtc_UWord32* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000473
474 /*
stefan@webrtc.org439be292012-02-16 14:45:37 +0000475 * Get the receive-side estimate of the available bandwidth.
476 */
477 virtual int EstimatedReceiveBandwidth(
stefan@webrtc.org07b45a52012-02-02 08:37:48 +0000478 WebRtc_UWord32* available_bandwidth) const = 0;
479
480 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000481 * Used by the codec module to deliver a video or audio frame for
482 * packetization.
niklase@google.com470e71d2011-07-07 08:21:25 +0000483 *
484 * frameType - type of frame to send
485 * payloadType - payload type of frame to send
486 * timestamp - timestamp of frame to send
487 * payloadData - payload buffer of frame to send
488 * payloadSize - size of payload buffer to send
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000489 * fragmentation - fragmentation offset data for fragmented frames such
490 * as layers or RED
niklase@google.com470e71d2011-07-07 08:21:25 +0000491 *
492 * return -1 on failure else 0
493 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000494 virtual WebRtc_Word32 SendOutgoingData(
495 const FrameType frameType,
496 const WebRtc_Word8 payloadType,
497 const WebRtc_UWord32 timeStamp,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +0000498 int64_t capture_time_ms,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000499 const WebRtc_UWord8* payloadData,
500 const WebRtc_UWord32 payloadSize,
501 const RTPFragmentationHeader* fragmentation = NULL,
502 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000503
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000504 virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
505 int64_t capture_time_ms) = 0;
506
niklase@google.com470e71d2011-07-07 08:21:25 +0000507 /**************************************************************************
508 *
509 * RTCP
510 *
511 ***************************************************************************/
512
513 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000514 * Get RTCP status
515 */
516 virtual RTCPMethod RTCP() const = 0;
517
518 /*
519 * configure RTCP status i.e on(compound or non- compound)/off
520 *
521 * method - RTCP method to use
522 *
523 * return -1 on failure else 0
524 */
525 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
526
527 /*
528 * Set RTCP CName (i.e unique identifier)
529 *
530 * return -1 on failure else 0
531 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000532 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000533
534 /*
535 * Get RTCP CName (i.e unique identifier)
536 *
537 * return -1 on failure else 0
538 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000539 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000540
541 /*
542 * Get remote CName
543 *
544 * return -1 on failure else 0
545 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000546 virtual WebRtc_Word32 RemoteCNAME(
547 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000548 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000549
550 /*
551 * Get remote NTP
552 *
553 * return -1 on failure else 0
554 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000555 virtual WebRtc_Word32 RemoteNTP(
556 WebRtc_UWord32 *ReceivedNTPsecs,
557 WebRtc_UWord32 *ReceivedNTPfrac,
558 WebRtc_UWord32 *RTCPArrivalTimeSecs,
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000559 WebRtc_UWord32 *RTCPArrivalTimeFrac,
560 WebRtc_UWord32 *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000561
562 /*
563 * AddMixedCNAME
564 *
565 * return -1 on failure else 0
566 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000567 virtual WebRtc_Word32 AddMixedCNAME(
568 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000569 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000570
571 /*
572 * RemoveMixedCNAME
573 *
574 * return -1 on failure else 0
575 */
576 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
577
578 /*
579 * Get RoundTripTime
580 *
581 * return -1 on failure else 0
582 */
583 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000584 WebRtc_UWord16* RTT,
585 WebRtc_UWord16* avgRTT,
586 WebRtc_UWord16* minRTT,
587 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000588
589 /*
590 * Reset RoundTripTime statistics
591 *
592 * return -1 on failure else 0
593 */
594 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
595
596 /*
597 * Force a send of a RTCP packet
598 * normal SR and RR are triggered via the process function
599 *
600 * return -1 on failure else 0
601 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000602 virtual WebRtc_Word32 SendRTCP(
603 WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000604
605 /*
606 * Good state of RTP receiver inform sender
607 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000608 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
609 const WebRtc_UWord64 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000610
611 /*
612 * Send a RTCP Slice Loss Indication (SLI)
613 * 6 least significant bits of pictureID
614 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000615 virtual WebRtc_Word32 SendRTCPSliceLossIndication(
616 const WebRtc_UWord8 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000617
618 /*
619 * Reset RTP statistics
620 *
621 * return -1 on failure else 0
622 */
623 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
624
625 /*
626 * statistics of our localy created statistics of the received RTP stream
627 *
628 * return -1 on failure else 0
629 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000630 virtual WebRtc_Word32 StatisticsRTP(
631 WebRtc_UWord8* fraction_lost, // scale 0 to 255
632 WebRtc_UWord32* cum_lost, // number of lost packets
633 WebRtc_UWord32* ext_max, // highest sequence number received
634 WebRtc_UWord32* jitter,
635 WebRtc_UWord32* max_jitter = NULL) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000636
637 /*
638 * Reset RTP data counters for the receiving side
639 *
640 * return -1 on failure else 0
641 */
642 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
643
644 /*
645 * Reset RTP data counters for the sending side
646 *
647 * return -1 on failure else 0
648 */
649 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
650
651 /*
652 * statistics of the amount of data sent and received
653 *
654 * return -1 on failure else 0
655 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000656 virtual WebRtc_Word32 DataCountersRTP(
657 WebRtc_UWord32* bytesSent,
658 WebRtc_UWord32* packetsSent,
659 WebRtc_UWord32* bytesReceived,
660 WebRtc_UWord32* packetsReceived) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000661 /*
662 * Get received RTCP sender info
663 *
664 * return -1 on failure else 0
665 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000666 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000667
668 /*
669 * Get received RTCP report block
670 *
671 * return -1 on failure else 0
672 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000673 virtual WebRtc_Word32 RemoteRTCPStat(
674 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000675 /*
676 * Set received RTCP report block
677 *
678 * return -1 on failure else 0
679 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000680 virtual WebRtc_Word32 AddRTCPReportBlock(
681 const WebRtc_UWord32 SSRC,
682 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000683
684 /*
685 * RemoveRTCPReportBlock
686 *
687 * return -1 on failure else 0
688 */
689 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
690
691 /*
692 * (APP) Application specific data
693 *
694 * return -1 on failure else 0
695 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000696 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
697 const WebRtc_UWord8 subType,
698 const WebRtc_UWord32 name,
699 const WebRtc_UWord8* data,
700 const WebRtc_UWord16 length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000701 /*
702 * (XR) VOIP metric
703 *
704 * return -1 on failure else 0
705 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000706 virtual WebRtc_Word32 SetRTCPVoIPMetrics(
707 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000708
709 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000710 * (REMB) Receiver Estimated Max Bitrate
711 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000712 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000713
714 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
715
716 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
717 const WebRtc_UWord8 numberOfSSRC,
718 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000719
720 /*
721 * (IJ) Extended jitter report.
722 */
723 virtual bool IJ() const = 0;
724
725 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
726
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000727 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000728 * (TMMBR) Temporary Max Media Bit Rate
729 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000730 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000731
732 /*
733 *
734 * return -1 on failure else 0
735 */
736 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
737
738 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000739 * (NACK)
740 */
741 virtual NACKMethod NACK() const = 0;
742
743 /*
744 * Turn negative acknowledgement requests on/off
745 *
746 * return -1 on failure else 0
747 */
748 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method) = 0;
749
750 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000751 * TODO(holmer): Propagate this API to VideoEngine.
752 * Returns the currently configured selective retransmission settings.
753 */
754 virtual int SelectiveRetransmissions() const = 0;
755
756 /*
757 * TODO(holmer): Propagate this API to VideoEngine.
758 * Sets the selective retransmission settings, which will decide which
759 * packets will be retransmitted if NACKed. Settings are constructed by
760 * combining the constants in enum RetransmissionMode with bitwise OR.
761 * All packets are retransmitted if kRetransmitAllPackets is set, while no
762 * packets are retransmitted if kRetransmitOff is set.
763 * By default all packets except FEC packets are retransmitted. For VP8
764 * with temporal scalability only base layer packets are retransmitted.
765 *
766 * Returns -1 on failure, otherwise 0.
767 */
768 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
769
770 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000771 * Send a Negative acknowledgement packet
772 *
773 * return -1 on failure else 0
774 */
775 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000776 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000777
778 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000779 * Store the sent packets, needed to answer to a Negative acknowledgement
780 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000781 *
782 * return -1 on failure else 0
783 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000784 virtual WebRtc_Word32 SetStorePacketsStatus(
785 const bool enable,
786 const WebRtc_UWord16 numberToStore = 200) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000787
788 /**************************************************************************
789 *
790 * Audio
791 *
792 ***************************************************************************/
793
794 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000795 * set audio packet size, used to determine when it's time to send a DTMF
796 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000797 *
798 * return -1 on failure else 0
799 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000800 virtual WebRtc_Word32 SetAudioPacketSize(
801 const WebRtc_UWord16 packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000802
803 /*
804 * Outband TelephoneEvent(DTMF) detection
805 *
806 * return -1 on failure else 0
807 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000808 virtual WebRtc_Word32 SetTelephoneEventStatus(
809 const bool enable,
810 const bool forwardToDecoder,
811 const bool detectEndOfTone = false) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000812
813 /*
814 * Is outband TelephoneEvent(DTMF) turned on/off?
815 */
816 virtual bool TelephoneEvent() const = 0;
817
818 /*
819 * Returns true if received DTMF events are forwarded to the decoder using
820 * the OnPlayTelephoneEvent callback.
821 */
822 virtual bool TelephoneEventForwardToDecoder() const = 0;
823
824 /*
825 * SendTelephoneEventActive
826 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000827 * return true if we currently send a telephone event and 100 ms after an
828 * event is sent used to prevent the telephone event tone to be recorded
829 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000830 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000831 virtual bool SendTelephoneEventActive(
832 WebRtc_Word8& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000833
834 /*
835 * Send a TelephoneEvent tone using RFC 2833 (4733)
836 *
837 * return -1 on failure else 0
838 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000839 virtual WebRtc_Word32 SendTelephoneEventOutband(
840 const WebRtc_UWord8 key,
841 const WebRtc_UWord16 time_ms,
842 const WebRtc_UWord8 level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000843
844 /*
845 * Set payload type for Redundant Audio Data RFC 2198
846 *
847 * return -1 on failure else 0
848 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000849 virtual WebRtc_Word32 SetSendREDPayloadType(
850 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000851
852 /*
853 * Get 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 SendREDPayloadType(
858 WebRtc_Word8& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000859
860 /*
861 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000862 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000863 *
864 * return -1 on failure else 0
865 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000866 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
867 const bool enable,
868 const WebRtc_UWord8 ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000869
870 /*
871 * Get status and ID for header-extension-for-audio-level-indication.
872 *
873 * return -1 on failure else 0
874 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000875 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
876 bool& enable,
877 WebRtc_UWord8& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000878
879 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000880 * Store the audio level in dBov for header-extension-for-audio-level-
881 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000882 * This API shall be called before transmision of an RTP packet to ensure
883 * that the |level| part of the extended RTP header is updated.
884 *
885 * return -1 on failure else 0.
886 */
887 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
888
889 /**************************************************************************
890 *
891 * Video
892 *
893 ***************************************************************************/
894
895 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000896 * Set the estimated camera delay in MS
897 *
898 * return -1 on failure else 0
899 */
900 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
901
902 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000903 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000904 */
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000905 virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000906
907 /*
908 * Turn on/off generic FEC
909 *
910 * return -1 on failure else 0
911 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000912 virtual WebRtc_Word32 SetGenericFECStatus(
913 const bool enable,
914 const WebRtc_UWord8 payloadTypeRED,
915 const WebRtc_UWord8 payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000916
917 /*
918 * Get generic FEC setting
919 *
920 * return -1 on failure else 0
921 */
922 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000923 WebRtc_UWord8& payloadTypeRED,
924 WebRtc_UWord8& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000925
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000926
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000927 virtual WebRtc_Word32 SetFecParameters(
928 const FecProtectionParams* delta_params,
929 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000930
niklase@google.com470e71d2011-07-07 08:21:25 +0000931 /*
932 * Set method for requestion a new key frame
933 *
934 * return -1 on failure else 0
935 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000936 virtual WebRtc_Word32 SetKeyFrameRequestMethod(
937 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000938
939 /*
940 * send a request for a keyframe
941 *
942 * return -1 on failure else 0
943 */
pwestin@webrtc.org5e954812012-02-10 12:13:12 +0000944 virtual WebRtc_Word32 RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000945};
946} // namespace webrtc
947#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_