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.

121 lines
3.5 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. #include "call/rtp_config.h"
  11. #include <cstdint>
  12. #include "api/array_view.h"
  13. #include "rtc_base/strings/string_builder.h"
  14. namespace webrtc {
  15. std::string LntfConfig::ToString() const {
  16. return enabled ? "{enabled: true}" : "{enabled: false}";
  17. }
  18. std::string NackConfig::ToString() const {
  19. char buf[1024];
  20. rtc::SimpleStringBuilder ss(buf);
  21. ss << "{rtp_history_ms: " << rtp_history_ms;
  22. ss << '}';
  23. return ss.str();
  24. }
  25. std::string UlpfecConfig::ToString() const {
  26. char buf[1024];
  27. rtc::SimpleStringBuilder ss(buf);
  28. ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
  29. ss << ", red_payload_type: " << red_payload_type;
  30. ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
  31. ss << '}';
  32. return ss.str();
  33. }
  34. bool UlpfecConfig::operator==(const UlpfecConfig& other) const {
  35. return ulpfec_payload_type == other.ulpfec_payload_type &&
  36. red_payload_type == other.red_payload_type &&
  37. red_rtx_payload_type == other.red_rtx_payload_type;
  38. }
  39. RtpConfig::RtpConfig() = default;
  40. RtpConfig::RtpConfig(const RtpConfig&) = default;
  41. RtpConfig::~RtpConfig() = default;
  42. RtpConfig::Flexfec::Flexfec() = default;
  43. RtpConfig::Flexfec::Flexfec(const Flexfec&) = default;
  44. RtpConfig::Flexfec::~Flexfec() = default;
  45. std::string RtpConfig::ToString() const {
  46. char buf[2 * 1024];
  47. rtc::SimpleStringBuilder ss(buf);
  48. ss << "{ssrcs: [";
  49. for (size_t i = 0; i < ssrcs.size(); ++i) {
  50. ss << ssrcs[i];
  51. if (i != ssrcs.size() - 1)
  52. ss << ", ";
  53. }
  54. ss << ']';
  55. ss << ", rtcp_mode: "
  56. << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound"
  57. : "RtcpMode::kReducedSize");
  58. ss << ", max_packet_size: " << max_packet_size;
  59. ss << ", extmap-allow-mixed: " << (extmap_allow_mixed ? "true" : "false");
  60. ss << ", extensions: [";
  61. for (size_t i = 0; i < extensions.size(); ++i) {
  62. ss << extensions[i].ToString();
  63. if (i != extensions.size() - 1)
  64. ss << ", ";
  65. }
  66. ss << ']';
  67. ss << ", lntf: " << lntf.ToString();
  68. ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
  69. ss << ", ulpfec: " << ulpfec.ToString();
  70. ss << ", payload_name: " << payload_name;
  71. ss << ", payload_type: " << payload_type;
  72. ss << ", raw_payload: " << (raw_payload ? "true" : "false");
  73. ss << ", flexfec: {payload_type: " << flexfec.payload_type;
  74. ss << ", ssrc: " << flexfec.ssrc;
  75. ss << ", protected_media_ssrcs: [";
  76. for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
  77. ss << flexfec.protected_media_ssrcs[i];
  78. if (i != flexfec.protected_media_ssrcs.size() - 1)
  79. ss << ", ";
  80. }
  81. ss << "]}";
  82. ss << ", rtx: " << rtx.ToString();
  83. ss << ", c_name: " << c_name;
  84. ss << '}';
  85. return ss.str();
  86. }
  87. RtpConfig::Rtx::Rtx() = default;
  88. RtpConfig::Rtx::Rtx(const Rtx&) = default;
  89. RtpConfig::Rtx::~Rtx() = default;
  90. std::string RtpConfig::Rtx::ToString() const {
  91. char buf[1024];
  92. rtc::SimpleStringBuilder ss(buf);
  93. ss << "{ssrcs: [";
  94. for (size_t i = 0; i < ssrcs.size(); ++i) {
  95. ss << ssrcs[i];
  96. if (i != ssrcs.size() - 1)
  97. ss << ", ";
  98. }
  99. ss << ']';
  100. ss << ", payload_type: " << payload_type;
  101. ss << '}';
  102. return ss.str();
  103. }
  104. } // namespace webrtc