Stefan Holmer | 1acbd68 | 2017-09-01 13:29:28 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef CALL_RTP_CONFIG_H_ |
| 12 | #define CALL_RTP_CONFIG_H_ |
Stefan Holmer | 1acbd68 | 2017-09-01 13:29:28 | [diff] [blame] | 13 | |
| 14 | #include <string> |
Stefan Holmer | dbdb3a0 | 2018-07-17 14:03:46 | [diff] [blame] | 15 | #include <vector> |
| 16 | |
| 17 | #include "api/rtp_headers.h" |
| 18 | #include "api/rtpparameters.h" |
Stefan Holmer | 1acbd68 | 2017-09-01 13:29:28 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
Stefan Holmer | dbdb3a0 | 2018-07-17 14:03:46 | [diff] [blame] | 21 | // Currently only VP8/VP9 specific. |
| 22 | struct RtpPayloadState { |
| 23 | int16_t picture_id = -1; |
| 24 | uint8_t tl0_pic_idx = 0; |
philipel | 25d31ec | 2018-08-08 14:33:01 | [diff] [blame] | 25 | int64_t shared_frame_id = 0; |
Stefan Holmer | dbdb3a0 | 2018-07-17 14:03:46 | [diff] [blame] | 26 | }; |
Stefan Holmer | 1acbd68 | 2017-09-01 13:29:28 | [diff] [blame] | 27 | // Settings for NACK, see RFC 4585 for details. |
| 28 | struct NackConfig { |
| 29 | NackConfig() : rtp_history_ms(0) {} |
| 30 | std::string ToString() const; |
| 31 | // Send side: the time RTP packets are stored for retransmissions. |
| 32 | // Receive side: the time the receiver is prepared to wait for |
| 33 | // retransmissions. |
| 34 | // Set to '0' to disable. |
| 35 | int rtp_history_ms; |
| 36 | }; |
| 37 | |
| 38 | // Settings for ULPFEC forward error correction. |
| 39 | // Set the payload types to '-1' to disable. |
| 40 | struct UlpfecConfig { |
| 41 | UlpfecConfig() |
| 42 | : ulpfec_payload_type(-1), |
| 43 | red_payload_type(-1), |
| 44 | red_rtx_payload_type(-1) {} |
| 45 | std::string ToString() const; |
| 46 | bool operator==(const UlpfecConfig& other) const; |
| 47 | |
| 48 | // Payload type used for ULPFEC packets. |
| 49 | int ulpfec_payload_type; |
| 50 | |
| 51 | // Payload type used for RED packets. |
| 52 | int red_payload_type; |
| 53 | |
| 54 | // RTX payload type for RED payload. |
| 55 | int red_rtx_payload_type; |
| 56 | }; |
Stefan Holmer | dbdb3a0 | 2018-07-17 14:03:46 | [diff] [blame] | 57 | |
| 58 | static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4. |
| 59 | struct RtpConfig { |
| 60 | RtpConfig(); |
| 61 | RtpConfig(const RtpConfig&); |
| 62 | ~RtpConfig(); |
| 63 | std::string ToString() const; |
| 64 | |
| 65 | std::vector<uint32_t> ssrcs; |
| 66 | |
| 67 | // The value to send in the MID RTP header extension if the extension is |
| 68 | // included in the list of extensions. |
| 69 | std::string mid; |
| 70 | |
| 71 | // See RtcpMode for description. |
| 72 | RtcpMode rtcp_mode = RtcpMode::kCompound; |
| 73 | |
| 74 | // Max RTP packet size delivered to send transport from VideoEngine. |
| 75 | size_t max_packet_size = kDefaultMaxPacketSize; |
| 76 | |
| 77 | // RTP header extensions to use for this send stream. |
| 78 | std::vector<RtpExtension> extensions; |
| 79 | |
| 80 | // TODO(nisse): For now, these are fixed, but we'd like to support |
| 81 | // changing codec without recreating the VideoSendStream. Then these |
| 82 | // fields must be removed, and association between payload type and codec |
| 83 | // must move above the per-stream level. Ownership could be with |
| 84 | // RtpTransportControllerSend, with a reference from PayloadRouter, where |
| 85 | // the latter would be responsible for mapping the codec type of encoded |
| 86 | // images to the right payload type. |
| 87 | std::string payload_name; |
| 88 | int payload_type = -1; |
| 89 | |
| 90 | // See NackConfig for description. |
| 91 | NackConfig nack; |
| 92 | |
| 93 | // See UlpfecConfig for description. |
| 94 | UlpfecConfig ulpfec; |
| 95 | |
| 96 | struct Flexfec { |
| 97 | Flexfec(); |
| 98 | Flexfec(const Flexfec&); |
| 99 | ~Flexfec(); |
| 100 | // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC. |
| 101 | int payload_type = -1; |
| 102 | |
| 103 | // SSRC of FlexFEC stream. |
| 104 | uint32_t ssrc = 0; |
| 105 | |
| 106 | // Vector containing a single element, corresponding to the SSRC of the |
| 107 | // media stream being protected by this FlexFEC stream. |
| 108 | // The vector MUST have size 1. |
| 109 | // |
| 110 | // TODO(brandtr): Update comment above when we support |
| 111 | // multistream protection. |
| 112 | std::vector<uint32_t> protected_media_ssrcs; |
| 113 | } flexfec; |
| 114 | |
| 115 | // Settings for RTP retransmission payload format, see RFC 4588 for |
| 116 | // details. |
| 117 | struct Rtx { |
| 118 | Rtx(); |
| 119 | Rtx(const Rtx&); |
| 120 | ~Rtx(); |
| 121 | std::string ToString() const; |
| 122 | // SSRCs to use for the RTX streams. |
| 123 | std::vector<uint32_t> ssrcs; |
| 124 | |
| 125 | // Payload type to use for the RTX stream. |
| 126 | int payload_type = -1; |
| 127 | } rtx; |
| 128 | |
| 129 | // RTCP CNAME, see RFC 3550. |
| 130 | std::string c_name; |
| 131 | }; |
| 132 | |
| 133 | struct RtcpConfig { |
| 134 | RtcpConfig(); |
| 135 | RtcpConfig(const RtcpConfig&); |
| 136 | ~RtcpConfig(); |
| 137 | std::string ToString() const; |
| 138 | |
| 139 | // Time interval between RTCP report for video |
| 140 | int64_t video_report_interval_ms = 1000; |
| 141 | // Time interval between RTCP report for audio |
| 142 | int64_t audio_report_interval_ms = 5000; |
| 143 | }; |
Stefan Holmer | 1acbd68 | 2017-09-01 13:29:28 | [diff] [blame] | 144 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 145 | #endif // CALL_RTP_CONFIG_H_ |