blob: 5836705e7f409d368947bb0d9431e8f00a49ebee [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 {
20// forward declaration
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000021class RemoteBitrateEstimator;
22class RemoteBitrateObserver;
niklase@google.com470e71d2011-07-07 08:21:25 +000023class Transport;
24
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000025class RtpRtcp : public Module {
26 public:
27 struct Configuration {
28 Configuration()
29 : id(-1),
30 audio(false),
31 clock(NULL),
32 default_module(NULL),
33 incoming_data(NULL),
34 incoming_messages(NULL),
35 outgoing_transport(NULL),
36 rtcp_feedback(NULL),
37 intra_frame_callback(NULL),
38 bandwidth_callback(NULL),
39 audio_messages(NULL),
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000040 remote_bitrate_estimator(NULL) {
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000041 }
42 /* id - Unique identifier of this RTP/RTCP module object
43 * audio - True for a audio version of the RTP/RTCP module
44 * object false will create a video version
45 * clock - The clock to use to read time. If NULL object
46 * will be using the system clock.
47 * incoming_data - Callback object that will receive the incoming
48 * data
49 * incoming_messages - Callback object that will receive the incoming
50 * RTP messages.
51 * outgoing_transport - Transport object that will be called when packets
52 * are ready to be sent out on the network
53 * rtcp_feedback - Callback object that will receive the incoming
54 * RTP messages.
55 * intra_frame_callback - Called when the receiver request a intra frame.
56 * bandwidth_callback - Called when we receive a changed estimate from
57 * the receiver of out stream.
58 * audio_messages - Telehone events.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000059 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
60 * streams from the same client.
niklase@google.com470e71d2011-07-07 08:21:25 +000061 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000062 int32_t id;
63 bool audio;
64 RtpRtcpClock* clock;
65 RtpRtcp* default_module;
66 RtpData* incoming_data;
67 RtpFeedback* incoming_messages;
68 Transport* outgoing_transport;
69 RtcpFeedback* rtcp_feedback;
70 RtcpIntraFrameObserver* intra_frame_callback;
71 RtcpBandwidthObserver* bandwidth_callback;
72 RtpAudioFeedback* audio_messages;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000073 RemoteBitrateEstimator* remote_bitrate_estimator;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000074 };
75 /*
76 * Create a RTP/RTCP module object using the system clock.
77 *
78 * configuration - Configuration of the RTP/RTCP module.
79 */
80 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000081
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000082 /**************************************************************************
83 *
84 * Receiver functions
85 *
86 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000087
88 /*
89 * configure a RTP packet timeout value
90 *
91 * RTPtimeoutMS - time in milliseconds after last received RTP packet
92 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
93 *
94 * return -1 on failure else 0
95 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000096 virtual WebRtc_Word32 SetPacketTimeout(
97 const WebRtc_UWord32 RTPtimeoutMS,
98 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000099
100 /*
101 * Set periodic dead or alive notification
102 *
103 * enable - turn periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000104 * sampleTimeSeconds - sample interval in seconds for dead or alive
105 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000106 *
107 * return -1 on failure else 0
108 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000109 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
110 const bool enable,
111 const WebRtc_UWord8 sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000112
113 /*
114 * Get periodic dead or alive notification status
115 *
116 * enable - periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000117 * sampleTimeSeconds - sample interval in seconds for dead or alive
118 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000119 *
120 * return -1 on failure else 0
121 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000122 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
123 bool& enable,
124 WebRtc_UWord8& sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000125
126 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000127 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000128 *
129 * return -1 on failure else 0
130 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000131 virtual WebRtc_Word32 RegisterReceivePayload(
132 const CodecInst& voiceCodec) = 0;
133
134 /*
135 * set video codec name and payload type
136 *
137 * return -1 on failure else 0
138 */
139 virtual WebRtc_Word32 RegisterReceivePayload(
140 const VideoCodec& videoCodec) = 0;
141
142 /*
143 * get payload type for a voice codec
144 *
145 * return -1 on failure else 0
146 */
147 virtual WebRtc_Word32 ReceivePayloadType(
148 const CodecInst& voiceCodec,
149 WebRtc_Word8* plType) = 0;
150
151 /*
152 * get payload type for a video codec
153 *
154 * return -1 on failure else 0
155 */
156 virtual WebRtc_Word32 ReceivePayloadType(
157 const VideoCodec& videoCodec,
158 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000159
160 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000161 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000162 *
163 * payloadType - payload type of codec
164 *
165 * return -1 on failure else 0
166 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000167 virtual WebRtc_Word32 DeRegisterReceivePayload(
168 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000169
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000170 /*
171 * (De)register RTP header extension type and id.
172 *
173 * return -1 on failure else 0
174 */
175 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
176 const RTPExtensionType type,
177 const WebRtc_UWord8 id) = 0;
178
179 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
180 const RTPExtensionType type) = 0;
181
niklase@google.com470e71d2011-07-07 08:21:25 +0000182 /*
183 * Get last received remote timestamp
184 */
185 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
186
187 /*
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000188 * Get the local time of the last received remote timestamp
189 */
190 virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0;
191
192 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000193 * Get the current estimated remote timestamp
194 *
195 * timestamp - estimated timestamp
196 *
197 * return -1 on failure else 0
198 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000199 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
200 WebRtc_UWord32& timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000201
202 /*
203 * Get incoming SSRC
204 */
205 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
206
207 /*
208 * Get remote CSRC
209 *
210 * arrOfCSRC - array that will receive the CSRCs
211 *
212 * return -1 on failure else the number of valid entries in the list
213 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000214 virtual WebRtc_Word32 RemoteCSRCs(
215 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000216
217 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000218 * get the currently configured SSRC filter
219 *
220 * allowedSSRC - SSRC that will be allowed through
221 *
222 * return -1 on failure else 0
223 */
224 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
225
226 /*
227 * set a SSRC to be used as a filter for incoming RTP streams
228 *
229 * allowedSSRC - SSRC that will be allowed through
230 *
231 * return -1 on failure else 0
232 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000233 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
234 const WebRtc_UWord32 allowedSSRC) = 0;
235
236 /*
237 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
238 */
239 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
240 const WebRtc_UWord32 SSRC) = 0;
241
242 /*
243 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
244 */
245 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
246 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000247
248 /*
249 * called by the network module when we receive a packet
250 *
251 * incomingPacket - incoming packet buffer
252 * packetLength - length of incoming buffer
253 *
254 * return -1 on failure else 0
255 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000256 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
257 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000258
niklase@google.com470e71d2011-07-07 08:21:25 +0000259 /**************************************************************************
260 *
261 * Sender
262 *
263 ***************************************************************************/
264
265 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000266 * set MTU
267 *
268 * size - Max transfer unit in bytes, default is 1500
269 *
270 * return -1 on failure else 0
271 */
272 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
273
274 /*
275 * set transtport overhead
276 * default is IPv4 and UDP with no encryption
277 *
278 * TCP - true for TCP false UDP
279 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000280 * authenticationOverhead - number of bytes to leave for an
281 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000282 *
283 * return -1 on failure else 0
284 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000285 virtual WebRtc_Word32 SetTransportOverhead(
286 const bool TCP,
287 const bool IPV6,
288 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000289
290 /*
291 * Get max payload length
292 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000293 * A combination of the configuration MaxTransferUnit and
294 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000295 * Does not account FEC/ULP/RED overhead if FEC is enabled.
296 * Does not account for RTP headers
297 */
298 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
299
300 /*
301 * Get max data payload length
302 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000303 * A combination of the configuration MaxTransferUnit, headers and
304 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000305 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
306 * Takes into account RTP headers
307 */
308 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
309
310 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000311 * set codec name and payload type
312 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000313 * return -1 on failure else 0
314 */
315 virtual WebRtc_Word32 RegisterSendPayload(
316 const CodecInst& voiceCodec) = 0;
317
318 /*
319 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000320 *
321 * return -1 on failure else 0
322 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000323 virtual WebRtc_Word32 RegisterSendPayload(
324 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000325
326 /*
327 * Unregister a send payload
328 *
329 * payloadType - payload type of codec
330 *
331 * return -1 on failure else 0
332 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000333 virtual WebRtc_Word32 DeRegisterSendPayload(
334 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000335
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000336 /*
337 * (De)register RTP header extension type and id.
338 *
339 * return -1 on failure else 0
340 */
341 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
342 const RTPExtensionType type,
343 const WebRtc_UWord8 id) = 0;
344
345 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
346 const RTPExtensionType type) = 0;
347
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000348 /*
349 * Enable/disable traffic smoothing of sending stream.
350 */
351 virtual void SetTransmissionSmoothingStatus(const bool enable) = 0;
352
353 virtual bool TransmissionSmoothingStatus() const = 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
506 /**************************************************************************
507 *
508 * RTCP
509 *
510 ***************************************************************************/
511
512 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000513 * Get RTCP status
514 */
515 virtual RTCPMethod RTCP() const = 0;
516
517 /*
518 * configure RTCP status i.e on(compound or non- compound)/off
519 *
520 * method - RTCP method to use
521 *
522 * return -1 on failure else 0
523 */
524 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
525
526 /*
527 * Set RTCP CName (i.e unique identifier)
528 *
529 * return -1 on failure else 0
530 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000531 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000532
533 /*
534 * Get RTCP CName (i.e unique identifier)
535 *
536 * return -1 on failure else 0
537 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000538 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000539
540 /*
541 * Get remote CName
542 *
543 * return -1 on failure else 0
544 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000545 virtual WebRtc_Word32 RemoteCNAME(
546 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000547 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000548
549 /*
550 * Get remote NTP
551 *
552 * return -1 on failure else 0
553 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000554 virtual WebRtc_Word32 RemoteNTP(
555 WebRtc_UWord32 *ReceivedNTPsecs,
556 WebRtc_UWord32 *ReceivedNTPfrac,
557 WebRtc_UWord32 *RTCPArrivalTimeSecs,
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000558 WebRtc_UWord32 *RTCPArrivalTimeFrac,
559 WebRtc_UWord32 *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000560
561 /*
562 * AddMixedCNAME
563 *
564 * return -1 on failure else 0
565 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000566 virtual WebRtc_Word32 AddMixedCNAME(
567 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000568 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000569
570 /*
571 * RemoveMixedCNAME
572 *
573 * return -1 on failure else 0
574 */
575 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
576
577 /*
578 * Get RoundTripTime
579 *
580 * return -1 on failure else 0
581 */
582 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000583 WebRtc_UWord16* RTT,
584 WebRtc_UWord16* avgRTT,
585 WebRtc_UWord16* minRTT,
586 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000587
588 /*
589 * Reset RoundTripTime statistics
590 *
591 * return -1 on failure else 0
592 */
593 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
594
595 /*
596 * Force a send of a RTCP packet
597 * normal SR and RR are triggered via the process function
598 *
599 * return -1 on failure else 0
600 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000601 virtual WebRtc_Word32 SendRTCP(
602 WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000603
604 /*
605 * Good state of RTP receiver inform sender
606 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000607 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
608 const WebRtc_UWord64 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000609
610 /*
611 * Send a RTCP Slice Loss Indication (SLI)
612 * 6 least significant bits of pictureID
613 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000614 virtual WebRtc_Word32 SendRTCPSliceLossIndication(
615 const WebRtc_UWord8 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000616
617 /*
618 * Reset RTP statistics
619 *
620 * return -1 on failure else 0
621 */
622 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
623
624 /*
625 * statistics of our localy created statistics of the received RTP stream
626 *
627 * return -1 on failure else 0
628 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000629 virtual WebRtc_Word32 StatisticsRTP(
630 WebRtc_UWord8* fraction_lost, // scale 0 to 255
631 WebRtc_UWord32* cum_lost, // number of lost packets
632 WebRtc_UWord32* ext_max, // highest sequence number received
633 WebRtc_UWord32* jitter,
634 WebRtc_UWord32* max_jitter = NULL) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000635
636 /*
637 * Reset RTP data counters for the receiving side
638 *
639 * return -1 on failure else 0
640 */
641 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
642
643 /*
644 * Reset RTP data counters for the sending side
645 *
646 * return -1 on failure else 0
647 */
648 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
649
650 /*
651 * statistics of the amount of data sent and received
652 *
653 * return -1 on failure else 0
654 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000655 virtual WebRtc_Word32 DataCountersRTP(
656 WebRtc_UWord32* bytesSent,
657 WebRtc_UWord32* packetsSent,
658 WebRtc_UWord32* bytesReceived,
659 WebRtc_UWord32* packetsReceived) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000660 /*
661 * Get received RTCP sender info
662 *
663 * return -1 on failure else 0
664 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000665 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000666
667 /*
668 * Get received RTCP report block
669 *
670 * return -1 on failure else 0
671 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000672 virtual WebRtc_Word32 RemoteRTCPStat(
673 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000674 /*
675 * Set received RTCP report block
676 *
677 * return -1 on failure else 0
678 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000679 virtual WebRtc_Word32 AddRTCPReportBlock(
680 const WebRtc_UWord32 SSRC,
681 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000682
683 /*
684 * RemoveRTCPReportBlock
685 *
686 * return -1 on failure else 0
687 */
688 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
689
690 /*
691 * (APP) Application specific data
692 *
693 * return -1 on failure else 0
694 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000695 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
696 const WebRtc_UWord8 subType,
697 const WebRtc_UWord32 name,
698 const WebRtc_UWord8* data,
699 const WebRtc_UWord16 length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000700 /*
701 * (XR) VOIP metric
702 *
703 * return -1 on failure else 0
704 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000705 virtual WebRtc_Word32 SetRTCPVoIPMetrics(
706 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000707
708 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000709 * (REMB) Receiver Estimated Max Bitrate
710 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000711 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000712
713 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
714
715 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
716 const WebRtc_UWord8 numberOfSSRC,
717 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000718
719 /*
720 * (IJ) Extended jitter report.
721 */
722 virtual bool IJ() const = 0;
723
724 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
725
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000726 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000727 * (TMMBR) Temporary Max Media Bit Rate
728 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000729 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000730
731 /*
732 *
733 * return -1 on failure else 0
734 */
735 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
736
737 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000738 * (NACK)
739 */
740 virtual NACKMethod NACK() const = 0;
741
742 /*
743 * Turn negative acknowledgement requests on/off
744 *
745 * return -1 on failure else 0
746 */
747 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method) = 0;
748
749 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000750 * TODO(holmer): Propagate this API to VideoEngine.
751 * Returns the currently configured selective retransmission settings.
752 */
753 virtual int SelectiveRetransmissions() const = 0;
754
755 /*
756 * TODO(holmer): Propagate this API to VideoEngine.
757 * Sets the selective retransmission settings, which will decide which
758 * packets will be retransmitted if NACKed. Settings are constructed by
759 * combining the constants in enum RetransmissionMode with bitwise OR.
760 * All packets are retransmitted if kRetransmitAllPackets is set, while no
761 * packets are retransmitted if kRetransmitOff is set.
762 * By default all packets except FEC packets are retransmitted. For VP8
763 * with temporal scalability only base layer packets are retransmitted.
764 *
765 * Returns -1 on failure, otherwise 0.
766 */
767 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
768
769 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000770 * Send a Negative acknowledgement packet
771 *
772 * return -1 on failure else 0
773 */
774 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000775 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000776
777 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000778 * Store the sent packets, needed to answer to a Negative acknowledgement
779 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000780 *
781 * return -1 on failure else 0
782 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000783 virtual WebRtc_Word32 SetStorePacketsStatus(
784 const bool enable,
785 const WebRtc_UWord16 numberToStore = 200) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000786
787 /**************************************************************************
788 *
789 * Audio
790 *
791 ***************************************************************************/
792
793 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000794 * set audio packet size, used to determine when it's time to send a DTMF
795 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000796 *
797 * return -1 on failure else 0
798 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000799 virtual WebRtc_Word32 SetAudioPacketSize(
800 const WebRtc_UWord16 packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000801
802 /*
803 * Outband TelephoneEvent(DTMF) detection
804 *
805 * return -1 on failure else 0
806 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000807 virtual WebRtc_Word32 SetTelephoneEventStatus(
808 const bool enable,
809 const bool forwardToDecoder,
810 const bool detectEndOfTone = false) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000811
812 /*
813 * Is outband TelephoneEvent(DTMF) turned on/off?
814 */
815 virtual bool TelephoneEvent() const = 0;
816
817 /*
818 * Returns true if received DTMF events are forwarded to the decoder using
819 * the OnPlayTelephoneEvent callback.
820 */
821 virtual bool TelephoneEventForwardToDecoder() const = 0;
822
823 /*
824 * SendTelephoneEventActive
825 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000826 * return true if we currently send a telephone event and 100 ms after an
827 * event is sent used to prevent the telephone event tone to be recorded
828 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000829 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000830 virtual bool SendTelephoneEventActive(
831 WebRtc_Word8& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000832
833 /*
834 * Send a TelephoneEvent tone using RFC 2833 (4733)
835 *
836 * return -1 on failure else 0
837 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000838 virtual WebRtc_Word32 SendTelephoneEventOutband(
839 const WebRtc_UWord8 key,
840 const WebRtc_UWord16 time_ms,
841 const WebRtc_UWord8 level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000842
843 /*
844 * Set payload type for Redundant Audio Data RFC 2198
845 *
846 * return -1 on failure else 0
847 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000848 virtual WebRtc_Word32 SetSendREDPayloadType(
849 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000850
851 /*
852 * Get payload type for Redundant Audio Data RFC 2198
853 *
854 * return -1 on failure else 0
855 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000856 virtual WebRtc_Word32 SendREDPayloadType(
857 WebRtc_Word8& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000858
859 /*
860 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000861 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000862 *
863 * return -1 on failure else 0
864 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000865 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
866 const bool enable,
867 const WebRtc_UWord8 ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000868
869 /*
870 * Get status and ID for header-extension-for-audio-level-indication.
871 *
872 * return -1 on failure else 0
873 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000874 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
875 bool& enable,
876 WebRtc_UWord8& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000877
878 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000879 * Store the audio level in dBov for header-extension-for-audio-level-
880 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000881 * This API shall be called before transmision of an RTP packet to ensure
882 * that the |level| part of the extended RTP header is updated.
883 *
884 * return -1 on failure else 0.
885 */
886 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
887
888 /**************************************************************************
889 *
890 * Video
891 *
892 ***************************************************************************/
893
894 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000895 * Set the estimated camera delay in MS
896 *
897 * return -1 on failure else 0
898 */
899 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
900
901 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000902 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000903 */
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000904 virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000905
906 /*
907 * Turn on/off generic FEC
908 *
909 * return -1 on failure else 0
910 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000911 virtual WebRtc_Word32 SetGenericFECStatus(
912 const bool enable,
913 const WebRtc_UWord8 payloadTypeRED,
914 const WebRtc_UWord8 payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000915
916 /*
917 * Get generic FEC setting
918 *
919 * return -1 on failure else 0
920 */
921 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000922 WebRtc_UWord8& payloadTypeRED,
923 WebRtc_UWord8& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000924
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000925
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000926 virtual WebRtc_Word32 SetFecParameters(
927 const FecProtectionParams* delta_params,
928 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000929
niklase@google.com470e71d2011-07-07 08:21:25 +0000930 /*
931 * Set method for requestion a new key frame
932 *
933 * return -1 on failure else 0
934 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000935 virtual WebRtc_Word32 SetKeyFrameRequestMethod(
936 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000937
938 /*
939 * send a request for a keyframe
940 *
941 * return -1 on failure else 0
942 */
pwestin@webrtc.org5e954812012-02-10 12:13:12 +0000943 virtual WebRtc_Word32 RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000944};
945} // namespace webrtc
946#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_