blob: a8e129d86a9f3f9f35e7f30c5bbab26ca0655608 [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 {
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000029 Configuration();
30
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000031 /* id - Unique identifier of this RTP/RTCP module object
32 * audio - True for a audio version of the RTP/RTCP module
33 * object false will create a video version
34 * clock - The clock to use to read time. If NULL object
35 * will be using the system clock.
36 * incoming_data - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000037 * data. May not be NULL; default callback will do
38 * nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000039 * incoming_messages - Callback object that will receive the incoming
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000040 * RTP messages. May not be NULL; default callback
41 * will do nothing.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000042 * outgoing_transport - Transport object that will be called when packets
43 * are ready to be sent out on the network
44 * rtcp_feedback - Callback object that will receive the incoming
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000045 * RTCP messages.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000046 * intra_frame_callback - Called when the receiver request a intra frame.
47 * bandwidth_callback - Called when we receive a changed estimate from
48 * the receiver of out stream.
phoglund@webrtc.orga22a9bd2013-01-14 10:01:55 +000049 * audio_messages - Telehone events. May not be NULL; default callback
50 * will do nothing.
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000051 * remote_bitrate_estimator - Estimates the bandwidth available for a set of
52 * streams from the same client.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000053 * paced_sender - Spread any bursts of packets into smaller
54 * bursts to minimize packet loss.
niklase@google.com470e71d2011-07-07 08:21:25 +000055 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000056 int32_t id;
57 bool audio;
58 RtpRtcpClock* clock;
59 RtpRtcp* default_module;
60 RtpData* incoming_data;
61 RtpFeedback* incoming_messages;
62 Transport* outgoing_transport;
63 RtcpFeedback* rtcp_feedback;
64 RtcpIntraFrameObserver* intra_frame_callback;
65 RtcpBandwidthObserver* bandwidth_callback;
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +000066 RtcpRttObserver* rtt_observer;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000067 RtpAudioFeedback* audio_messages;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +000068 RemoteBitrateEstimator* remote_bitrate_estimator;
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000069 PacedSender* paced_sender;
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000070 };
71 /*
72 * Create a RTP/RTCP module object using the system clock.
73 *
74 * configuration - Configuration of the RTP/RTCP module.
75 */
76 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration);
niklase@google.com470e71d2011-07-07 08:21:25 +000077
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000078 /**************************************************************************
79 *
80 * Receiver functions
81 *
82 ***************************************************************************/
niklase@google.com470e71d2011-07-07 08:21:25 +000083
84 /*
85 * configure a RTP packet timeout value
86 *
87 * RTPtimeoutMS - time in milliseconds after last received RTP packet
88 * RTCPtimeoutMS - time in milliseconds after last received RTCP packet
89 *
90 * return -1 on failure else 0
91 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000092 virtual WebRtc_Word32 SetPacketTimeout(
93 const WebRtc_UWord32 RTPtimeoutMS,
94 const WebRtc_UWord32 RTCPtimeoutMS) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000095
96 /*
97 * Set periodic dead or alive notification
98 *
99 * enable - turn periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000100 * sampleTimeSeconds - sample interval in seconds for dead or alive
101 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000102 *
103 * return -1 on failure else 0
104 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000105 virtual WebRtc_Word32 SetPeriodicDeadOrAliveStatus(
106 const bool enable,
107 const WebRtc_UWord8 sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000108
109 /*
110 * Get periodic dead or alive notification status
111 *
112 * enable - periodic dead or alive notification on/off
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000113 * sampleTimeSeconds - sample interval in seconds for dead or alive
114 * notifications
niklase@google.com470e71d2011-07-07 08:21:25 +0000115 *
116 * return -1 on failure else 0
117 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000118 virtual WebRtc_Word32 PeriodicDeadOrAliveStatus(
119 bool& enable,
120 WebRtc_UWord8& sampleTimeSeconds) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000121
122 /*
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000123 * set voice codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000124 *
125 * return -1 on failure else 0
126 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000127 virtual WebRtc_Word32 RegisterReceivePayload(
128 const CodecInst& voiceCodec) = 0;
129
130 /*
131 * set video codec name and payload type
132 *
133 * return -1 on failure else 0
134 */
135 virtual WebRtc_Word32 RegisterReceivePayload(
136 const VideoCodec& videoCodec) = 0;
137
138 /*
139 * get payload type for a voice codec
140 *
141 * return -1 on failure else 0
142 */
143 virtual WebRtc_Word32 ReceivePayloadType(
144 const CodecInst& voiceCodec,
145 WebRtc_Word8* plType) = 0;
146
147 /*
148 * get payload type for a video codec
149 *
150 * return -1 on failure else 0
151 */
152 virtual WebRtc_Word32 ReceivePayloadType(
153 const VideoCodec& videoCodec,
154 WebRtc_Word8* plType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000155
156 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000157 * Remove a registered payload type from list of accepted payloads
niklase@google.com470e71d2011-07-07 08:21:25 +0000158 *
159 * payloadType - payload type of codec
160 *
161 * return -1 on failure else 0
162 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000163 virtual WebRtc_Word32 DeRegisterReceivePayload(
164 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000165
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000166 /*
167 * (De)register RTP header extension type and id.
168 *
169 * return -1 on failure else 0
170 */
171 virtual WebRtc_Word32 RegisterReceiveRtpHeaderExtension(
172 const RTPExtensionType type,
173 const WebRtc_UWord8 id) = 0;
174
175 virtual WebRtc_Word32 DeregisterReceiveRtpHeaderExtension(
176 const RTPExtensionType type) = 0;
177
niklase@google.com470e71d2011-07-07 08:21:25 +0000178 /*
179 * Get last received remote timestamp
180 */
181 virtual WebRtc_UWord32 RemoteTimestamp() const = 0;
182
183 /*
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000184 * Get the local time of the last received remote timestamp
185 */
186 virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0;
187
188 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000189 * Get the current estimated remote timestamp
190 *
191 * timestamp - estimated timestamp
192 *
193 * return -1 on failure else 0
194 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000195 virtual WebRtc_Word32 EstimatedRemoteTimeStamp(
196 WebRtc_UWord32& timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000197
198 /*
199 * Get incoming SSRC
200 */
201 virtual WebRtc_UWord32 RemoteSSRC() const = 0;
202
203 /*
204 * Get remote CSRC
205 *
206 * arrOfCSRC - array that will receive the CSRCs
207 *
208 * return -1 on failure else the number of valid entries in the list
209 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000210 virtual WebRtc_Word32 RemoteCSRCs(
211 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000212
213 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000214 * get the currently configured SSRC filter
215 *
216 * allowedSSRC - SSRC that will be allowed through
217 *
218 * return -1 on failure else 0
219 */
220 virtual WebRtc_Word32 SSRCFilter(WebRtc_UWord32& allowedSSRC) const = 0;
221
222 /*
223 * set a SSRC to be used as a filter for incoming RTP streams
224 *
225 * allowedSSRC - SSRC that will be allowed through
226 *
227 * return -1 on failure else 0
228 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000229 virtual WebRtc_Word32 SetSSRCFilter(const bool enable,
230 const WebRtc_UWord32 allowedSSRC) = 0;
231
232 /*
233 * Turn on/off receiving RTX (RFC 4588) on a specific SSRC.
234 */
235 virtual WebRtc_Word32 SetRTXReceiveStatus(const bool enable,
236 const WebRtc_UWord32 SSRC) = 0;
237
238 /*
239 * Get status of receiving RTX (RFC 4588) on a specific SSRC.
240 */
241 virtual WebRtc_Word32 RTXReceiveStatus(bool* enable,
242 WebRtc_UWord32* SSRC) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000243
244 /*
245 * called by the network module when we receive a packet
246 *
247 * incomingPacket - incoming packet buffer
248 * packetLength - length of incoming buffer
249 *
250 * return -1 on failure else 0
251 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000252 virtual WebRtc_Word32 IncomingPacket(const WebRtc_UWord8* incomingPacket,
253 const WebRtc_UWord16 packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000254
niklase@google.com470e71d2011-07-07 08:21:25 +0000255 /**************************************************************************
256 *
257 * Sender
258 *
259 ***************************************************************************/
260
261 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000262 * set MTU
263 *
264 * size - Max transfer unit in bytes, default is 1500
265 *
266 * return -1 on failure else 0
267 */
268 virtual WebRtc_Word32 SetMaxTransferUnit(const WebRtc_UWord16 size) = 0;
269
270 /*
271 * set transtport overhead
272 * default is IPv4 and UDP with no encryption
273 *
274 * TCP - true for TCP false UDP
275 * IPv6 - true for IP version 6 false for version 4
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000276 * authenticationOverhead - number of bytes to leave for an
277 * authentication header
niklase@google.com470e71d2011-07-07 08:21:25 +0000278 *
279 * return -1 on failure else 0
280 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000281 virtual WebRtc_Word32 SetTransportOverhead(
282 const bool TCP,
283 const bool IPV6,
284 const WebRtc_UWord8 authenticationOverhead = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000285
286 /*
287 * Get max payload length
288 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000289 * A combination of the configuration MaxTransferUnit and
290 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000291 * Does not account FEC/ULP/RED overhead if FEC is enabled.
292 * Does not account for RTP headers
293 */
294 virtual WebRtc_UWord16 MaxPayloadLength() const = 0;
295
296 /*
297 * Get max data payload length
298 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000299 * A combination of the configuration MaxTransferUnit, headers and
300 * TransportOverhead.
niklase@google.com470e71d2011-07-07 08:21:25 +0000301 * Takes into account FEC/ULP/RED overhead if FEC is enabled.
302 * Takes into account RTP headers
303 */
304 virtual WebRtc_UWord16 MaxDataPayloadLength() const = 0;
305
306 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000307 * set codec name and payload type
308 *
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000309 * return -1 on failure else 0
310 */
311 virtual WebRtc_Word32 RegisterSendPayload(
312 const CodecInst& voiceCodec) = 0;
313
314 /*
315 * set codec name and payload type
niklase@google.com470e71d2011-07-07 08:21:25 +0000316 *
317 * return -1 on failure else 0
318 */
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +0000319 virtual WebRtc_Word32 RegisterSendPayload(
320 const VideoCodec& videoCodec) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000321
322 /*
323 * Unregister a send payload
324 *
325 * payloadType - payload type of codec
326 *
327 * return -1 on failure else 0
328 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000329 virtual WebRtc_Word32 DeRegisterSendPayload(
330 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000331
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000332 /*
333 * (De)register RTP header extension type and id.
334 *
335 * return -1 on failure else 0
336 */
337 virtual WebRtc_Word32 RegisterSendRtpHeaderExtension(
338 const RTPExtensionType type,
339 const WebRtc_UWord8 id) = 0;
340
341 virtual WebRtc_Word32 DeregisterSendRtpHeaderExtension(
342 const RTPExtensionType type) = 0;
343
niklase@google.com470e71d2011-07-07 08:21:25 +0000344 /*
345 * get start timestamp
346 */
347 virtual WebRtc_UWord32 StartTimestamp() const = 0;
348
349 /*
350 * configure start timestamp, default is a random number
351 *
352 * timestamp - start timestamp
353 *
354 * return -1 on failure else 0
355 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000356 virtual WebRtc_Word32 SetStartTimestamp(
357 const WebRtc_UWord32 timestamp) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000358
359 /*
360 * Get SequenceNumber
361 */
362 virtual WebRtc_UWord16 SequenceNumber() const = 0;
363
364 /*
365 * Set SequenceNumber, default is a random number
366 *
367 * return -1 on failure else 0
368 */
369 virtual WebRtc_Word32 SetSequenceNumber(const WebRtc_UWord16 seq) = 0;
370
371 /*
372 * Get SSRC
373 */
374 virtual WebRtc_UWord32 SSRC() const = 0;
375
376 /*
377 * configure SSRC, default is a random number
378 *
379 * return -1 on failure else 0
380 */
381 virtual WebRtc_Word32 SetSSRC(const WebRtc_UWord32 ssrc) = 0;
382
383 /*
384 * Get CSRC
385 *
386 * arrOfCSRC - array of CSRCs
387 *
388 * return -1 on failure else number of valid entries in the array
389 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000390 virtual WebRtc_Word32 CSRCs(
391 WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000392
393 /*
394 * Set CSRC
395 *
396 * arrOfCSRC - array of CSRCs
397 * arrLength - number of valid entries in the array
398 *
399 * return -1 on failure else 0
400 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000401 virtual WebRtc_Word32 SetCSRCs(
402 const WebRtc_UWord32 arrOfCSRC[kRtpCsrcSize],
403 const WebRtc_UWord8 arrLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000404
405 /*
406 * includes CSRCs in RTP header if enabled
407 *
408 * include CSRC - on/off
409 *
410 * default:on
411 *
412 * return -1 on failure else 0
413 */
414 virtual WebRtc_Word32 SetCSRCStatus(const bool include) = 0;
415
416 /*
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000417 * Turn on/off sending RTX (RFC 4588) on a specific SSRC.
418 */
419 virtual WebRtc_Word32 SetRTXSendStatus(const bool enable,
420 const bool setSSRC,
421 const WebRtc_UWord32 SSRC) = 0;
422
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000423 /*
424 * Get status of sending RTX (RFC 4588) on a specific SSRC.
425 */
426 virtual WebRtc_Word32 RTXSendStatus(bool* enable,
427 WebRtc_UWord32* SSRC) const = 0;
428
429 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000430 * sends kRtcpByeCode when going from true to false
431 *
432 * sending - on/off
433 *
434 * return -1 on failure else 0
435 */
436 virtual WebRtc_Word32 SetSendingStatus(const bool sending) = 0;
437
438 /*
439 * get send status
440 */
441 virtual bool Sending() const = 0;
442
443 /*
444 * Starts/Stops media packets, on by default
445 *
446 * sending - on/off
447 *
448 * return -1 on failure else 0
449 */
450 virtual WebRtc_Word32 SetSendingMediaStatus(const bool sending) = 0;
451
452 /*
453 * get send status
454 */
455 virtual bool SendingMedia() const = 0;
456
457 /*
458 * get sent bitrate in Kbit/s
459 */
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000460 virtual void BitrateSent(WebRtc_UWord32* totalRate,
stefan@webrtc.orgfbea4e52011-10-27 16:08:29 +0000461 WebRtc_UWord32* videoRate,
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +0000462 WebRtc_UWord32* fecRate,
463 WebRtc_UWord32* nackRate) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000464
465 /*
stefan@webrtc.org439be292012-02-16 14:45:37 +0000466 * Get the receive-side estimate of the available bandwidth.
467 */
468 virtual int EstimatedReceiveBandwidth(
stefan@webrtc.org07b45a52012-02-02 08:37:48 +0000469 WebRtc_UWord32* available_bandwidth) const = 0;
470
471 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000472 * Used by the codec module to deliver a video or audio frame for
473 * packetization.
niklase@google.com470e71d2011-07-07 08:21:25 +0000474 *
475 * frameType - type of frame to send
476 * payloadType - payload type of frame to send
477 * timestamp - timestamp of frame to send
478 * payloadData - payload buffer of frame to send
479 * payloadSize - size of payload buffer to send
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000480 * fragmentation - fragmentation offset data for fragmented frames such
481 * as layers or RED
niklase@google.com470e71d2011-07-07 08:21:25 +0000482 *
483 * return -1 on failure else 0
484 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000485 virtual WebRtc_Word32 SendOutgoingData(
486 const FrameType frameType,
487 const WebRtc_Word8 payloadType,
488 const WebRtc_UWord32 timeStamp,
stefan@webrtc.orgddfdfed2012-07-03 13:21:22 +0000489 int64_t capture_time_ms,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000490 const WebRtc_UWord8* payloadData,
491 const WebRtc_UWord32 payloadSize,
492 const RTPFragmentationHeader* fragmentation = NULL,
493 const RTPVideoHeader* rtpVideoHdr = NULL) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000494
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000495 virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
496 int64_t capture_time_ms) = 0;
497
niklase@google.com470e71d2011-07-07 08:21:25 +0000498 /**************************************************************************
499 *
500 * RTCP
501 *
502 ***************************************************************************/
503
504 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000505 * Get RTCP status
506 */
507 virtual RTCPMethod RTCP() const = 0;
508
509 /*
510 * configure RTCP status i.e on(compound or non- compound)/off
511 *
512 * method - RTCP method to use
513 *
514 * return -1 on failure else 0
515 */
516 virtual WebRtc_Word32 SetRTCPStatus(const RTCPMethod method) = 0;
517
518 /*
519 * Set RTCP CName (i.e unique identifier)
520 *
521 * return -1 on failure else 0
522 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000523 virtual WebRtc_Word32 SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000524
525 /*
526 * Get RTCP CName (i.e unique identifier)
527 *
528 * return -1 on failure else 0
529 */
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000530 virtual WebRtc_Word32 CNAME(char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000531
532 /*
533 * Get remote CName
534 *
535 * return -1 on failure else 0
536 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000537 virtual WebRtc_Word32 RemoteCNAME(
538 const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000539 char cName[RTCP_CNAME_SIZE]) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000540
541 /*
542 * Get remote NTP
543 *
544 * return -1 on failure else 0
545 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000546 virtual WebRtc_Word32 RemoteNTP(
547 WebRtc_UWord32 *ReceivedNTPsecs,
548 WebRtc_UWord32 *ReceivedNTPfrac,
549 WebRtc_UWord32 *RTCPArrivalTimeSecs,
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +0000550 WebRtc_UWord32 *RTCPArrivalTimeFrac,
551 WebRtc_UWord32 *rtcp_timestamp) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000552
553 /*
554 * AddMixedCNAME
555 *
556 * return -1 on failure else 0
557 */
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000558 virtual WebRtc_Word32 AddMixedCNAME(
559 const WebRtc_UWord32 SSRC,
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +0000560 const char cName[RTCP_CNAME_SIZE]) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000561
562 /*
563 * RemoveMixedCNAME
564 *
565 * return -1 on failure else 0
566 */
567 virtual WebRtc_Word32 RemoveMixedCNAME(const WebRtc_UWord32 SSRC) = 0;
568
569 /*
570 * Get RoundTripTime
571 *
572 * return -1 on failure else 0
573 */
574 virtual WebRtc_Word32 RTT(const WebRtc_UWord32 remoteSSRC,
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000575 WebRtc_UWord16* RTT,
576 WebRtc_UWord16* avgRTT,
577 WebRtc_UWord16* minRTT,
578 WebRtc_UWord16* maxRTT) const = 0 ;
niklase@google.com470e71d2011-07-07 08:21:25 +0000579
580 /*
581 * Reset RoundTripTime statistics
582 *
583 * return -1 on failure else 0
584 */
585 virtual WebRtc_Word32 ResetRTT(const WebRtc_UWord32 remoteSSRC)= 0 ;
586
587 /*
mflodman@webrtc.org7c894b72012-11-26 12:40:15 +0000588 * Sets the estimated RTT, to be used for receive only modules without
589 * possibility of calculating its own RTT.
590 */
591 virtual void SetRtt(uint32_t rtt) = 0;
592
593 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000594 * Force a send of a RTCP packet
595 * normal SR and RR are triggered via the process function
596 *
597 * return -1 on failure else 0
598 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000599 virtual WebRtc_Word32 SendRTCP(
600 WebRtc_UWord32 rtcpPacketType = kRtcpReport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000601
602 /*
603 * Good state of RTP receiver inform sender
604 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000605 virtual WebRtc_Word32 SendRTCPReferencePictureSelection(
606 const WebRtc_UWord64 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000607
608 /*
609 * Send a RTCP Slice Loss Indication (SLI)
610 * 6 least significant bits of pictureID
611 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000612 virtual WebRtc_Word32 SendRTCPSliceLossIndication(
613 const WebRtc_UWord8 pictureID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000614
615 /*
616 * Reset RTP statistics
617 *
618 * return -1 on failure else 0
619 */
620 virtual WebRtc_Word32 ResetStatisticsRTP() = 0;
621
622 /*
623 * statistics of our localy created statistics of the received RTP stream
624 *
625 * return -1 on failure else 0
626 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000627 virtual WebRtc_Word32 StatisticsRTP(
628 WebRtc_UWord8* fraction_lost, // scale 0 to 255
629 WebRtc_UWord32* cum_lost, // number of lost packets
630 WebRtc_UWord32* ext_max, // highest sequence number received
631 WebRtc_UWord32* jitter,
632 WebRtc_UWord32* max_jitter = NULL) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000633
634 /*
635 * Reset RTP data counters for the receiving side
636 *
637 * return -1 on failure else 0
638 */
639 virtual WebRtc_Word32 ResetReceiveDataCountersRTP() = 0;
640
641 /*
642 * Reset RTP data counters for the sending side
643 *
644 * return -1 on failure else 0
645 */
646 virtual WebRtc_Word32 ResetSendDataCountersRTP() = 0;
647
648 /*
649 * statistics of the amount of data sent and received
650 *
651 * return -1 on failure else 0
652 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000653 virtual WebRtc_Word32 DataCountersRTP(
654 WebRtc_UWord32* bytesSent,
655 WebRtc_UWord32* packetsSent,
656 WebRtc_UWord32* bytesReceived,
657 WebRtc_UWord32* packetsReceived) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000658 /*
659 * Get received RTCP sender info
660 *
661 * return -1 on failure else 0
662 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000663 virtual WebRtc_Word32 RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000664
665 /*
666 * Get received RTCP report block
667 *
668 * return -1 on failure else 0
669 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000670 virtual WebRtc_Word32 RemoteRTCPStat(
671 std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000672 /*
673 * Set received RTCP report block
674 *
675 * return -1 on failure else 0
676 */
perkj@webrtc.orgce5990c2012-01-11 13:00:08 +0000677 virtual WebRtc_Word32 AddRTCPReportBlock(
678 const WebRtc_UWord32 SSRC,
679 const RTCPReportBlock* receiveBlock) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000680
681 /*
682 * RemoveRTCPReportBlock
683 *
684 * return -1 on failure else 0
685 */
686 virtual WebRtc_Word32 RemoveRTCPReportBlock(const WebRtc_UWord32 SSRC) = 0;
687
688 /*
689 * (APP) Application specific data
690 *
691 * return -1 on failure else 0
692 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000693 virtual WebRtc_Word32 SetRTCPApplicationSpecificData(
694 const WebRtc_UWord8 subType,
695 const WebRtc_UWord32 name,
696 const WebRtc_UWord8* data,
697 const WebRtc_UWord16 length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000698 /*
699 * (XR) VOIP metric
700 *
701 * return -1 on failure else 0
702 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000703 virtual WebRtc_Word32 SetRTCPVoIPMetrics(
704 const RTCPVoIPMetric* VoIPMetric) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000705
706 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000707 * (REMB) Receiver Estimated Max Bitrate
708 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000709 virtual bool REMB() const = 0;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000710
711 virtual WebRtc_Word32 SetREMBStatus(const bool enable) = 0;
712
713 virtual WebRtc_Word32 SetREMBData(const WebRtc_UWord32 bitrate,
714 const WebRtc_UWord8 numberOfSSRC,
715 const WebRtc_UWord32* SSRC) = 0;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000716
717 /*
718 * (IJ) Extended jitter report.
719 */
720 virtual bool IJ() const = 0;
721
722 virtual WebRtc_Word32 SetIJStatus(const bool enable) = 0;
723
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000724 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000725 * (TMMBR) Temporary Max Media Bit Rate
726 */
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000727 virtual bool TMMBR() const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000728
729 /*
730 *
731 * return -1 on failure else 0
732 */
733 virtual WebRtc_Word32 SetTMMBRStatus(const bool enable) = 0;
734
735 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000736 * (NACK)
737 */
738 virtual NACKMethod NACK() const = 0;
739
740 /*
741 * Turn negative acknowledgement requests on/off
742 *
743 * return -1 on failure else 0
744 */
745 virtual WebRtc_Word32 SetNACKStatus(const NACKMethod method) = 0;
746
747 /*
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000748 * TODO(holmer): Propagate this API to VideoEngine.
749 * Returns the currently configured selective retransmission settings.
750 */
751 virtual int SelectiveRetransmissions() const = 0;
752
753 /*
754 * TODO(holmer): Propagate this API to VideoEngine.
755 * Sets the selective retransmission settings, which will decide which
756 * packets will be retransmitted if NACKed. Settings are constructed by
757 * combining the constants in enum RetransmissionMode with bitwise OR.
758 * All packets are retransmitted if kRetransmitAllPackets is set, while no
759 * packets are retransmitted if kRetransmitOff is set.
760 * By default all packets except FEC packets are retransmitted. For VP8
761 * with temporal scalability only base layer packets are retransmitted.
762 *
763 * Returns -1 on failure, otherwise 0.
764 */
765 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0;
766
767 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000768 * Send a Negative acknowledgement packet
769 *
770 * return -1 on failure else 0
771 */
772 virtual WebRtc_Word32 SendNACK(const WebRtc_UWord16* nackList,
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000773 const WebRtc_UWord16 size) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000774
775 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000776 * Store the sent packets, needed to answer to a Negative acknowledgement
777 * requests
niklase@google.com470e71d2011-07-07 08:21:25 +0000778 *
779 * return -1 on failure else 0
780 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000781 virtual WebRtc_Word32 SetStorePacketsStatus(
782 const bool enable,
783 const WebRtc_UWord16 numberToStore = 200) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000784
785 /**************************************************************************
786 *
787 * Audio
788 *
789 ***************************************************************************/
790
791 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000792 * set audio packet size, used to determine when it's time to send a DTMF
793 * packet in silence (CNG)
niklase@google.com470e71d2011-07-07 08:21:25 +0000794 *
795 * return -1 on failure else 0
796 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000797 virtual WebRtc_Word32 SetAudioPacketSize(
798 const WebRtc_UWord16 packetSizeSamples) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000799
800 /*
801 * Outband TelephoneEvent(DTMF) detection
802 *
803 * return -1 on failure else 0
804 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000805 virtual WebRtc_Word32 SetTelephoneEventStatus(
806 const bool enable,
807 const bool forwardToDecoder,
808 const bool detectEndOfTone = false) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000809
810 /*
811 * Is outband TelephoneEvent(DTMF) turned on/off?
812 */
813 virtual bool TelephoneEvent() const = 0;
814
815 /*
816 * Returns true if received DTMF events are forwarded to the decoder using
817 * the OnPlayTelephoneEvent callback.
818 */
819 virtual bool TelephoneEventForwardToDecoder() const = 0;
820
821 /*
822 * SendTelephoneEventActive
823 *
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000824 * return true if we currently send a telephone event and 100 ms after an
825 * event is sent used to prevent the telephone event tone to be recorded
826 * by the microphone and send inband just after the tone has ended.
niklase@google.com470e71d2011-07-07 08:21:25 +0000827 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000828 virtual bool SendTelephoneEventActive(
829 WebRtc_Word8& telephoneEvent) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000830
831 /*
832 * Send a TelephoneEvent tone using RFC 2833 (4733)
833 *
834 * return -1 on failure else 0
835 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000836 virtual WebRtc_Word32 SendTelephoneEventOutband(
837 const WebRtc_UWord8 key,
838 const WebRtc_UWord16 time_ms,
839 const WebRtc_UWord8 level) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000840
841 /*
842 * Set payload type for Redundant Audio Data RFC 2198
843 *
844 * return -1 on failure else 0
845 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000846 virtual WebRtc_Word32 SetSendREDPayloadType(
847 const WebRtc_Word8 payloadType) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000848
849 /*
850 * Get payload type for Redundant Audio Data RFC 2198
851 *
852 * return -1 on failure else 0
853 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000854 virtual WebRtc_Word32 SendREDPayloadType(
855 WebRtc_Word8& payloadType) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000856
857 /*
858 * Set status and ID for header-extension-for-audio-level-indication.
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000859 * See http://tools.ietf.org/html/rfc6464 for more details.
niklase@google.com470e71d2011-07-07 08:21:25 +0000860 *
861 * return -1 on failure else 0
862 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000863 virtual WebRtc_Word32 SetRTPAudioLevelIndicationStatus(
864 const bool enable,
865 const WebRtc_UWord8 ID) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000866
867 /*
868 * Get status and ID for header-extension-for-audio-level-indication.
869 *
870 * return -1 on failure else 0
871 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000872 virtual WebRtc_Word32 GetRTPAudioLevelIndicationStatus(
873 bool& enable,
874 WebRtc_UWord8& ID) const = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000875
876 /*
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000877 * Store the audio level in dBov for header-extension-for-audio-level-
878 * indication.
niklase@google.com470e71d2011-07-07 08:21:25 +0000879 * This API shall be called before transmision of an RTP packet to ensure
880 * that the |level| part of the extended RTP header is updated.
881 *
882 * return -1 on failure else 0.
883 */
884 virtual WebRtc_Word32 SetAudioLevel(const WebRtc_UWord8 level_dBov) = 0;
885
886 /**************************************************************************
887 *
888 * Video
889 *
890 ***************************************************************************/
891
892 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000893 * Set the estimated camera delay in MS
894 *
895 * return -1 on failure else 0
896 */
897 virtual WebRtc_Word32 SetCameraDelay(const WebRtc_Word32 delayMS) = 0;
898
899 /*
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000900 * Set the target send bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000901 */
pwestin@webrtc.org49888ce2012-04-27 05:25:53 +0000902 virtual void SetTargetSendBitrate(const WebRtc_UWord32 bitrate) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000903
904 /*
905 * Turn on/off generic FEC
906 *
907 * return -1 on failure else 0
908 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000909 virtual WebRtc_Word32 SetGenericFECStatus(
910 const bool enable,
911 const WebRtc_UWord8 payloadTypeRED,
912 const WebRtc_UWord8 payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000913
914 /*
915 * Get generic FEC setting
916 *
917 * return -1 on failure else 0
918 */
919 virtual WebRtc_Word32 GenericFECStatus(bool& enable,
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000920 WebRtc_UWord8& payloadTypeRED,
921 WebRtc_UWord8& payloadTypeFEC) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000922
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000923
stefan@webrtc.orge0d6fa42012-03-20 22:10:56 +0000924 virtual WebRtc_Word32 SetFecParameters(
925 const FecProtectionParams* delta_params,
926 const FecProtectionParams* key_params) = 0;
marpan@google.com80c5d7a2011-07-15 21:32:40 +0000927
niklase@google.com470e71d2011-07-07 08:21:25 +0000928 /*
929 * Set method for requestion a new key frame
930 *
931 * return -1 on failure else 0
932 */
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000933 virtual WebRtc_Word32 SetKeyFrameRequestMethod(
934 const KeyFrameRequestMethod method) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000935
936 /*
937 * send a request for a keyframe
938 *
939 * return -1 on failure else 0
940 */
pwestin@webrtc.org5e954812012-02-10 12:13:12 +0000941 virtual WebRtc_Word32 RequestKeyFrame() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000942};
943} // namespace webrtc
944#endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_