You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
4.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #ifndef CALL_RTP_CONFIG_H_
  11. #define CALL_RTP_CONFIG_H_
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. #include <string>
  15. #include <vector>
  16. #include "api/rtp_headers.h"
  17. #include "api/rtp_parameters.h"
  18. namespace webrtc {
  19. // Currently only VP8/VP9 specific.
  20. struct RtpPayloadState {
  21. int16_t picture_id = -1;
  22. uint8_t tl0_pic_idx = 0;
  23. int64_t shared_frame_id = 0;
  24. };
  25. // Settings for LNTF (LossNotification). Still highly experimental.
  26. struct LntfConfig {
  27. std::string ToString() const;
  28. bool enabled{false};
  29. };
  30. // Settings for NACK, see RFC 4585 for details.
  31. struct NackConfig {
  32. NackConfig() : rtp_history_ms(0) {}
  33. std::string ToString() const;
  34. // Send side: the time RTP packets are stored for retransmissions.
  35. // Receive side: the time the receiver is prepared to wait for
  36. // retransmissions.
  37. // Set to '0' to disable.
  38. int rtp_history_ms;
  39. };
  40. // Settings for ULPFEC forward error correction.
  41. // Set the payload types to '-1' to disable.
  42. struct UlpfecConfig {
  43. UlpfecConfig()
  44. : ulpfec_payload_type(-1),
  45. red_payload_type(-1),
  46. red_rtx_payload_type(-1) {}
  47. std::string ToString() const;
  48. bool operator==(const UlpfecConfig& other) const;
  49. // Payload type used for ULPFEC packets.
  50. int ulpfec_payload_type;
  51. // Payload type used for RED packets.
  52. int red_payload_type;
  53. // RTX payload type for RED payload.
  54. int red_rtx_payload_type;
  55. };
  56. static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
  57. struct RtpConfig {
  58. RtpConfig();
  59. RtpConfig(const RtpConfig&);
  60. ~RtpConfig();
  61. std::string ToString() const;
  62. std::vector<uint32_t> ssrcs;
  63. // The Rtp Stream Ids (aka RIDs) to send in the RID RTP header extension
  64. // if the extension is included in the list of extensions.
  65. // If rids are specified, they should correspond to the |ssrcs| vector.
  66. // This means that:
  67. // 1. rids.size() == 0 || rids.size() == ssrcs.size().
  68. // 2. If rids is not empty, then |rids[i]| should use |ssrcs[i]|.
  69. std::vector<std::string> rids;
  70. // The value to send in the MID RTP header extension if the extension is
  71. // included in the list of extensions.
  72. std::string mid;
  73. // See RtcpMode for description.
  74. RtcpMode rtcp_mode = RtcpMode::kCompound;
  75. // Max RTP packet size delivered to send transport from VideoEngine.
  76. size_t max_packet_size = kDefaultMaxPacketSize;
  77. // Corresponds to the SDP attribute extmap-allow-mixed.
  78. bool extmap_allow_mixed = false;
  79. // RTP header extensions to use for this send stream.
  80. std::vector<RtpExtension> extensions;
  81. // TODO(nisse): For now, these are fixed, but we'd like to support
  82. // changing codec without recreating the VideoSendStream. Then these
  83. // fields must be removed, and association between payload type and codec
  84. // must move above the per-stream level. Ownership could be with
  85. // RtpTransportControllerSend, with a reference from PayloadRouter, where
  86. // the latter would be responsible for mapping the codec type of encoded
  87. // images to the right payload type.
  88. std::string payload_name;
  89. int payload_type = -1;
  90. // Payload should be packetized using raw packetizer (payload header will
  91. // not be added, additional meta data is expected to be present in generic
  92. // frame descriptor RTP header extension).
  93. bool raw_payload = false;
  94. // See LntfConfig for description.
  95. LntfConfig lntf;
  96. // See NackConfig for description.
  97. NackConfig nack;
  98. // See UlpfecConfig for description.
  99. UlpfecConfig ulpfec;
  100. struct Flexfec {
  101. Flexfec();
  102. Flexfec(const Flexfec&);
  103. ~Flexfec();
  104. // Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
  105. int payload_type = -1;
  106. // SSRC of FlexFEC stream.
  107. uint32_t ssrc = 0;
  108. // Vector containing a single element, corresponding to the SSRC of the
  109. // media stream being protected by this FlexFEC stream.
  110. // The vector MUST have size 1.
  111. //
  112. // TODO(brandtr): Update comment above when we support
  113. // multistream protection.
  114. std::vector<uint32_t> protected_media_ssrcs;
  115. } flexfec;
  116. // Settings for RTP retransmission payload format, see RFC 4588 for
  117. // details.
  118. struct Rtx {
  119. Rtx();
  120. Rtx(const Rtx&);
  121. ~Rtx();
  122. std::string ToString() const;
  123. // SSRCs to use for the RTX streams.
  124. std::vector<uint32_t> ssrcs;
  125. // Payload type to use for the RTX stream.
  126. int payload_type = -1;
  127. } rtx;
  128. // RTCP CNAME, see RFC 3550.
  129. std::string c_name;
  130. };
  131. } // namespace webrtc
  132. #endif // CALL_RTP_CONFIG_H_