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