blob: 1445c2552e492948e626998d7e0bc8fabf7914b0 [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
Jonas Olsson0a713b62018-04-04 15:49:32 +020013#include "rtc_base/strings/string_builder.h"
Stefan Holmer1acbd682017-09-01 15:29:28 +020014
15namespace webrtc {
16
17std::string NackConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020018 char buf[1024];
19 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020020 ss << "{rtp_history_ms: " << rtp_history_ms;
21 ss << '}';
22 return ss.str();
23}
24
25std::string UlpfecConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020026 char buf[1024];
27 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020028 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
35bool UlpfecConfig::operator==(const UlpfecConfig& other) const {
36 return ulpfec_payload_type == other.ulpfec_payload_type &&
37 red_payload_type == other.red_payload_type &&
38 red_rtx_payload_type == other.red_rtx_payload_type;
39}
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020040
41RtpConfig::RtpConfig() = default;
42RtpConfig::RtpConfig(const RtpConfig&) = default;
43RtpConfig::~RtpConfig() = default;
44
45RtpConfig::Flexfec::Flexfec() = default;
46RtpConfig::Flexfec::Flexfec(const Flexfec&) = default;
47RtpConfig::Flexfec::~Flexfec() = default;
48
49std::string RtpConfig::ToString() const {
50 char buf[2 * 1024];
51 rtc::SimpleStringBuilder ss(buf);
52 ss << "{ssrcs: [";
53 for (size_t i = 0; i < ssrcs.size(); ++i) {
54 ss << ssrcs[i];
55 if (i != ssrcs.size() - 1)
56 ss << ", ";
57 }
58 ss << ']';
59 ss << ", rtcp_mode: "
60 << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound"
61 : "RtcpMode::kReducedSize");
62 ss << ", max_packet_size: " << max_packet_size;
63 ss << ", extensions: [";
64 for (size_t i = 0; i < extensions.size(); ++i) {
65 ss << extensions[i].ToString();
66 if (i != extensions.size() - 1)
67 ss << ", ";
68 }
69 ss << ']';
70
71 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
72 ss << ", ulpfec: " << ulpfec.ToString();
73 ss << ", payload_name: " << payload_name;
74 ss << ", payload_type: " << payload_type;
75
76 ss << ", flexfec: {payload_type: " << flexfec.payload_type;
77 ss << ", ssrc: " << flexfec.ssrc;
78 ss << ", protected_media_ssrcs: [";
79 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
80 ss << flexfec.protected_media_ssrcs[i];
81 if (i != flexfec.protected_media_ssrcs.size() - 1)
82 ss << ", ";
83 }
84 ss << "]}";
85
86 ss << ", rtx: " << rtx.ToString();
87 ss << ", c_name: " << c_name;
88 ss << '}';
89 return ss.str();
90}
91
92RtpConfig::Rtx::Rtx() = default;
93RtpConfig::Rtx::Rtx(const Rtx&) = default;
94RtpConfig::Rtx::~Rtx() = default;
95
96std::string RtpConfig::Rtx::ToString() const {
97 char buf[1024];
98 rtc::SimpleStringBuilder ss(buf);
99 ss << "{ssrcs: [";
100 for (size_t i = 0; i < ssrcs.size(); ++i) {
101 ss << ssrcs[i];
102 if (i != ssrcs.size() - 1)
103 ss << ", ";
104 }
105 ss << ']';
106
107 ss << ", payload_type: " << payload_type;
108 ss << '}';
109 return ss.str();
110}
111
112RtcpConfig::RtcpConfig() = default;
113RtcpConfig::RtcpConfig(const RtcpConfig&) = default;
114RtcpConfig::~RtcpConfig() = default;
115
116std::string RtcpConfig::ToString() const {
117 char buf[1024];
118 rtc::SimpleStringBuilder ss(buf);
119 ss << "{video_report_interval_ms: " << video_report_interval_ms;
120 ss << ", audio_report_interval_ms: " << audio_report_interval_ms;
121 ss << '}';
122 return ss.str();
123}
124
Stefan Holmer1acbd682017-09-01 15:29:28 +0200125} // namespace webrtc