Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 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_INCLUDE_RTP_RTCP_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ |
| 13 | |
| 14 | #include <set> |
Peter Boström | 9c01725 | 2016-02-26 16:26:20 +0100 | [diff] [blame] | 15 | #include <string> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 16 | #include <utility> |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 17 | #include <vector> |
| 18 | |
| 19 | #include "webrtc/modules/include/module.h" |
| 20 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame^] | 21 | #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | // Forward declarations. |
| 25 | class ReceiveStatistics; |
| 26 | class RemoteBitrateEstimator; |
| 27 | class RtpReceiver; |
| 28 | class Transport; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 29 | class RtcEventLog; |
| 30 | |
Peter Boström | 9c01725 | 2016-02-26 16:26:20 +0100 | [diff] [blame] | 31 | RTPExtensionType StringToRtpExtensionType(const std::string& extension); |
| 32 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 33 | namespace rtcp { |
| 34 | class TransportFeedback; |
| 35 | } |
| 36 | |
| 37 | class RtpRtcp : public Module { |
| 38 | public: |
| 39 | struct Configuration { |
| 40 | Configuration(); |
| 41 | |
| 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. May not be NULL; default callback will do |
| 49 | * nothing. |
| 50 | * incoming_messages - Callback object that will receive the incoming |
| 51 | * RTP messages. May not be NULL; default callback |
| 52 | * will do nothing. |
| 53 | * outgoing_transport - Transport object that will be called when packets |
| 54 | * are ready to be sent out on the network |
| 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 - Telephone events. May not be NULL; default |
| 59 | * callback will do nothing. |
| 60 | * remote_bitrate_estimator - Estimates the bandwidth available for a set of |
| 61 | * streams from the same client. |
| 62 | * paced_sender - Spread any bursts of packets into smaller |
| 63 | * bursts to minimize packet loss. |
| 64 | */ |
| 65 | bool audio; |
| 66 | bool receiver_only; |
| 67 | Clock* clock; |
| 68 | ReceiveStatistics* receive_statistics; |
| 69 | Transport* outgoing_transport; |
| 70 | RtcpIntraFrameObserver* intra_frame_callback; |
| 71 | RtcpBandwidthObserver* bandwidth_callback; |
| 72 | TransportFeedbackObserver* transport_feedback_callback; |
| 73 | RtcpRttStats* rtt_stats; |
| 74 | RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer; |
| 75 | RtpAudioFeedback* audio_messages; |
| 76 | RemoteBitrateEstimator* remote_bitrate_estimator; |
| 77 | RtpPacketSender* paced_sender; |
| 78 | TransportSequenceNumberAllocator* transport_sequence_number_allocator; |
| 79 | BitrateStatisticsObserver* send_bitrate_observer; |
| 80 | FrameCountObserver* send_frame_count_observer; |
| 81 | SendSideDelayObserver* send_side_delay_observer; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 82 | RtcEventLog* event_log; |
| 83 | |
| 84 | RTC_DISALLOW_COPY_AND_ASSIGN(Configuration); |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | /* |
| 88 | * Create a RTP/RTCP module object using the system clock. |
| 89 | * |
| 90 | * configuration - Configuration of the RTP/RTCP module. |
| 91 | */ |
| 92 | static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration); |
| 93 | |
| 94 | /************************************************************************** |
| 95 | * |
| 96 | * Receiver functions |
| 97 | * |
| 98 | ***************************************************************************/ |
| 99 | |
| 100 | virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet, |
| 101 | size_t incoming_packet_length) = 0; |
| 102 | |
| 103 | virtual void SetRemoteSSRC(uint32_t ssrc) = 0; |
| 104 | |
| 105 | /************************************************************************** |
| 106 | * |
| 107 | * Sender |
| 108 | * |
| 109 | ***************************************************************************/ |
| 110 | |
| 111 | /* |
| 112 | * set MTU |
| 113 | * |
| 114 | * size - Max transfer unit in bytes, default is 1500 |
| 115 | * |
| 116 | * return -1 on failure else 0 |
| 117 | */ |
| 118 | virtual int32_t SetMaxTransferUnit(uint16_t size) = 0; |
| 119 | |
| 120 | /* |
| 121 | * set transtport overhead |
| 122 | * default is IPv4 and UDP with no encryption |
| 123 | * |
| 124 | * TCP - true for TCP false UDP |
| 125 | * IPv6 - true for IP version 6 false for version 4 |
| 126 | * authenticationOverhead - number of bytes to leave for an |
| 127 | * authentication header |
| 128 | * |
| 129 | * return -1 on failure else 0 |
| 130 | */ |
| 131 | virtual int32_t SetTransportOverhead( |
| 132 | bool TCP, |
| 133 | bool IPV6, |
| 134 | uint8_t authenticationOverhead = 0) = 0; |
| 135 | |
| 136 | /* |
| 137 | * Get max payload length |
| 138 | * |
| 139 | * A combination of the configuration MaxTransferUnit and |
| 140 | * TransportOverhead. |
| 141 | * Does not account FEC/ULP/RED overhead if FEC is enabled. |
| 142 | * Does not account for RTP headers |
| 143 | */ |
| 144 | virtual uint16_t MaxPayloadLength() const = 0; |
| 145 | |
| 146 | /* |
| 147 | * Get max data payload length |
| 148 | * |
| 149 | * A combination of the configuration MaxTransferUnit, headers and |
| 150 | * TransportOverhead. |
| 151 | * Takes into account FEC/ULP/RED overhead if FEC is enabled. |
| 152 | * Takes into account RTP headers |
| 153 | */ |
| 154 | virtual uint16_t MaxDataPayloadLength() const = 0; |
| 155 | |
| 156 | /* |
| 157 | * set codec name and payload type |
| 158 | * |
| 159 | * return -1 on failure else 0 |
| 160 | */ |
| 161 | virtual int32_t RegisterSendPayload( |
| 162 | const CodecInst& voiceCodec) = 0; |
| 163 | |
| 164 | /* |
| 165 | * set codec name and payload type |
| 166 | * |
| 167 | * return -1 on failure else 0 |
| 168 | */ |
| 169 | virtual int32_t RegisterSendPayload( |
| 170 | const VideoCodec& videoCodec) = 0; |
| 171 | |
Peter Boström | 8b79b07 | 2016-02-26 16:31:37 +0100 | [diff] [blame] | 172 | virtual void RegisterVideoSendPayload(int payload_type, |
| 173 | const char* payload_name) = 0; |
| 174 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 175 | /* |
| 176 | * Unregister a send payload |
| 177 | * |
| 178 | * payloadType - payload type of codec |
| 179 | * |
| 180 | * return -1 on failure else 0 |
| 181 | */ |
| 182 | virtual int32_t DeRegisterSendPayload(int8_t payloadType) = 0; |
| 183 | |
| 184 | /* |
| 185 | * (De)register RTP header extension type and id. |
| 186 | * |
| 187 | * return -1 on failure else 0 |
| 188 | */ |
| 189 | virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, |
| 190 | uint8_t id) = 0; |
| 191 | |
| 192 | virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0; |
| 193 | |
| 194 | /* |
| 195 | * get start timestamp |
| 196 | */ |
| 197 | virtual uint32_t StartTimestamp() const = 0; |
| 198 | |
| 199 | /* |
| 200 | * configure start timestamp, default is a random number |
| 201 | * |
| 202 | * timestamp - start timestamp |
| 203 | */ |
| 204 | virtual void SetStartTimestamp(uint32_t timestamp) = 0; |
| 205 | |
| 206 | /* |
| 207 | * Get SequenceNumber |
| 208 | */ |
| 209 | virtual uint16_t SequenceNumber() const = 0; |
| 210 | |
| 211 | /* |
| 212 | * Set SequenceNumber, default is a random number |
| 213 | */ |
| 214 | virtual void SetSequenceNumber(uint16_t seq) = 0; |
| 215 | |
| 216 | // Returns true if the ssrc matched this module, false otherwise. |
| 217 | virtual bool SetRtpStateForSsrc(uint32_t ssrc, |
| 218 | const RtpState& rtp_state) = 0; |
| 219 | virtual bool GetRtpStateForSsrc(uint32_t ssrc, RtpState* rtp_state) = 0; |
| 220 | |
| 221 | /* |
| 222 | * Get SSRC |
| 223 | */ |
| 224 | virtual uint32_t SSRC() const = 0; |
| 225 | |
| 226 | /* |
| 227 | * configure SSRC, default is a random number |
| 228 | */ |
| 229 | virtual void SetSSRC(uint32_t ssrc) = 0; |
| 230 | |
| 231 | /* |
| 232 | * Set CSRC |
| 233 | * |
| 234 | * csrcs - vector of CSRCs |
| 235 | */ |
| 236 | virtual void SetCsrcs(const std::vector<uint32_t>& csrcs) = 0; |
| 237 | |
| 238 | /* |
| 239 | * Turn on/off sending RTX (RFC 4588). The modes can be set as a combination |
| 240 | * of values of the enumerator RtxMode. |
| 241 | */ |
| 242 | virtual void SetRtxSendStatus(int modes) = 0; |
| 243 | |
| 244 | /* |
| 245 | * Get status of sending RTX (RFC 4588). The returned value can be |
| 246 | * a combination of values of the enumerator RtxMode. |
| 247 | */ |
| 248 | virtual int RtxSendStatus() const = 0; |
| 249 | |
| 250 | // Sets the SSRC to use when sending RTX packets. This doesn't enable RTX, |
| 251 | // only the SSRC is set. |
| 252 | virtual void SetRtxSsrc(uint32_t ssrc) = 0; |
| 253 | |
| 254 | // Sets the payload type to use when sending RTX packets. Note that this |
| 255 | // doesn't enable RTX, only the payload type is set. |
| 256 | virtual void SetRtxSendPayloadType(int payload_type, |
| 257 | int associated_payload_type) = 0; |
| 258 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 259 | /* |
| 260 | * sends kRtcpByeCode when going from true to false |
| 261 | * |
| 262 | * sending - on/off |
| 263 | * |
| 264 | * return -1 on failure else 0 |
| 265 | */ |
| 266 | virtual int32_t SetSendingStatus(bool sending) = 0; |
| 267 | |
| 268 | /* |
| 269 | * get send status |
| 270 | */ |
| 271 | virtual bool Sending() const = 0; |
| 272 | |
| 273 | /* |
| 274 | * Starts/Stops media packets, on by default |
| 275 | * |
| 276 | * sending - on/off |
| 277 | */ |
| 278 | virtual void SetSendingMediaStatus(bool sending) = 0; |
| 279 | |
| 280 | /* |
| 281 | * get send status |
| 282 | */ |
| 283 | virtual bool SendingMedia() const = 0; |
| 284 | |
| 285 | /* |
| 286 | * get sent bitrate in Kbit/s |
| 287 | */ |
| 288 | virtual void BitrateSent(uint32_t* totalRate, |
| 289 | uint32_t* videoRate, |
| 290 | uint32_t* fecRate, |
| 291 | uint32_t* nackRate) const = 0; |
| 292 | |
| 293 | /* |
| 294 | * Used by the codec module to deliver a video or audio frame for |
| 295 | * packetization. |
| 296 | * |
| 297 | * frameType - type of frame to send |
| 298 | * payloadType - payload type of frame to send |
| 299 | * timestamp - timestamp of frame to send |
| 300 | * payloadData - payload buffer of frame to send |
| 301 | * payloadSize - size of payload buffer to send |
| 302 | * fragmentation - fragmentation offset data for fragmented frames such |
| 303 | * as layers or RED |
| 304 | * |
| 305 | * return -1 on failure else 0 |
| 306 | */ |
| 307 | virtual int32_t SendOutgoingData( |
| 308 | FrameType frameType, |
| 309 | int8_t payloadType, |
| 310 | uint32_t timeStamp, |
| 311 | int64_t capture_time_ms, |
| 312 | const uint8_t* payloadData, |
| 313 | size_t payloadSize, |
| 314 | const RTPFragmentationHeader* fragmentation = NULL, |
| 315 | const RTPVideoHeader* rtpVideoHdr = NULL) = 0; |
| 316 | |
| 317 | virtual bool TimeToSendPacket(uint32_t ssrc, |
| 318 | uint16_t sequence_number, |
| 319 | int64_t capture_time_ms, |
| 320 | bool retransmission) = 0; |
| 321 | |
| 322 | virtual size_t TimeToSendPadding(size_t bytes) = 0; |
| 323 | |
| 324 | // Called on generation of new statistics after an RTP send. |
| 325 | virtual void RegisterSendChannelRtpStatisticsCallback( |
| 326 | StreamDataCountersCallback* callback) = 0; |
| 327 | virtual StreamDataCountersCallback* |
| 328 | GetSendChannelRtpStatisticsCallback() const = 0; |
| 329 | |
| 330 | /************************************************************************** |
| 331 | * |
| 332 | * RTCP |
| 333 | * |
| 334 | ***************************************************************************/ |
| 335 | |
| 336 | /* |
| 337 | * Get RTCP status |
| 338 | */ |
| 339 | virtual RtcpMode RTCP() const = 0; |
| 340 | |
| 341 | /* |
| 342 | * configure RTCP status i.e on(compound or non- compound)/off |
| 343 | * |
| 344 | * method - RTCP method to use |
| 345 | */ |
| 346 | virtual void SetRTCPStatus(RtcpMode method) = 0; |
| 347 | |
| 348 | /* |
| 349 | * Set RTCP CName (i.e unique identifier) |
| 350 | * |
| 351 | * return -1 on failure else 0 |
| 352 | */ |
| 353 | virtual int32_t SetCNAME(const char* c_name) = 0; |
| 354 | |
| 355 | /* |
| 356 | * Get remote CName |
| 357 | * |
| 358 | * return -1 on failure else 0 |
| 359 | */ |
| 360 | virtual int32_t RemoteCNAME(uint32_t remoteSSRC, |
| 361 | char cName[RTCP_CNAME_SIZE]) const = 0; |
| 362 | |
| 363 | /* |
| 364 | * Get remote NTP |
| 365 | * |
| 366 | * return -1 on failure else 0 |
| 367 | */ |
| 368 | virtual int32_t RemoteNTP( |
| 369 | uint32_t *ReceivedNTPsecs, |
| 370 | uint32_t *ReceivedNTPfrac, |
| 371 | uint32_t *RTCPArrivalTimeSecs, |
| 372 | uint32_t *RTCPArrivalTimeFrac, |
| 373 | uint32_t *rtcp_timestamp) const = 0; |
| 374 | |
| 375 | /* |
| 376 | * AddMixedCNAME |
| 377 | * |
| 378 | * return -1 on failure else 0 |
| 379 | */ |
| 380 | virtual int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name) = 0; |
| 381 | |
| 382 | /* |
| 383 | * RemoveMixedCNAME |
| 384 | * |
| 385 | * return -1 on failure else 0 |
| 386 | */ |
| 387 | virtual int32_t RemoveMixedCNAME(uint32_t SSRC) = 0; |
| 388 | |
| 389 | /* |
| 390 | * Get RoundTripTime |
| 391 | * |
| 392 | * return -1 on failure else 0 |
| 393 | */ |
| 394 | virtual int32_t RTT(uint32_t remoteSSRC, |
| 395 | int64_t* RTT, |
| 396 | int64_t* avgRTT, |
| 397 | int64_t* minRTT, |
| 398 | int64_t* maxRTT) const = 0; |
| 399 | |
| 400 | /* |
| 401 | * Force a send of a RTCP packet |
| 402 | * periodic SR and RR are triggered via the process function |
| 403 | * |
| 404 | * return -1 on failure else 0 |
| 405 | */ |
| 406 | virtual int32_t SendRTCP(RTCPPacketType rtcpPacketType) = 0; |
| 407 | |
| 408 | /* |
| 409 | * Force a send of a RTCP packet with more than one packet type. |
| 410 | * periodic SR and RR are triggered via the process function |
| 411 | * |
| 412 | * return -1 on failure else 0 |
| 413 | */ |
| 414 | virtual int32_t SendCompoundRTCP( |
| 415 | const std::set<RTCPPacketType>& rtcpPacketTypes) = 0; |
| 416 | |
| 417 | /* |
| 418 | * Good state of RTP receiver inform sender |
| 419 | */ |
| 420 | virtual int32_t SendRTCPReferencePictureSelection( |
| 421 | const uint64_t pictureID) = 0; |
| 422 | |
| 423 | /* |
| 424 | * Send a RTCP Slice Loss Indication (SLI) |
| 425 | * 6 least significant bits of pictureID |
| 426 | */ |
| 427 | virtual int32_t SendRTCPSliceLossIndication(uint8_t pictureID) = 0; |
| 428 | |
| 429 | /* |
| 430 | * Statistics of the amount of data sent |
| 431 | * |
| 432 | * return -1 on failure else 0 |
| 433 | */ |
| 434 | virtual int32_t DataCountersRTP( |
| 435 | size_t* bytesSent, |
| 436 | uint32_t* packetsSent) const = 0; |
| 437 | |
| 438 | /* |
| 439 | * Get send statistics for the RTP and RTX stream. |
| 440 | */ |
| 441 | virtual void GetSendStreamDataCounters( |
| 442 | StreamDataCounters* rtp_counters, |
| 443 | StreamDataCounters* rtx_counters) const = 0; |
| 444 | |
| 445 | /* |
| 446 | * Get packet loss statistics for the RTP stream. |
| 447 | */ |
| 448 | virtual void GetRtpPacketLossStats( |
| 449 | bool outgoing, |
| 450 | uint32_t ssrc, |
| 451 | struct RtpPacketLossStats* loss_stats) const = 0; |
| 452 | |
| 453 | /* |
| 454 | * Get received RTCP sender info |
| 455 | * |
| 456 | * return -1 on failure else 0 |
| 457 | */ |
| 458 | virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0; |
| 459 | |
| 460 | /* |
| 461 | * Get received RTCP report block |
| 462 | * |
| 463 | * return -1 on failure else 0 |
| 464 | */ |
| 465 | virtual int32_t RemoteRTCPStat( |
| 466 | std::vector<RTCPReportBlock>* receiveBlocks) const = 0; |
| 467 | |
| 468 | /* |
| 469 | * (APP) Application specific data |
| 470 | * |
| 471 | * return -1 on failure else 0 |
| 472 | */ |
| 473 | virtual int32_t SetRTCPApplicationSpecificData(uint8_t subType, |
| 474 | uint32_t name, |
| 475 | const uint8_t* data, |
| 476 | uint16_t length) = 0; |
| 477 | /* |
| 478 | * (XR) VOIP metric |
| 479 | * |
| 480 | * return -1 on failure else 0 |
| 481 | */ |
| 482 | virtual int32_t SetRTCPVoIPMetrics( |
| 483 | const RTCPVoIPMetric* VoIPMetric) = 0; |
| 484 | |
| 485 | /* |
| 486 | * (XR) Receiver Reference Time Report |
| 487 | */ |
| 488 | virtual void SetRtcpXrRrtrStatus(bool enable) = 0; |
| 489 | |
| 490 | virtual bool RtcpXrRrtrStatus() const = 0; |
| 491 | |
| 492 | /* |
| 493 | * (REMB) Receiver Estimated Max Bitrate |
| 494 | */ |
| 495 | virtual bool REMB() const = 0; |
| 496 | |
| 497 | virtual void SetREMBStatus(bool enable) = 0; |
| 498 | |
| 499 | virtual void SetREMBData(uint32_t bitrate, |
| 500 | const std::vector<uint32_t>& ssrcs) = 0; |
| 501 | |
| 502 | /* |
| 503 | * (TMMBR) Temporary Max Media Bit Rate |
| 504 | */ |
| 505 | virtual bool TMMBR() const = 0; |
| 506 | |
| 507 | virtual void SetTMMBRStatus(bool enable) = 0; |
| 508 | |
| 509 | /* |
| 510 | * (NACK) |
| 511 | */ |
| 512 | |
| 513 | /* |
| 514 | * TODO(holmer): Propagate this API to VideoEngine. |
| 515 | * Returns the currently configured selective retransmission settings. |
| 516 | */ |
| 517 | virtual int SelectiveRetransmissions() const = 0; |
| 518 | |
| 519 | /* |
| 520 | * TODO(holmer): Propagate this API to VideoEngine. |
| 521 | * Sets the selective retransmission settings, which will decide which |
| 522 | * packets will be retransmitted if NACKed. Settings are constructed by |
| 523 | * combining the constants in enum RetransmissionMode with bitwise OR. |
| 524 | * All packets are retransmitted if kRetransmitAllPackets is set, while no |
| 525 | * packets are retransmitted if kRetransmitOff is set. |
| 526 | * By default all packets except FEC packets are retransmitted. For VP8 |
| 527 | * with temporal scalability only base layer packets are retransmitted. |
| 528 | * |
| 529 | * Returns -1 on failure, otherwise 0. |
| 530 | */ |
| 531 | virtual int SetSelectiveRetransmissions(uint8_t settings) = 0; |
| 532 | |
| 533 | /* |
| 534 | * Send a Negative acknowledgement packet |
| 535 | * |
| 536 | * return -1 on failure else 0 |
| 537 | */ |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame^] | 538 | // TODO(philipel): Deprecate this and start using SendNack instead, |
| 539 | // mostly because we want a function that actually send |
| 540 | // NACK for the specified packets. |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 541 | virtual int32_t SendNACK(const uint16_t* nackList, uint16_t size) = 0; |
| 542 | |
| 543 | /* |
philipel | 83f831a | 2016-03-12 03:30:23 -0800 | [diff] [blame^] | 544 | * Send NACK for the packets specified. |
| 545 | */ |
| 546 | virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0; |
| 547 | |
| 548 | /* |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 549 | * Store the sent packets, needed to answer to a Negative acknowledgement |
| 550 | * requests |
| 551 | */ |
| 552 | virtual void SetStorePacketsStatus(bool enable, uint16_t numberToStore) = 0; |
| 553 | |
| 554 | // Returns true if the module is configured to store packets. |
| 555 | virtual bool StorePackets() const = 0; |
| 556 | |
| 557 | // Called on receipt of RTCP report block from remote side. |
| 558 | virtual void RegisterRtcpStatisticsCallback( |
| 559 | RtcpStatisticsCallback* callback) = 0; |
| 560 | virtual RtcpStatisticsCallback* |
| 561 | GetRtcpStatisticsCallback() = 0; |
| 562 | // BWE feedback packets. |
| 563 | virtual bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) = 0; |
| 564 | |
| 565 | /************************************************************************** |
| 566 | * |
| 567 | * Audio |
| 568 | * |
| 569 | ***************************************************************************/ |
| 570 | |
| 571 | /* |
| 572 | * set audio packet size, used to determine when it's time to send a DTMF |
| 573 | * packet in silence (CNG) |
| 574 | * |
| 575 | * return -1 on failure else 0 |
| 576 | */ |
| 577 | virtual int32_t SetAudioPacketSize(uint16_t packetSizeSamples) = 0; |
| 578 | |
| 579 | /* |
| 580 | * Send a TelephoneEvent tone using RFC 2833 (4733) |
| 581 | * |
| 582 | * return -1 on failure else 0 |
| 583 | */ |
| 584 | virtual int32_t SendTelephoneEventOutband(uint8_t key, |
| 585 | uint16_t time_ms, |
| 586 | uint8_t level) = 0; |
| 587 | |
| 588 | /* |
| 589 | * Set payload type for Redundant Audio Data RFC 2198 |
| 590 | * |
| 591 | * return -1 on failure else 0 |
| 592 | */ |
| 593 | virtual int32_t SetSendREDPayloadType(int8_t payloadType) = 0; |
| 594 | |
| 595 | /* |
| 596 | * Get payload type for Redundant Audio Data RFC 2198 |
| 597 | * |
| 598 | * return -1 on failure else 0 |
| 599 | */ |
danilchap | 5c1def8 | 2015-12-10 09:51:54 -0800 | [diff] [blame] | 600 | // DEPRECATED. Use SendREDPayloadType below that takes output parameter |
| 601 | // by pointer instead of by reference. |
| 602 | // TODO(danilchap): Remove this when all callers have been updated. |
| 603 | int32_t SendREDPayloadType(int8_t& payloadType) const { // NOLINT |
| 604 | return SendREDPayloadType(&payloadType); |
| 605 | } |
| 606 | virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0; |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 607 | /* |
| 608 | * Store the audio level in dBov for header-extension-for-audio-level- |
| 609 | * indication. |
| 610 | * This API shall be called before transmision of an RTP packet to ensure |
| 611 | * that the |level| part of the extended RTP header is updated. |
| 612 | * |
| 613 | * return -1 on failure else 0. |
| 614 | */ |
| 615 | virtual int32_t SetAudioLevel(uint8_t level_dBov) = 0; |
| 616 | |
| 617 | /************************************************************************** |
| 618 | * |
| 619 | * Video |
| 620 | * |
| 621 | ***************************************************************************/ |
| 622 | |
| 623 | /* |
| 624 | * Set the target send bitrate |
| 625 | */ |
| 626 | virtual void SetTargetSendBitrate(uint32_t bitrate_bps) = 0; |
| 627 | |
| 628 | /* |
| 629 | * Turn on/off generic FEC |
| 630 | */ |
| 631 | virtual void SetGenericFECStatus(bool enable, |
| 632 | uint8_t payload_type_red, |
| 633 | uint8_t payload_type_fec) = 0; |
| 634 | |
| 635 | /* |
| 636 | * Get generic FEC setting |
| 637 | */ |
danilchap | 5c1def8 | 2015-12-10 09:51:54 -0800 | [diff] [blame] | 638 | // DEPRECATED. Use GenericFECStatus below that takes output parameters |
| 639 | // by pointers instead of by references. |
| 640 | // TODO(danilchap): Remove this when all callers have been updated. |
| 641 | void GenericFECStatus(bool& enable, // NOLINT |
| 642 | uint8_t& payloadTypeRED, // NOLINT |
| 643 | uint8_t& payloadTypeFEC) { // NOLINT |
| 644 | GenericFECStatus(&enable, &payloadTypeRED, &payloadTypeFEC); |
| 645 | } |
| 646 | virtual void GenericFECStatus(bool* enable, |
| 647 | uint8_t* payload_type_red, |
| 648 | uint8_t* payload_type_fec) = 0; |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 649 | |
| 650 | virtual int32_t SetFecParameters( |
| 651 | const FecProtectionParams* delta_params, |
| 652 | const FecProtectionParams* key_params) = 0; |
| 653 | |
| 654 | /* |
| 655 | * Set method for requestion a new key frame |
| 656 | * |
| 657 | * return -1 on failure else 0 |
| 658 | */ |
| 659 | virtual int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) = 0; |
| 660 | |
| 661 | /* |
| 662 | * send a request for a keyframe |
| 663 | * |
| 664 | * return -1 on failure else 0 |
| 665 | */ |
| 666 | virtual int32_t RequestKeyFrame() = 0; |
| 667 | }; |
| 668 | } // namespace webrtc |
danilchap | 5c1def8 | 2015-12-10 09:51:54 -0800 | [diff] [blame] | 669 | #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ |