blob: 7840308ecd45dc1c15a1a70a338a42f85cd76ade [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 }
65 ss << ']';
66 ss << ", rtcp_mode: "
67 << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound"
68 : "RtcpMode::kReducedSize");
69 ss << ", max_packet_size: " << max_packet_size;
Johannes Kron9190b822018-10-29 11:22:05 +010070 ss << ", extmap-allow-mixed: " << (extmap_allow_mixed ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020071 ss << ", extensions: [";
72 for (size_t i = 0; i < extensions.size(); ++i) {
73 ss << extensions[i].ToString();
74 if (i != extensions.size() - 1)
75 ss << ", ";
76 }
77 ss << ']';
78
Elad Alonfadb1812019-05-24 13:40:02 +020079 ss << ", lntf: " << lntf.ToString();
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020080 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
81 ss << ", ulpfec: " << ulpfec.ToString();
82 ss << ", payload_name: " << payload_name;
83 ss << ", payload_type: " << payload_type;
Mirta Dvornicicfe68daa2019-05-23 13:21:12 +020084 ss << ", raw_payload: " << (raw_payload ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020085
86 ss << ", flexfec: {payload_type: " << flexfec.payload_type;
87 ss << ", ssrc: " << flexfec.ssrc;
88 ss << ", protected_media_ssrcs: [";
89 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
90 ss << flexfec.protected_media_ssrcs[i];
91 if (i != flexfec.protected_media_ssrcs.size() - 1)
92 ss << ", ";
93 }
94 ss << "]}";
95
96 ss << ", rtx: " << rtx.ToString();
97 ss << ", c_name: " << c_name;
98 ss << '}';
99 return ss.str();
100}
101
102RtpConfig::Rtx::Rtx() = default;
103RtpConfig::Rtx::Rtx(const Rtx&) = default;
104RtpConfig::Rtx::~Rtx() = default;
105
106std::string RtpConfig::Rtx::ToString() const {
107 char buf[1024];
108 rtc::SimpleStringBuilder ss(buf);
109 ss << "{ssrcs: [";
110 for (size_t i = 0; i < ssrcs.size(); ++i) {
111 ss << ssrcs[i];
112 if (i != ssrcs.size() - 1)
113 ss << ", ";
114 }
115 ss << ']';
116
117 ss << ", payload_type: " << payload_type;
118 ss << '}';
119 return ss.str();
120}
Stefan Holmer1acbd682017-09-01 15:29:28 +0200121} // namespace webrtc