niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 14 | #include <vector> |
| 15 | |
turaj@webrtc.org | b7edd06 | 2013-03-12 22:27:27 +0000 | [diff] [blame] | 16 | #include "webrtc/modules/interface/module.h" |
| 17 | #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 20 | // Forward declarations. |
| 21 | class PacedSender; |
stefan@webrtc.org | 9354cc9 | 2012-06-07 08:10:14 +0000 | [diff] [blame] | 22 | class RemoteBitrateEstimator; |
| 23 | class RemoteBitrateObserver; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | class Transport; |
| 25 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 26 | class RtpRtcp : public Module { |
| 27 | public: |
| 28 | struct Configuration { |
phoglund@webrtc.org | a22a9bd | 2013-01-14 10:01:55 +0000 | [diff] [blame] | 29 | Configuration(); |
| 30 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 31 | /* 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.org | a22a9bd | 2013-01-14 10:01:55 +0000 | [diff] [blame] | 37 | * data. May not be NULL; default callback will do |
| 38 | * nothing. |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 39 | * incoming_messages - Callback object that will receive the incoming |
phoglund@webrtc.org | a22a9bd | 2013-01-14 10:01:55 +0000 | [diff] [blame] | 40 | * RTP messages. May not be NULL; default callback |
| 41 | * will do nothing. |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 42 | * 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.org | 7c894b7 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 45 | * RTCP messages. |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 46 | * 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.org | a22a9bd | 2013-01-14 10:01:55 +0000 | [diff] [blame] | 49 | * audio_messages - Telehone events. May not be NULL; default callback |
| 50 | * will do nothing. |
stefan@webrtc.org | 9354cc9 | 2012-06-07 08:10:14 +0000 | [diff] [blame] | 51 | * remote_bitrate_estimator - Estimates the bandwidth available for a set of |
| 52 | * streams from the same client. |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 53 | * paced_sender - Spread any bursts of packets into smaller |
| 54 | * bursts to minimize packet loss. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | */ |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 56 | int32_t id; |
| 57 | bool audio; |
stefan@webrtc.org | 20ed36d | 2013-01-17 14:01:20 +0000 | [diff] [blame] | 58 | Clock* clock; |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 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.org | 7c894b7 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 66 | RtcpRttObserver* rtt_observer; |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 67 | RtpAudioFeedback* audio_messages; |
stefan@webrtc.org | 9354cc9 | 2012-06-07 08:10:14 +0000 | [diff] [blame] | 68 | RemoteBitrateEstimator* remote_bitrate_estimator; |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 69 | PacedSender* paced_sender; |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 70 | }; |
| 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 78 | /************************************************************************** |
| 79 | * |
| 80 | * Receiver functions |
| 81 | * |
| 82 | ***************************************************************************/ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | |
| 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 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 92 | virtual int32_t SetPacketTimeout( |
| 93 | const uint32_t RTPtimeoutMS, |
| 94 | const uint32_t RTCPtimeoutMS) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 95 | |
| 96 | /* |
| 97 | * Set periodic dead or alive notification |
| 98 | * |
| 99 | * enable - turn periodic dead or alive notification on/off |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 100 | * sampleTimeSeconds - sample interval in seconds for dead or alive |
| 101 | * notifications |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 102 | * |
| 103 | * return -1 on failure else 0 |
| 104 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 105 | virtual int32_t SetPeriodicDeadOrAliveStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 106 | const bool enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 107 | const uint8_t sampleTimeSeconds) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * Get periodic dead or alive notification status |
| 111 | * |
| 112 | * enable - periodic dead or alive notification on/off |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 113 | * sampleTimeSeconds - sample interval in seconds for dead or alive |
| 114 | * notifications |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | * |
| 116 | * return -1 on failure else 0 |
| 117 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 118 | virtual int32_t PeriodicDeadOrAliveStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 119 | bool& enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 120 | uint8_t& sampleTimeSeconds) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | |
| 122 | /* |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 123 | * set voice codec name and payload type |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 124 | * |
| 125 | * return -1 on failure else 0 |
| 126 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 127 | virtual int32_t RegisterReceivePayload( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 128 | const CodecInst& voiceCodec) = 0; |
| 129 | |
| 130 | /* |
| 131 | * set video codec name and payload type |
| 132 | * |
| 133 | * return -1 on failure else 0 |
| 134 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 135 | virtual int32_t RegisterReceivePayload( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 136 | const VideoCodec& videoCodec) = 0; |
| 137 | |
| 138 | /* |
| 139 | * get payload type for a voice codec |
| 140 | * |
| 141 | * return -1 on failure else 0 |
| 142 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 143 | virtual int32_t ReceivePayloadType( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 144 | const CodecInst& voiceCodec, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 145 | int8_t* plType) = 0; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 146 | |
| 147 | /* |
| 148 | * get payload type for a video codec |
| 149 | * |
| 150 | * return -1 on failure else 0 |
| 151 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 152 | virtual int32_t ReceivePayloadType( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 153 | const VideoCodec& videoCodec, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 154 | int8_t* plType) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 155 | |
| 156 | /* |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 157 | * Remove a registered payload type from list of accepted payloads |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 158 | * |
| 159 | * payloadType - payload type of codec |
| 160 | * |
| 161 | * return -1 on failure else 0 |
| 162 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 163 | virtual int32_t DeRegisterReceivePayload( |
| 164 | const int8_t payloadType) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 165 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 166 | /* |
| 167 | * (De)register RTP header extension type and id. |
| 168 | * |
| 169 | * return -1 on failure else 0 |
| 170 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 171 | virtual int32_t RegisterReceiveRtpHeaderExtension( |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 172 | const RTPExtensionType type, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 173 | const uint8_t id) = 0; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 174 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 175 | virtual int32_t DeregisterReceiveRtpHeaderExtension( |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 176 | const RTPExtensionType type) = 0; |
| 177 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 178 | /* |
| 179 | * Get last received remote timestamp |
| 180 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 181 | virtual uint32_t RemoteTimestamp() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 182 | |
| 183 | /* |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 184 | * Get the local time of the last received remote timestamp |
| 185 | */ |
| 186 | virtual int64_t LocalTimeOfRemoteTimeStamp() const = 0; |
| 187 | |
| 188 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 189 | * Get the current estimated remote timestamp |
| 190 | * |
| 191 | * timestamp - estimated timestamp |
| 192 | * |
| 193 | * return -1 on failure else 0 |
| 194 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 195 | virtual int32_t EstimatedRemoteTimeStamp( |
| 196 | uint32_t& timestamp) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 197 | |
| 198 | /* |
| 199 | * Get incoming SSRC |
| 200 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 201 | virtual uint32_t RemoteSSRC() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 210 | virtual int32_t RemoteCSRCs( |
| 211 | uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 212 | |
| 213 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 214 | * get the currently configured SSRC filter |
| 215 | * |
| 216 | * allowedSSRC - SSRC that will be allowed through |
| 217 | * |
| 218 | * return -1 on failure else 0 |
| 219 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 220 | virtual int32_t SSRCFilter(uint32_t& allowedSSRC) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 229 | virtual int32_t SetSSRCFilter(const bool enable, |
| 230 | const uint32_t allowedSSRC) = 0; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 231 | |
| 232 | /* |
| 233 | * Turn on/off receiving RTX (RFC 4588) on a specific SSRC. |
| 234 | */ |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame^] | 235 | virtual int32_t SetRTXReceiveStatus(bool enable, uint32_t SSRC) = 0; |
| 236 | |
| 237 | // Sets the payload type to expected for received RTX packets. Note |
| 238 | // that this doesn't enable RTX, only the payload type is set. |
| 239 | virtual void SetRtxReceivePayloadType(int payload_type) = 0; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 240 | |
| 241 | /* |
| 242 | * Get status of receiving RTX (RFC 4588) on a specific SSRC. |
| 243 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 244 | virtual int32_t RTXReceiveStatus(bool* enable, |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame^] | 245 | uint32_t* SSRC, |
| 246 | int* payloadType) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 247 | |
| 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 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 256 | virtual int32_t IncomingPacket(const uint8_t* incomingPacket, |
| 257 | const uint16_t packetLength) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 258 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 259 | /************************************************************************** |
| 260 | * |
| 261 | * Sender |
| 262 | * |
| 263 | ***************************************************************************/ |
| 264 | |
| 265 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | * set MTU |
| 267 | * |
| 268 | * size - Max transfer unit in bytes, default is 1500 |
| 269 | * |
| 270 | * return -1 on failure else 0 |
| 271 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 272 | virtual int32_t SetMaxTransferUnit(const uint16_t size) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 280 | * authenticationOverhead - number of bytes to leave for an |
| 281 | * authentication header |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | * |
| 283 | * return -1 on failure else 0 |
| 284 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 285 | virtual int32_t SetTransportOverhead( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 286 | const bool TCP, |
| 287 | const bool IPV6, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 288 | const uint8_t authenticationOverhead = 0) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 289 | |
| 290 | /* |
| 291 | * Get max payload length |
| 292 | * |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 293 | * A combination of the configuration MaxTransferUnit and |
| 294 | * TransportOverhead. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 295 | * Does not account FEC/ULP/RED overhead if FEC is enabled. |
| 296 | * Does not account for RTP headers |
| 297 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 298 | virtual uint16_t MaxPayloadLength() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 299 | |
| 300 | /* |
| 301 | * Get max data payload length |
| 302 | * |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 303 | * A combination of the configuration MaxTransferUnit, headers and |
| 304 | * TransportOverhead. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 305 | * Takes into account FEC/ULP/RED overhead if FEC is enabled. |
| 306 | * Takes into account RTP headers |
| 307 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 308 | virtual uint16_t MaxDataPayloadLength() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 309 | |
| 310 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 311 | * set codec name and payload type |
| 312 | * |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 313 | * return -1 on failure else 0 |
| 314 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 315 | virtual int32_t RegisterSendPayload( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 316 | const CodecInst& voiceCodec) = 0; |
| 317 | |
| 318 | /* |
| 319 | * set codec name and payload type |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 320 | * |
| 321 | * return -1 on failure else 0 |
| 322 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 323 | virtual int32_t RegisterSendPayload( |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 324 | const VideoCodec& videoCodec) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 325 | |
| 326 | /* |
| 327 | * Unregister a send payload |
| 328 | * |
| 329 | * payloadType - payload type of codec |
| 330 | * |
| 331 | * return -1 on failure else 0 |
| 332 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 333 | virtual int32_t DeRegisterSendPayload( |
| 334 | const int8_t payloadType) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 335 | |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 336 | /* |
| 337 | * (De)register RTP header extension type and id. |
| 338 | * |
| 339 | * return -1 on failure else 0 |
| 340 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 341 | virtual int32_t RegisterSendRtpHeaderExtension( |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 342 | const RTPExtensionType type, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 343 | const uint8_t id) = 0; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 344 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 345 | virtual int32_t DeregisterSendRtpHeaderExtension( |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 346 | const RTPExtensionType type) = 0; |
| 347 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 348 | /* |
| 349 | * get start timestamp |
| 350 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 351 | virtual uint32_t StartTimestamp() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 352 | |
| 353 | /* |
| 354 | * configure start timestamp, default is a random number |
| 355 | * |
| 356 | * timestamp - start timestamp |
| 357 | * |
| 358 | * return -1 on failure else 0 |
| 359 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 360 | virtual int32_t SetStartTimestamp( |
| 361 | const uint32_t timestamp) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 362 | |
| 363 | /* |
| 364 | * Get SequenceNumber |
| 365 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 366 | virtual uint16_t SequenceNumber() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 367 | |
| 368 | /* |
| 369 | * Set SequenceNumber, default is a random number |
| 370 | * |
| 371 | * return -1 on failure else 0 |
| 372 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 373 | virtual int32_t SetSequenceNumber(const uint16_t seq) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 374 | |
| 375 | /* |
| 376 | * Get SSRC |
| 377 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 378 | virtual uint32_t SSRC() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 379 | |
| 380 | /* |
| 381 | * configure SSRC, default is a random number |
| 382 | * |
| 383 | * return -1 on failure else 0 |
| 384 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 385 | virtual int32_t SetSSRC(const uint32_t ssrc) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 386 | |
| 387 | /* |
| 388 | * Get CSRC |
| 389 | * |
| 390 | * arrOfCSRC - array of CSRCs |
| 391 | * |
| 392 | * return -1 on failure else number of valid entries in the array |
| 393 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 394 | virtual int32_t CSRCs( |
| 395 | uint32_t arrOfCSRC[kRtpCsrcSize]) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 396 | |
| 397 | /* |
| 398 | * Set CSRC |
| 399 | * |
| 400 | * arrOfCSRC - array of CSRCs |
| 401 | * arrLength - number of valid entries in the array |
| 402 | * |
| 403 | * return -1 on failure else 0 |
| 404 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 405 | virtual int32_t SetCSRCs( |
| 406 | const uint32_t arrOfCSRC[kRtpCsrcSize], |
| 407 | const uint8_t arrLength) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 408 | |
| 409 | /* |
| 410 | * includes CSRCs in RTP header if enabled |
| 411 | * |
| 412 | * include CSRC - on/off |
| 413 | * |
| 414 | * default:on |
| 415 | * |
| 416 | * return -1 on failure else 0 |
| 417 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 418 | virtual int32_t SetCSRCStatus(const bool include) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 419 | |
| 420 | /* |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 421 | * Turn on/off sending RTX (RFC 4588) on a specific SSRC. |
| 422 | */ |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame^] | 423 | virtual int32_t SetRTXSendStatus(RtxMode mode, bool set_ssrc, |
| 424 | uint32_t ssrc) = 0; |
| 425 | |
| 426 | // Sets the payload type to use when sending RTX packets. Note that this |
| 427 | // doesn't enable RTX, only the payload type is set. |
| 428 | virtual void SetRtxSendPayloadType(int payload_type) = 0; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 429 | |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 430 | /* |
| 431 | * Get status of sending RTX (RFC 4588) on a specific SSRC. |
| 432 | */ |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame^] | 433 | virtual int32_t RTXSendStatus(RtxMode* mode, uint32_t* ssrc, |
| 434 | int* payloadType) const = 0; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 435 | |
| 436 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 437 | * sends kRtcpByeCode when going from true to false |
| 438 | * |
| 439 | * sending - on/off |
| 440 | * |
| 441 | * return -1 on failure else 0 |
| 442 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 443 | virtual int32_t SetSendingStatus(const bool sending) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 444 | |
| 445 | /* |
| 446 | * get send status |
| 447 | */ |
| 448 | virtual bool Sending() const = 0; |
| 449 | |
| 450 | /* |
| 451 | * Starts/Stops media packets, on by default |
| 452 | * |
| 453 | * sending - on/off |
| 454 | * |
| 455 | * return -1 on failure else 0 |
| 456 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 457 | virtual int32_t SetSendingMediaStatus(const bool sending) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 458 | |
| 459 | /* |
| 460 | * get send status |
| 461 | */ |
| 462 | virtual bool SendingMedia() const = 0; |
| 463 | |
| 464 | /* |
| 465 | * get sent bitrate in Kbit/s |
| 466 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 467 | virtual void BitrateSent(uint32_t* totalRate, |
| 468 | uint32_t* videoRate, |
| 469 | uint32_t* fecRate, |
| 470 | uint32_t* nackRate) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 471 | |
| 472 | /* |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 473 | * Used by the codec module to deliver a video or audio frame for |
| 474 | * packetization. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 475 | * |
| 476 | * frameType - type of frame to send |
| 477 | * payloadType - payload type of frame to send |
| 478 | * timestamp - timestamp of frame to send |
| 479 | * payloadData - payload buffer of frame to send |
| 480 | * payloadSize - size of payload buffer to send |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 481 | * fragmentation - fragmentation offset data for fragmented frames such |
| 482 | * as layers or RED |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 483 | * |
| 484 | * return -1 on failure else 0 |
| 485 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 486 | virtual int32_t SendOutgoingData( |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 487 | const FrameType frameType, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 488 | const int8_t payloadType, |
| 489 | const uint32_t timeStamp, |
stefan@webrtc.org | ddfdfed | 2012-07-03 13:21:22 +0000 | [diff] [blame] | 490 | int64_t capture_time_ms, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 491 | const uint8_t* payloadData, |
| 492 | const uint32_t payloadSize, |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 493 | const RTPFragmentationHeader* fragmentation = NULL, |
| 494 | const RTPVideoHeader* rtpVideoHdr = NULL) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 495 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 496 | virtual void TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number, |
| 497 | int64_t capture_time_ms) = 0; |
| 498 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 499 | /************************************************************************** |
| 500 | * |
| 501 | * RTCP |
| 502 | * |
| 503 | ***************************************************************************/ |
| 504 | |
| 505 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 506 | * Get RTCP status |
| 507 | */ |
| 508 | virtual RTCPMethod RTCP() const = 0; |
| 509 | |
| 510 | /* |
| 511 | * configure RTCP status i.e on(compound or non- compound)/off |
| 512 | * |
| 513 | * method - RTCP method to use |
| 514 | * |
| 515 | * return -1 on failure else 0 |
| 516 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 517 | virtual int32_t SetRTCPStatus(const RTCPMethod method) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 518 | |
| 519 | /* |
| 520 | * Set RTCP CName (i.e unique identifier) |
| 521 | * |
| 522 | * return -1 on failure else 0 |
| 523 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 524 | virtual int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 525 | |
| 526 | /* |
| 527 | * Get RTCP CName (i.e unique identifier) |
| 528 | * |
| 529 | * return -1 on failure else 0 |
| 530 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 531 | virtual int32_t CNAME(char cName[RTCP_CNAME_SIZE]) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 532 | |
| 533 | /* |
| 534 | * Get remote CName |
| 535 | * |
| 536 | * return -1 on failure else 0 |
| 537 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 538 | virtual int32_t RemoteCNAME( |
| 539 | const uint32_t remoteSSRC, |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 540 | char cName[RTCP_CNAME_SIZE]) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 541 | |
| 542 | /* |
| 543 | * Get remote NTP |
| 544 | * |
| 545 | * return -1 on failure else 0 |
| 546 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 547 | virtual int32_t RemoteNTP( |
| 548 | uint32_t *ReceivedNTPsecs, |
| 549 | uint32_t *ReceivedNTPfrac, |
| 550 | uint32_t *RTCPArrivalTimeSecs, |
| 551 | uint32_t *RTCPArrivalTimeFrac, |
| 552 | uint32_t *rtcp_timestamp) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 553 | |
| 554 | /* |
| 555 | * AddMixedCNAME |
| 556 | * |
| 557 | * return -1 on failure else 0 |
| 558 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 559 | virtual int32_t AddMixedCNAME( |
| 560 | const uint32_t SSRC, |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 561 | const char cName[RTCP_CNAME_SIZE]) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 562 | |
| 563 | /* |
| 564 | * RemoveMixedCNAME |
| 565 | * |
| 566 | * return -1 on failure else 0 |
| 567 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 568 | virtual int32_t RemoveMixedCNAME(const uint32_t SSRC) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 569 | |
| 570 | /* |
| 571 | * Get RoundTripTime |
| 572 | * |
| 573 | * return -1 on failure else 0 |
| 574 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 575 | virtual int32_t RTT(const uint32_t remoteSSRC, |
| 576 | uint16_t* RTT, |
| 577 | uint16_t* avgRTT, |
| 578 | uint16_t* minRTT, |
| 579 | uint16_t* maxRTT) const = 0 ; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 580 | |
| 581 | /* |
| 582 | * Reset RoundTripTime statistics |
| 583 | * |
| 584 | * return -1 on failure else 0 |
| 585 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 586 | virtual int32_t ResetRTT(const uint32_t remoteSSRC)= 0 ; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 587 | |
| 588 | /* |
mflodman@webrtc.org | 7c894b7 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 589 | * Sets the estimated RTT, to be used for receive only modules without |
| 590 | * possibility of calculating its own RTT. |
| 591 | */ |
| 592 | virtual void SetRtt(uint32_t rtt) = 0; |
| 593 | |
| 594 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 595 | * Force a send of a RTCP packet |
| 596 | * normal SR and RR are triggered via the process function |
| 597 | * |
| 598 | * return -1 on failure else 0 |
| 599 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 600 | virtual int32_t SendRTCP( |
| 601 | uint32_t rtcpPacketType = kRtcpReport) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 602 | |
| 603 | /* |
| 604 | * Good state of RTP receiver inform sender |
| 605 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 606 | virtual int32_t SendRTCPReferencePictureSelection( |
| 607 | const uint64_t pictureID) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 608 | |
| 609 | /* |
| 610 | * Send a RTCP Slice Loss Indication (SLI) |
| 611 | * 6 least significant bits of pictureID |
| 612 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 613 | virtual int32_t SendRTCPSliceLossIndication( |
| 614 | const uint8_t pictureID) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 615 | |
| 616 | /* |
| 617 | * Reset RTP statistics |
| 618 | * |
| 619 | * return -1 on failure else 0 |
| 620 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 621 | virtual int32_t ResetStatisticsRTP() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 622 | |
| 623 | /* |
| 624 | * statistics of our localy created statistics of the received RTP stream |
| 625 | * |
| 626 | * return -1 on failure else 0 |
| 627 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 628 | virtual int32_t StatisticsRTP( |
| 629 | uint8_t* fraction_lost, // scale 0 to 255 |
| 630 | uint32_t* cum_lost, // number of lost packets |
| 631 | uint32_t* ext_max, // highest sequence number received |
| 632 | uint32_t* jitter, |
| 633 | uint32_t* max_jitter = NULL) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 634 | |
| 635 | /* |
| 636 | * Reset RTP data counters for the receiving side |
| 637 | * |
| 638 | * return -1 on failure else 0 |
| 639 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 640 | virtual int32_t ResetReceiveDataCountersRTP() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 641 | |
| 642 | /* |
| 643 | * Reset RTP data counters for the sending side |
| 644 | * |
| 645 | * return -1 on failure else 0 |
| 646 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 647 | virtual int32_t ResetSendDataCountersRTP() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 648 | |
| 649 | /* |
| 650 | * statistics of the amount of data sent and received |
| 651 | * |
| 652 | * return -1 on failure else 0 |
| 653 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 654 | virtual int32_t DataCountersRTP( |
| 655 | uint32_t* bytesSent, |
| 656 | uint32_t* packetsSent, |
| 657 | uint32_t* bytesReceived, |
| 658 | uint32_t* packetsReceived) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 659 | /* |
| 660 | * Get received RTCP sender info |
| 661 | * |
| 662 | * return -1 on failure else 0 |
| 663 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 664 | virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 665 | |
| 666 | /* |
| 667 | * Get received RTCP report block |
| 668 | * |
| 669 | * return -1 on failure else 0 |
| 670 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 671 | virtual int32_t RemoteRTCPStat( |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 672 | std::vector<RTCPReportBlock>* receiveBlocks) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 673 | /* |
| 674 | * Set received RTCP report block |
| 675 | * |
| 676 | * return -1 on failure else 0 |
| 677 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 678 | virtual int32_t AddRTCPReportBlock( |
| 679 | const uint32_t SSRC, |
perkj@webrtc.org | ce5990c | 2012-01-11 13:00:08 +0000 | [diff] [blame] | 680 | const RTCPReportBlock* receiveBlock) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 681 | |
| 682 | /* |
| 683 | * RemoveRTCPReportBlock |
| 684 | * |
| 685 | * return -1 on failure else 0 |
| 686 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 687 | virtual int32_t RemoveRTCPReportBlock(const uint32_t SSRC) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 688 | |
| 689 | /* |
| 690 | * (APP) Application specific data |
| 691 | * |
| 692 | * return -1 on failure else 0 |
| 693 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 694 | virtual int32_t SetRTCPApplicationSpecificData( |
| 695 | const uint8_t subType, |
| 696 | const uint32_t name, |
| 697 | const uint8_t* data, |
| 698 | const uint16_t length) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 699 | /* |
| 700 | * (XR) VOIP metric |
| 701 | * |
| 702 | * return -1 on failure else 0 |
| 703 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 704 | virtual int32_t SetRTCPVoIPMetrics( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 705 | const RTCPVoIPMetric* VoIPMetric) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 706 | |
| 707 | /* |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 708 | * (REMB) Receiver Estimated Max Bitrate |
| 709 | */ |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 710 | virtual bool REMB() const = 0; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 711 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 712 | virtual int32_t SetREMBStatus(const bool enable) = 0; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 713 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 714 | virtual int32_t SetREMBData(const uint32_t bitrate, |
| 715 | const uint8_t numberOfSSRC, |
| 716 | const uint32_t* SSRC) = 0; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 717 | |
| 718 | /* |
| 719 | * (IJ) Extended jitter report. |
| 720 | */ |
| 721 | virtual bool IJ() const = 0; |
| 722 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 723 | virtual int32_t SetIJStatus(const bool enable) = 0; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 724 | |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 725 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 726 | * (TMMBR) Temporary Max Media Bit Rate |
| 727 | */ |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 728 | virtual bool TMMBR() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 729 | |
| 730 | /* |
| 731 | * |
| 732 | * return -1 on failure else 0 |
| 733 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 734 | virtual int32_t SetTMMBRStatus(const bool enable) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 735 | |
| 736 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 737 | * (NACK) |
| 738 | */ |
| 739 | virtual NACKMethod NACK() const = 0; |
| 740 | |
| 741 | /* |
| 742 | * Turn negative acknowledgement requests on/off |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 743 | * |max_reordering_threshold| should be set to how much a retransmitted |
| 744 | * packet can be expected to be reordered (in sequence numbers) compared to |
| 745 | * a packet which has not been retransmitted. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 746 | * |
| 747 | * return -1 on failure else 0 |
| 748 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 749 | virtual int32_t SetNACKStatus(const NACKMethod method, |
| 750 | int max_reordering_threshold) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 751 | |
| 752 | /* |
stefan@webrtc.org | 6a4bef4 | 2011-12-22 12:52:41 +0000 | [diff] [blame] | 753 | * TODO(holmer): Propagate this API to VideoEngine. |
| 754 | * Returns the currently configured selective retransmission settings. |
| 755 | */ |
| 756 | virtual int SelectiveRetransmissions() const = 0; |
| 757 | |
| 758 | /* |
| 759 | * TODO(holmer): Propagate this API to VideoEngine. |
| 760 | * Sets the selective retransmission settings, which will decide which |
| 761 | * packets will be retransmitted if NACKed. Settings are constructed by |
| 762 | * combining the constants in enum RetransmissionMode with bitwise OR. |
| 763 | * All packets are retransmitted if kRetransmitAllPackets is set, while no |
| 764 | * packets are retransmitted if kRetransmitOff is set. |
| 765 | * By default all packets except FEC packets are retransmitted. For VP8 |
| 766 | * with temporal scalability only base layer packets are retransmitted. |
| 767 | * |
| 768 | * Returns -1 on failure, otherwise 0. |
| 769 | */ |
| 770 | virtual int SetSelectiveRetransmissions(uint8_t settings) = 0; |
| 771 | |
| 772 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 773 | * Send a Negative acknowledgement packet |
| 774 | * |
| 775 | * return -1 on failure else 0 |
| 776 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 777 | virtual int32_t SendNACK(const uint16_t* nackList, |
| 778 | const uint16_t size) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 779 | |
| 780 | /* |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 781 | * Store the sent packets, needed to answer to a Negative acknowledgement |
| 782 | * requests |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 783 | * |
| 784 | * return -1 on failure else 0 |
| 785 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 786 | virtual int32_t SetStorePacketsStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 787 | const bool enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 788 | const uint16_t numberToStore) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 789 | |
| 790 | /************************************************************************** |
| 791 | * |
| 792 | * Audio |
| 793 | * |
| 794 | ***************************************************************************/ |
| 795 | |
| 796 | /* |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 797 | * set audio packet size, used to determine when it's time to send a DTMF |
| 798 | * packet in silence (CNG) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 799 | * |
| 800 | * return -1 on failure else 0 |
| 801 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 802 | virtual int32_t SetAudioPacketSize( |
| 803 | const uint16_t packetSizeSamples) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 804 | |
| 805 | /* |
turaj@webrtc.org | b7edd06 | 2013-03-12 22:27:27 +0000 | [diff] [blame] | 806 | * Forward DTMF to decoder for playout. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 807 | * |
| 808 | * return -1 on failure else 0 |
| 809 | */ |
turaj@webrtc.org | b7edd06 | 2013-03-12 22:27:27 +0000 | [diff] [blame] | 810 | virtual int SetTelephoneEventForwardToDecoder(bool forwardToDecoder) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 811 | |
| 812 | /* |
| 813 | * Returns true if received DTMF events are forwarded to the decoder using |
| 814 | * the OnPlayTelephoneEvent callback. |
| 815 | */ |
| 816 | virtual bool TelephoneEventForwardToDecoder() const = 0; |
| 817 | |
| 818 | /* |
| 819 | * SendTelephoneEventActive |
| 820 | * |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 821 | * return true if we currently send a telephone event and 100 ms after an |
| 822 | * event is sent used to prevent the telephone event tone to be recorded |
| 823 | * by the microphone and send inband just after the tone has ended. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 824 | */ |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 825 | virtual bool SendTelephoneEventActive( |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 826 | int8_t& telephoneEvent) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 827 | |
| 828 | /* |
| 829 | * Send a TelephoneEvent tone using RFC 2833 (4733) |
| 830 | * |
| 831 | * return -1 on failure else 0 |
| 832 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 833 | virtual int32_t SendTelephoneEventOutband( |
| 834 | const uint8_t key, |
| 835 | const uint16_t time_ms, |
| 836 | const uint8_t level) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 837 | |
| 838 | /* |
| 839 | * Set payload type for Redundant Audio Data RFC 2198 |
| 840 | * |
| 841 | * return -1 on failure else 0 |
| 842 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 843 | virtual int32_t SetSendREDPayloadType( |
| 844 | const int8_t payloadType) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 845 | |
| 846 | /* |
| 847 | * Get payload type for Redundant Audio Data RFC 2198 |
| 848 | * |
| 849 | * return -1 on failure else 0 |
| 850 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 851 | virtual int32_t SendREDPayloadType( |
| 852 | int8_t& payloadType) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 853 | |
| 854 | /* |
| 855 | * Set status and ID for header-extension-for-audio-level-indication. |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 856 | * See http://tools.ietf.org/html/rfc6464 for more details. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 857 | * |
| 858 | * return -1 on failure else 0 |
| 859 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 860 | virtual int32_t SetRTPAudioLevelIndicationStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 861 | const bool enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 862 | const uint8_t ID) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 863 | |
| 864 | /* |
| 865 | * Get status and ID for header-extension-for-audio-level-indication. |
| 866 | * |
| 867 | * return -1 on failure else 0 |
| 868 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 869 | virtual int32_t GetRTPAudioLevelIndicationStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 870 | bool& enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 871 | uint8_t& ID) const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 872 | |
| 873 | /* |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 874 | * Store the audio level in dBov for header-extension-for-audio-level- |
| 875 | * indication. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 876 | * This API shall be called before transmision of an RTP packet to ensure |
| 877 | * that the |level| part of the extended RTP header is updated. |
| 878 | * |
| 879 | * return -1 on failure else 0. |
| 880 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 881 | virtual int32_t SetAudioLevel(const uint8_t level_dBov) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 882 | |
| 883 | /************************************************************************** |
| 884 | * |
| 885 | * Video |
| 886 | * |
| 887 | ***************************************************************************/ |
| 888 | |
| 889 | /* |
stefan@webrtc.org | 7da3459 | 2013-04-09 14:56:29 +0000 | [diff] [blame] | 890 | * Set the estimated camera delay in MS |
| 891 | * |
| 892 | * return -1 on failure else 0 |
| 893 | */ |
| 894 | virtual int32_t SetCameraDelay(const int32_t delayMS) = 0; |
| 895 | |
| 896 | /* |
pwestin@webrtc.org | 49888ce | 2012-04-27 05:25:53 +0000 | [diff] [blame] | 897 | * Set the target send bitrate |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 898 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 899 | virtual void SetTargetSendBitrate(const uint32_t bitrate) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 900 | |
| 901 | /* |
| 902 | * Turn on/off generic FEC |
| 903 | * |
| 904 | * return -1 on failure else 0 |
| 905 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 906 | virtual int32_t SetGenericFECStatus( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 907 | const bool enable, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 908 | const uint8_t payloadTypeRED, |
| 909 | const uint8_t payloadTypeFEC) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 910 | |
| 911 | /* |
| 912 | * Get generic FEC setting |
| 913 | * |
| 914 | * return -1 on failure else 0 |
| 915 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 916 | virtual int32_t GenericFECStatus(bool& enable, |
| 917 | uint8_t& payloadTypeRED, |
| 918 | uint8_t& payloadTypeFEC) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 919 | |
marpan@google.com | 80c5d7a | 2011-07-15 21:32:40 +0000 | [diff] [blame] | 920 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 921 | virtual int32_t SetFecParameters( |
stefan@webrtc.org | e0d6fa4 | 2012-03-20 22:10:56 +0000 | [diff] [blame] | 922 | const FecProtectionParams* delta_params, |
| 923 | const FecProtectionParams* key_params) = 0; |
marpan@google.com | 80c5d7a | 2011-07-15 21:32:40 +0000 | [diff] [blame] | 924 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 925 | /* |
| 926 | * Set method for requestion a new key frame |
| 927 | * |
| 928 | * return -1 on failure else 0 |
| 929 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 930 | virtual int32_t SetKeyFrameRequestMethod( |
pwestin@webrtc.org | 2853dde | 2012-05-11 11:08:54 +0000 | [diff] [blame] | 931 | const KeyFrameRequestMethod method) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 932 | |
| 933 | /* |
| 934 | * send a request for a keyframe |
| 935 | * |
| 936 | * return -1 on failure else 0 |
| 937 | */ |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 938 | virtual int32_t RequestKeyFrame() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 939 | }; |
| 940 | } // namespace webrtc |
| 941 | #endif // WEBRTC_MODULES_RTP_RTCP_INTERFACE_RTP_RTCP_H_ |