blob: a23351bb5a02cc4271543669a2d027198d1b68ad [file] [log] [blame]
Stefan Holmer1acbd682017-09-01 15:29:28 +02001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#include "call/rtp_config.h"
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020012
Yves Gerey988cc082018-10-23 12:03:01 +020013#include <cstdint>
14
15#include "api/array_view.h"
Jonas Olsson0a713b62018-04-04 15:49:32 +020016#include "rtc_base/strings/string_builder.h"
Stefan Holmer1acbd682017-09-01 15:29:28 +020017
18namespace webrtc {
19
Elad Alonfadb1812019-05-24 13:40:02 +020020std::string LntfConfig::ToString() const {
21 return enabled ? "{enabled: true}" : "{enabled: false}";
22}
23
Stefan Holmer1acbd682017-09-01 15:29:28 +020024std::string NackConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020025 char buf[1024];
26 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020027 ss << "{rtp_history_ms: " << rtp_history_ms;
28 ss << '}';
29 return ss.str();
30}
31
32std::string UlpfecConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020033 char buf[1024];
34 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020035 ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
36 ss << ", red_payload_type: " << red_payload_type;
37 ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
38 ss << '}';
39 return ss.str();
40}
41
42bool UlpfecConfig::operator==(const UlpfecConfig& other) const {
43 return ulpfec_payload_type == other.ulpfec_payload_type &&
44 red_payload_type == other.red_payload_type &&
45 red_rtx_payload_type == other.red_rtx_payload_type;
46}
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020047
48RtpConfig::RtpConfig() = default;
49RtpConfig::RtpConfig(const RtpConfig&) = default;
50RtpConfig::~RtpConfig() = default;
51
52RtpConfig::Flexfec::Flexfec() = default;
53RtpConfig::Flexfec::Flexfec(const Flexfec&) = default;
54RtpConfig::Flexfec::~Flexfec() = default;
55
56std::string RtpConfig::ToString() const {
57 char buf[2 * 1024];
58 rtc::SimpleStringBuilder ss(buf);
59 ss << "{ssrcs: [";
60 for (size_t i = 0; i < ssrcs.size(); ++i) {
61 ss << ssrcs[i];
62 if (i != ssrcs.size() - 1)
63 ss << ", ";
64 }
Rasmus Brandt9df698c2020-03-09 13:53:26 +010065 ss << "], rids: [";
66 for (size_t i = 0; i < rids.size(); ++i) {
67 ss << rids[i];
68 if (i != rids.size() - 1)
69 ss << ", ";
70 }
71 ss << "], mid: '" << mid << "'";
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020072 ss << ", rtcp_mode: "
73 << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound"
74 : "RtcpMode::kReducedSize");
75 ss << ", max_packet_size: " << max_packet_size;
Johannes Kron9190b822018-10-29 11:22:05 +010076 ss << ", extmap-allow-mixed: " << (extmap_allow_mixed ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020077 ss << ", extensions: [";
78 for (size_t i = 0; i < extensions.size(); ++i) {
79 ss << extensions[i].ToString();
80 if (i != extensions.size() - 1)
81 ss << ", ";
82 }
83 ss << ']';
84
Elad Alonfadb1812019-05-24 13:40:02 +020085 ss << ", lntf: " << lntf.ToString();
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020086 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
87 ss << ", ulpfec: " << ulpfec.ToString();
88 ss << ", payload_name: " << payload_name;
89 ss << ", payload_type: " << payload_type;
Mirta Dvornicicfe68daa2019-05-23 13:21:12 +020090 ss << ", raw_payload: " << (raw_payload ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020091
92 ss << ", flexfec: {payload_type: " << flexfec.payload_type;
93 ss << ", ssrc: " << flexfec.ssrc;
94 ss << ", protected_media_ssrcs: [";
95 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
96 ss << flexfec.protected_media_ssrcs[i];
97 if (i != flexfec.protected_media_ssrcs.size() - 1)
98 ss << ", ";
99 }
100 ss << "]}";
101
102 ss << ", rtx: " << rtx.ToString();
103 ss << ", c_name: " << c_name;
104 ss << '}';
105 return ss.str();
106}
107
108RtpConfig::Rtx::Rtx() = default;
109RtpConfig::Rtx::Rtx(const Rtx&) = default;
110RtpConfig::Rtx::~Rtx() = default;
111
112std::string RtpConfig::Rtx::ToString() const {
113 char buf[1024];
114 rtc::SimpleStringBuilder ss(buf);
115 ss << "{ssrcs: [";
116 for (size_t i = 0; i < ssrcs.size(); ++i) {
117 ss << ssrcs[i];
118 if (i != ssrcs.size() - 1)
119 ss << ", ";
120 }
121 ss << ']';
122
123 ss << ", payload_type: " << payload_type;
124 ss << '}';
125 return ss.str();
126}
Stefan Holmer1acbd682017-09-01 15:29:28 +0200127} // namespace webrtc