blob: 08a92b3175d3dd5aa3d1b8b7041da8462422e686 [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
niklase@google.com470e71d2011-07-07 08:21:25 +000016#include "module.h"
17#include "rtp_rtcp_defines.h"
18
19namespace webrtc {
20// forward declaration
21class Transport;
22
23class RtpRtcp : public Module
24{
25public:
26 /*
pwestin@webrtc.org0644b1d2011-12-01 15:42:31 +000027 * create a RTP/RTCP module object using the system clock
niklase@google.com470e71d2011-07-07 08:21:25 +000028 *
29 * id - unique identifier of this RTP/RTCP module object
30 * audio - true for a audio version of the RTP/RTCP module object false will create a video version
31 */
32 static RtpRtcp* CreateRtpRtcp(const WebRtc_Word32 id,
33 const bool audio);
34
35 /*
pwestin@webrtc.org0644b1d2011-12-01 15:42:31 +000036 * create a RTP/RTCP module object
37 *
38 * id - unique identifier of this RTP/RTCP module object
39 * audio - true for a audio version of the RTP/RTCP module object
40 * false will create a video version
41 * clock - the clock to use to read time; must not be NULL
42 */
43 static RtpRtcp* CreateRtpRtcp(const WebRtc_Word32 id,
44 const bool audio,
45 RtpRtcpClock* clock);
46
47 /*
niklase@google.com470e71d2011-07-07 08:21:25 +000048 * destroy a RTP/RTCP module object
49 *
50 * module - object to destroy
51 */
52 static void DestroyRtpRtcp(RtpRtcp* module);
53
54 /*
niklase@google.com470e71d2011-07-07 08:21:25 +000055 * Change the unique identifier of this object
56 *
57 * id - new unique identifier of this RTP/RTCP module object
58 */
59 virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0;
60
61 /*
62 * De-muxing functionality for conferencing
63 *
64 * register a module that will act as a default module for this module
65 * used for feedback messages back to the encoder when one encoded stream
66 * is sent to multiple destinations
67 *
68 * module - default module
69 */
70 virtual WebRtc_Word32 RegisterDefaultModule(RtpRtcp* module) = 0;
71
72 /*
73 * unregister the default module
74 * will stop the demuxing feedback
75 */
76 virtual WebRtc_Word32 DeRegisterDefaultModule() = 0;
77
78 /*
79 * returns true if a default module is registered, false otherwise
80 */
81 virtual bool DefaultModuleRegistered() = 0;
82
83 /*
84 * returns number of registered child modules
85 */
86 virtual WebRtc_UWord32 NumberChildModules() = 0;
87
88 /*
89 * Lip-sync between voice-video
90 *
91 * module - audio module
92 *
93 * Note: only allowed on a video module
94 */
95 virtual WebRtc_Word32 RegisterSyncModule(RtpRtcp* module) = 0;
96
97 /*
98 * Turn off lip-sync between voice-video
99 */
100 virtual WebRtc_Word32 DeRegisterSyncModule() = 0;
101
102 /**************************************************************************
103 *
104 * Receiver functions
105 *
106 ***************************************************************************/
107
108 /*
109 * Initialize receive side
110 *
111 * return -1 on failure else 0
112 */
113 virtual WebRtc_Word32 InitReceiver() = 0;
114
115 /*
116 * Used by the module to deliver the incoming data to the codec module
117 *
118 * incomingDataCallback - callback object that will receive the incoming data
119 *
120 * return -1 on failure else 0
121 */
122 virtual WebRtc_Word32 RegisterIncomingDataCallback(RtpData* incomingDataCallback) = 0;
123
124 /*
125 * Used by the module to deliver messages to the codec module/appliation
126 *
127 * incomingMessagesCallback - callback object that will receive the incoming messages
128 *
129 * return -1 on failure else 0
130 */
131 virtual WebRtc_Word32 RegisterIncomingRTPCallback(RtpFeedback* incomingMessagesCallback) = 0;
132
133 /*
134 * configure a RTP packet timeout value
135 *
136 * RTPtimeoutMS - time in milliseconds after last received RTP packet
137 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
138 *
139 * return -1 on failure else 0
140 */
141 virtual WebRtc_Word32 SetPacketTimeout(const WebRtc_UWord32 RTPtimeoutMS,
142 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
143
144 /*
145 * Set periodic dead or alive notification
146 *
147 * enable - turn periodic dead or alive notification on/off
148 * sampleTimeSeconds - sample interval in seconds for dead or alive notifications
149 *
150 * return -1 on failure else 0
151 */
152 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(const bool enable,
153 const WebRtc_UWord8 sampleTimeSeconds) = 0;
154
155 /*
156 * Get periodic dead or alive notification status
157 *
158 * enable - periodic dead or alive notification on/off
159 * sampleTimeSeconds - sample interval in seconds for dead or alive notifications
160 *
161 * return -1 on failure else 0
162 */
163 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(bool &enable,
164 WebRtc_UWord8 &sampleTimeSeconds) = 0;
165
166 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000167 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000168 *
169 * return -1 on failure else 0
170 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000171 virtual WebRtc_Word32 RegisterReceivePayload(
172 const CodecInst& voiceCodec) = 0;
173
174 /*
175 * set video codec name and payload type
176 *
177 * return -1 on failure else 0
178 */
179 virtual WebRtc_Word32 RegisterReceivePayload(
180 const VideoCodec& videoCodec) = 0;
181
182 /*
183 * get payload type for a voice codec
184 *
185 * return -1 on failure else 0
186 */
187 virtual WebRtc_Word32 ReceivePayloadType(
188 const CodecInst& voiceCodec,
189 WebRtc_Word8* plType) = 0;
190
191 /*
192 * get payload type for a video codec
193 *
194 * return -1 on failure else 0
195 */
196 virtual WebRtc_Word32 ReceivePayloadType(
197 const VideoCodec& videoCodec,
198 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000199
200 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000201 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000202 *
203 * payloadType - payload type of codec
204 *
205 * return -1 on failure else 0
206 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000207 virtual WebRtc_Word32 DeRegisterReceivePayload(
208 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000209
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000210 /*
211 * (De)register RTP header extension type and id.
212 *
213 * return -1 on failure else 0
214 */
215 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
216 const RTPExtensionType type,
217 const WebRtc_UWord8 id) = 0;
218
219 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
220 const RTPExtensionType type) = 0;
221
niklase@google.com470e71d2011-07-07 08:21:25 +0000222 /*
223 * Get last received remote timestamp
224 */
225 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
226
227 /*
228 * Get the current estimated remote timestamp
229 *
230 * timestamp - estimated timestamp
231 *
232 * return -1 on failure else 0
233 */
234 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(WebRtc_UWord32& timestamp) const = 0;
235
236 /*
237 * Get incoming SSRC
238 */
239 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
240
241 /*
242 * Get remote CSRC
243 *
244 * arrOfCSRC - array that will receive the CSRCs
245 *
246 * return -1 on failure else the number of valid entries in the list
247 */
248 virtual WebRtc_Word32 RemoteCSRCs( WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
249
250 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000251 * get the currently configured SSRC filter
252 *
253 * allowedSSRC - SSRC that will be allowed through
254 *
255 * return -1 on failure else 0
256 */
257 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
258
259 /*
260 * set a SSRC to be used as a filter for incoming RTP streams
261 *
262 * allowedSSRC - SSRC that will be allowed through
263 *
264 * return -1 on failure else 0
265 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000266 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
267 const WebRtc_UWord32 allowedSSRC) = 0;
268
269 /*
270 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
271 */
272 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
273 const WebRtc_UWord32 SSRC) = 0;
274
275 /*
276 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
277 */
278 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
279 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000280
281 /*
282 * called by the network module when we receive a packet
283 *
284 * incomingPacket - incoming packet buffer
285 * packetLength - length of incoming buffer
286 *
287 * return -1 on failure else 0
288 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000289 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
290 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000291
292
293 /*
294 * Option when not using the RegisterSyncModule function
295 *
296 * Inform the module about the received audion NTP
297 *
298 * return -1 on failure else 0
299 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000300 virtual WebRtc_Word32 IncomingAudioNTP(
301 const WebRtc_UWord32 audioReceivedNTPsecs,
302 const WebRtc_UWord32 audioReceivedNTPfrac,
303 const WebRtc_UWord32 audioRTCPArrivalTimeSecs,
304 const WebRtc_UWord32 audioRTCPArrivalTimeFrac) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000305
306 /**************************************************************************
307 *
308 * Sender
309 *
310 ***************************************************************************/
311
312 /*
313 * Initialize send side
314 *
315 * return -1 on failure else 0
316 */
317 virtual WebRtc_Word32 InitSender() = 0;
318
319 /*
320 * Used by the module to send RTP and RTCP packet to the network module
321 *
322 * outgoingTransport - transport object that will be called when packets are ready to be sent out on the network
323 *
324 * return -1 on failure else 0
325 */
326 virtual WebRtc_Word32 RegisterSendTransport(Transport* outgoingTransport) = 0;
327
328 /*
329 * set MTU
330 *
331 * size - Max transfer unit in bytes, default is 1500
332 *
333 * return -1 on failure else 0
334 */
335 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
336
337 /*
338 * set transtport overhead
339 * default is IPv4 and UDP with no encryption
340 *
341 * TCP - true for TCP false UDP
342 * IPv6 - true for IP version 6 false for version 4
343 * authenticationOverhead - number of bytes to leave for an authentication header
344 *
345 * return -1 on failure else 0
346 */
347 virtual WebRtc_Word32 SetTransportOverhead(const bool TCP,
348 const bool IPV6,
349 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
350
351 /*
352 * Get max payload length
353 *
354 * A combination of the configuration MaxTransferUnit and TransportOverhead.
355 * Does not account FEC/ULP/RED overhead if FEC is enabled.
356 * Does not account for RTP headers
357 */
358 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
359
360 /*
361 * Get max data payload length
362 *
363 * A combination of the configuration MaxTransferUnit, headers and TransportOverhead.
364 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
365 * Takes into account RTP headers
366 */
367 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
368
369 /*
370 * set RTPKeepaliveStatus
371 *
372 * enable - on/off
373 * unknownPayloadType - payload type to use for RTP keepalive
374 * deltaTransmitTimeMS - delta time between RTP keepalive packets
375 *
376 * return -1 on failure else 0
377 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000378 virtual WebRtc_Word32 SetRTPKeepaliveStatus(
379 const bool enable,
380 const WebRtc_Word8 unknownPayloadType,
381 const WebRtc_UWord16 deltaTransmitTimeMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000382
383 /*
384 * Get RTPKeepaliveStatus
385 *
386 * enable - on/off
387 * unknownPayloadType - payload type in use for RTP keepalive
388 * deltaTransmitTimeMS - delta time between RTP keepalive packets
389 *
390 * return -1 on failure else 0
391 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000392 virtual WebRtc_Word32 RTPKeepaliveStatus(
393 bool* enable,
394 WebRtc_Word8* unknownPayloadType,
395 WebRtc_UWord16* deltaTransmitTimeMS) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000396
397 /*
398 * check if RTPKeepaliveStatus is enabled
399 */
400 virtual bool RTPKeepalive() const = 0;
401
402 /*
403 * set codec name and payload type
404 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000405 * return -1 on failure else 0
406 */
407 virtual WebRtc_Word32 RegisterSendPayload(
408 const CodecInst& voiceCodec) = 0;
409
410 /*
411 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000412 *
413 * return -1 on failure else 0
414 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000415 virtual WebRtc_Word32 RegisterSendPayload(
416 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000417
418 /*
419 * Unregister a send payload
420 *
421 * payloadType - payload type of codec
422 *
423 * return -1 on failure else 0
424 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000425 virtual WebRtc_Word32 DeRegisterSendPayload(
426 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000427
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000428 /*
429 * (De)register RTP header extension type and id.
430 *
431 * return -1 on failure else 0
432 */
433 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
434 const RTPExtensionType type,
435 const WebRtc_UWord8 id) = 0;
436
437 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
438 const RTPExtensionType type) = 0;
439
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000440 /*
441 * Enable/disable traffic smoothing of sending stream.
442 */
443 virtual void SetTransmissionSmoothingStatus(const bool enable) = 0;
444
445 virtual bool TransmissionSmoothingStatus() const = 0;
446
niklase@google.com470e71d2011-07-07 08:21:25 +0000447 /*
448 * get start timestamp
449 */
450 virtual WebRtc_UWord32 StartTimestamp() const = 0;
451
452 /*
453 * configure start timestamp, default is a random number
454 *
455 * timestamp - start timestamp
456 *
457 * return -1 on failure else 0
458 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000459 virtual WebRtc_Word32 SetStartTimestamp(
460 const WebRtc_UWord32 timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000461
462 /*
463 * Get SequenceNumber
464 */
465 virtual WebRtc_UWord16 SequenceNumber() const = 0;
466
467 /*
468 * Set SequenceNumber, default is a random number
469 *
470 * return -1 on failure else 0
471 */
472 virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
473
474 /*
475 * Get SSRC
476 */
477 virtual WebRtc_UWord32 SSRC() const = 0;
478
479 /*
480 * configure SSRC, default is a random number
481 *
482 * return -1 on failure else 0
483 */
484 virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
485
486 /*
487 * Get CSRC
488 *
489 * arrOfCSRC - array of CSRCs
490 *
491 * return -1 on failure else number of valid entries in the array
492 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000493 virtual WebRtc_Word32 CSRCs(
494 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000495
496 /*
497 * Set CSRC
498 *
499 * arrOfCSRC - array of CSRCs
500 * arrLength - number of valid entries in the array
501 *
502 * return -1 on failure else 0
503 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000504 virtual WebRtc_Word32 SetCSRCs(
505 const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
506 const WebRtc_UWord8 arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000507
508 /*
509 * includes CSRCs in RTP header if enabled
510 *
511 * include CSRC - on/off
512 *
513 * default:on
514 *
515 * return -1 on failure else 0
516 */
517 virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
518
519 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000520 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
521 */
522 virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
523 const bool setSSRC,
524 const WebRtc_UWord32 SSRC) = 0;
525
526
527 /*
528 * Get status of sending RTX (RFC 4588) on a specific SSRC.
529 */
530 virtual WebRtc_Word32 RTXSendStatus(bool* enable,
531 WebRtc_UWord32* SSRC) const = 0;
532
533 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000534 * sends kRtcpByeCode when going from true to false
535 *
536 * sending - on/off
537 *
538 * return -1 on failure else 0
539 */
540 virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
541
542 /*
543 * get send status
544 */
545 virtual bool Sending() const = 0;
546
547 /*
548 * Starts/Stops media packets, on by default
549 *
550 * sending - on/off
551 *
552 * return -1 on failure else 0
553 */
554 virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
555
556 /*
557 * get send status
558 */
559 virtual bool SendingMedia() const = 0;
560
561 /*
562 * get sent bitrate in Kbit/s
563 */
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000564 virtual void BitrateSent(WebRtc_UWord32* totalRate,
stefan@webrtc.orgfbea4e52011-10-27 16:08:29 +0000565 WebRtc_UWord32* videoRate,
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000566 WebRtc_UWord32* fecRate,
567 WebRtc_UWord32* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000568
569 /*
570 * Used by the codec module to deliver a video or audio frame for packetization
571 *
572 * frameType - type of frame to send
573 * payloadType - payload type of frame to send
574 * timestamp - timestamp of frame to send
575 * payloadData - payload buffer of frame to send
576 * payloadSize - size of payload buffer to send
577 * fragmentation - fragmentation offset data for fragmented frames such as layers or RED
578 *
579 * return -1 on failure else 0
580 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000581 virtual WebRtc_Word32 SendOutgoingData(
582 const FrameType frameType,
583 const WebRtc_Word8 payloadType,
584 const WebRtc_UWord32 timeStamp,
585 const WebRtc_UWord8* payloadData,
586 const WebRtc_UWord32 payloadSize,
587 const RTPFragmentationHeader* fragmentation = NULL,
588 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000589
590 /**************************************************************************
591 *
592 * RTCP
593 *
594 ***************************************************************************/
595
596 /*
597 * RegisterIncomingRTCPCallback
598 *
599 * incomingMessagesCallback - callback object that will receive messages from RTCP
600 *
601 * return -1 on failure else 0
602 */
603 virtual WebRtc_Word32 RegisterIncomingRTCPCallback(RtcpFeedback* incomingMessagesCallback) = 0;
604
605 /*
606 * Get RTCP status
607 */
608 virtual RTCPMethod RTCP() const = 0;
609
610 /*
611 * configure RTCP status i.e on(compound or non- compound)/off
612 *
613 * method - RTCP method to use
614 *
615 * return -1 on failure else 0
616 */
617 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
618
619 /*
620 * Set RTCP CName (i.e unique identifier)
621 *
622 * return -1 on failure else 0
623 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000624 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000625
626 /*
627 * Get RTCP CName (i.e unique identifier)
628 *
629 * return -1 on failure else 0
630 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000631 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000632
633 /*
634 * Get remote CName
635 *
636 * return -1 on failure else 0
637 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000638 virtual WebRtc_Word32 RemoteCNAME(
639 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000640 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000641
642 /*
643 * Get remote NTP
644 *
645 * return -1 on failure else 0
646 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000647 virtual WebRtc_Word32 RemoteNTP(
648 WebRtc_UWord32 *ReceivedNTPsecs,
649 WebRtc_UWord32 *ReceivedNTPfrac,
650 WebRtc_UWord32 *RTCPArrivalTimeSecs,
651 WebRtc_UWord32 *RTCPArrivalTimeFrac) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000652
653 /*
654 * AddMixedCNAME
655 *
656 * return -1 on failure else 0
657 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000658 virtual WebRtc_Word32 AddMixedCNAME(
659 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000660 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000661
662 /*
663 * RemoveMixedCNAME
664 *
665 * return -1 on failure else 0
666 */
667 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
668
669 /*
670 * Get RoundTripTime
671 *
672 * return -1 on failure else 0
673 */
674 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000675 WebRtc_UWord16* RTT,
676 WebRtc_UWord16* avgRTT,
677 WebRtc_UWord16* minRTT,
678 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000679
680 /*
681 * Reset RoundTripTime statistics
682 *
683 * return -1 on failure else 0
684 */
685 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
686
687 /*
688 * Force a send of a RTCP packet
689 * normal SR and RR are triggered via the process function
690 *
691 * return -1 on failure else 0
692 */
693 virtual WebRtc_Word32 SendRTCP(WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
694
695 /*
696 * Good state of RTP receiver inform sender
697 */
698 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(const WebRtc_UWord64 pictureID) = 0;
699
700 /*
701 * Send a RTCP Slice Loss Indication (SLI)
702 * 6 least significant bits of pictureID
703 */
704 virtual WebRtc_Word32 SendRTCPSliceLossIndication(const WebRtc_UWord8 pictureID) = 0;
705
706 /*
707 * Reset RTP statistics
708 *
709 * return -1 on failure else 0
710 */
711 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
712
713 /*
714 * statistics of our localy created statistics of the received RTP stream
715 *
716 * return -1 on failure else 0
717 */
718 virtual WebRtc_Word32 StatisticsRTP(WebRtc_UWord8 *fraction_lost, // scale 0 to 255
719 WebRtc_UWord32 *cum_lost, // number of lost packets
720 WebRtc_UWord32 *ext_max, // highest sequence number received
721 WebRtc_UWord32 *jitter,
722 WebRtc_UWord32 *max_jitter = NULL) const = 0;
723
724 /*
725 * Reset RTP data counters for the receiving side
726 *
727 * return -1 on failure else 0
728 */
729 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
730
731 /*
732 * Reset RTP data counters for the sending side
733 *
734 * return -1 on failure else 0
735 */
736 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
737
738 /*
739 * statistics of the amount of data sent and received
740 *
741 * return -1 on failure else 0
742 */
743 virtual WebRtc_Word32 DataCountersRTP(WebRtc_UWord32 *bytesSent,
744 WebRtc_UWord32 *packetsSent,
745 WebRtc_UWord32 *bytesReceived,
746 WebRtc_UWord32 *packetsReceived) const = 0;
747 /*
748 * Get received RTCP sender info
749 *
750 * return -1 on failure else 0
751 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000752 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000753
754 /*
755 * Get received RTCP report block
756 *
757 * return -1 on failure else 0
758 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000759 virtual WebRtc_Word32 RemoteRTCPStat(
760 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000761 /*
762 * Set received RTCP report block
763 *
764 * return -1 on failure else 0
765 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000766 virtual WebRtc_Word32 AddRTCPReportBlock(
767 const WebRtc_UWord32 SSRC,
768 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000769
770 /*
771 * RemoveRTCPReportBlock
772 *
773 * return -1 on failure else 0
774 */
775 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
776
777 /*
778 * (APP) Application specific data
779 *
780 * return -1 on failure else 0
781 */
782 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(const WebRtc_UWord8 subType,
783 const WebRtc_UWord32 name,
784 const WebRtc_UWord8* data,
785 const WebRtc_UWord16 length) = 0;
786 /*
787 * (XR) VOIP metric
788 *
789 * return -1 on failure else 0
790 */
791 virtual WebRtc_Word32 SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) = 0;
792
793 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000794 * (REMB) Receiver Estimated Max Bitrate
795 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000796 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000797
798 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
799
800 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
801 const WebRtc_UWord8 numberOfSSRC,
802 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000803
mflodman@webrtc.org84dc3d12011-12-22 10:26:13 +0000804 // Registers an observer to call when the estimate of the incoming channel
805 // changes.
806 virtual bool SetRemoteBitrateObserver(
807 RtpRemoteBitrateObserver* observer) = 0;
808
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000809 /*
810 * (IJ) Extended jitter report.
811 */
812 virtual bool IJ() const = 0;
813
814 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
815
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000816 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000817 * (TMMBR) Temporary Max Media Bit Rate
818 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000819 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000820
821 /*
822 *
823 * return -1 on failure else 0
824 */
825 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
826
827 /*
828 * local bw estimation changed
829 *
830 * for video called by internal estimator
831 * for audio (iSAC) called by engine, geting the data from the decoder
832 */
833 virtual void OnBandwidthEstimateUpdate(WebRtc_UWord16 bandWidthKbit) = 0;
834
835 /*
836 * (NACK)
837 */
838 virtual NACKMethod NACK() const = 0;
839
840 /*
841 * Turn negative acknowledgement requests on/off
842 *
843 * return -1 on failure else 0
844 */
845 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method) = 0;
846
847 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000848 * TODO(holmer): Propagate this API to VideoEngine.
849 * Returns the currently configured selective retransmission settings.
850 */
851 virtual int SelectiveRetransmissions() const = 0;
852
853 /*
854 * TODO(holmer): Propagate this API to VideoEngine.
855 * Sets the selective retransmission settings, which will decide which
856 * packets will be retransmitted if NACKed. Settings are constructed by
857 * combining the constants in enum RetransmissionMode with bitwise OR.
858 * All packets are retransmitted if kRetransmitAllPackets is set, while no
859 * packets are retransmitted if kRetransmitOff is set.
860 * By default all packets except FEC packets are retransmitted. For VP8
861 * with temporal scalability only base layer packets are retransmitted.
862 *
863 * Returns -1 on failure, otherwise 0.
864 */
865 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
866
867 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000868 * Send a Negative acknowledgement packet
869 *
870 * return -1 on failure else 0
871 */
872 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000873 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000874
875 /*
876 * Store the sent packets, needed to answer to a Negative acknowledgement requests
877 *
878 * return -1 on failure else 0
879 */
880 virtual WebRtc_Word32 SetStorePacketsStatus(const bool enable, const WebRtc_UWord16 numberToStore = 200) = 0;
881
882 /**************************************************************************
883 *
884 * Audio
885 *
886 ***************************************************************************/
887
888 /*
889 * RegisterAudioCallback
890 *
891 * return -1 on failure else 0
892 */
893 virtual WebRtc_Word32 RegisterAudioCallback(RtpAudioFeedback* messagesCallback) = 0;
894
895 /*
896 * set audio packet size, used to determine when it's time to send a DTMF packet in silence (CNG)
897 *
898 * return -1 on failure else 0
899 */
900 virtual WebRtc_Word32 SetAudioPacketSize(const WebRtc_UWord16 packetSizeSamples) = 0;
901
902 /*
903 * Outband TelephoneEvent(DTMF) detection
904 *
905 * return -1 on failure else 0
906 */
907 virtual WebRtc_Word32 SetTelephoneEventStatus(const bool enable,
908 const bool forwardToDecoder,
909 const bool detectEndOfTone = false) = 0;
910
911 /*
912 * Is outband TelephoneEvent(DTMF) turned on/off?
913 */
914 virtual bool TelephoneEvent() const = 0;
915
916 /*
917 * Returns true if received DTMF events are forwarded to the decoder using
918 * the OnPlayTelephoneEvent callback.
919 */
920 virtual bool TelephoneEventForwardToDecoder() const = 0;
921
922 /*
923 * SendTelephoneEventActive
924 *
925 * return true if we currently send a telephone event and 100 ms after an event is sent
926 * used to prevent teh telephone event tone to be recorded by the microphone and send inband
927 * just after the tone has ended
928 */
929 virtual bool SendTelephoneEventActive(WebRtc_Word8& telephoneEvent) const = 0;
930
931 /*
932 * Send a TelephoneEvent tone using RFC 2833 (4733)
933 *
934 * return -1 on failure else 0
935 */
936 virtual WebRtc_Word32 SendTelephoneEventOutband(const WebRtc_UWord8 key,
937 const WebRtc_UWord16 time_ms,
938 const WebRtc_UWord8 level) = 0;
939
940 /*
941 * Set payload type for Redundant Audio Data RFC 2198
942 *
943 * return -1 on failure else 0
944 */
945 virtual WebRtc_Word32 SetSendREDPayloadType(const WebRtc_Word8 payloadType) = 0;
946
947 /*
948 * Get payload type for Redundant Audio Data RFC 2198
949 *
950 * return -1 on failure else 0
951 */
952 virtual WebRtc_Word32 SendREDPayloadType(WebRtc_Word8& payloadType) const = 0;
953
954 /*
955 * Set status and ID for header-extension-for-audio-level-indication.
956 * See https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
957 * for more details.
958 *
959 * return -1 on failure else 0
960 */
961 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(const bool enable,
962 const WebRtc_UWord8 ID) = 0;
963
964 /*
965 * Get status and ID for header-extension-for-audio-level-indication.
966 *
967 * return -1 on failure else 0
968 */
969 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(bool& enable,
970 WebRtc_UWord8& ID) const = 0;
971
972 /*
973 * Store the audio level in dBov for header-extension-for-audio-level-indication.
974 * This API shall be called before transmision of an RTP packet to ensure
975 * that the |level| part of the extended RTP header is updated.
976 *
977 * return -1 on failure else 0.
978 */
979 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
980
981 /**************************************************************************
982 *
983 * Video
984 *
985 ***************************************************************************/
986
987 /*
988 * Register a callback object that will receive callbacks for video related events
989 * such as an incoming key frame request.
990 *
991 * return -1 on failure else 0
992 */
993 virtual WebRtc_Word32 RegisterIncomingVideoCallback(RtpVideoFeedback* incomingMessagesCallback) = 0;
994
995 /*
996 * Set the estimated camera delay in MS
997 *
998 * return -1 on failure else 0
999 */
1000 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
1001
1002 /*
1003 * Set the start and max send bitrate
1004 * used by the bandwidth management
1005 *
1006 * Not calling this or setting startBitrateKbit to 0 disables the bandwidth management
1007 *
1008 * minBitrateKbit = 0 equals no min bitrate
1009 * maxBitrateKbit = 0 equals no max bitrate
1010 *
1011 * return -1 on failure else 0
1012 */
1013 virtual WebRtc_Word32 SetSendBitrate(const WebRtc_UWord32 startBitrate,
1014 const WebRtc_UWord16 minBitrateKbit,
1015 const WebRtc_UWord16 maxBitrateKbit) = 0;
1016
1017 /*
1018 * Turn on/off generic FEC
1019 *
1020 * return -1 on failure else 0
1021 */
1022 virtual WebRtc_Word32 SetGenericFECStatus(const bool enable,
1023 const WebRtc_UWord8 payloadTypeRED,
1024 const WebRtc_UWord8 payloadTypeFEC) = 0;
1025
1026 /*
1027 * Get generic FEC setting
1028 *
1029 * return -1 on failure else 0
1030 */
1031 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
1032 WebRtc_UWord8& payloadTypeRED,
1033 WebRtc_UWord8& payloadTypeFEC) = 0;
1034
marpan@google.com80c5d7a2011-07-15 21:32:40 +00001035
niklase@google.com470e71d2011-07-07 08:21:25 +00001036 /*
1037 * Set FEC code rate of key and delta frames
1038 * codeRate on a scale of 0 to 255 where 255 is 100% added packets, hence protect up to 50% packet loss
1039 *
1040 * return -1 on failure else 0
1041 */
1042 virtual WebRtc_Word32 SetFECCodeRate(const WebRtc_UWord8 keyFrameCodeRate,
1043 const WebRtc_UWord8 deltaFrameCodeRate) = 0;
1044
marpan@google.com80c5d7a2011-07-15 21:32:40 +00001045
1046 /*
1047 * Set FEC unequal protection (UEP) across packets,
1048 * for key and delta frames.
1049 *
1050 * If keyUseUepProtection is true UEP is enabled for key frames.
1051 * If deltaUseUepProtection is true UEP is enabled for delta frames.
1052 *
1053 * UEP skews the FEC protection towards being spent more on the
1054 * important packets, at the cost of less FEC protection for the
1055 * non-important packets.
1056 *
1057 * return -1 on failure else 0
1058 */
1059 virtual WebRtc_Word32 SetFECUepProtection(const bool keyUseUepProtection,
1060 const bool deltaUseUepProtection) = 0;
1061
1062
niklase@google.com470e71d2011-07-07 08:21:25 +00001063 /*
1064 * Set method for requestion a new key frame
1065 *
1066 * return -1 on failure else 0
1067 */
1068 virtual WebRtc_Word32 SetKeyFrameRequestMethod(const KeyFrameRequestMethod method) = 0;
1069
1070 /*
1071 * send a request for a keyframe
1072 *
1073 * return -1 on failure else 0
1074 */
1075 virtual WebRtc_Word32 RequestKeyFrame(const FrameType frameType = kVideoFrameKey) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +00001076};
1077} // namespace webrtc
1078#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_