blob: f11d69c22c86a3308bd0183a5c5ede546dea9b17 [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
20std::string NackConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020021 char buf[1024];
22 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020023 ss << "{rtp_history_ms: " << rtp_history_ms;
24 ss << '}';
25 return ss.str();
26}
27
28std::string UlpfecConfig::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020029 char buf[1024];
30 rtc::SimpleStringBuilder ss(buf);
Stefan Holmer1acbd682017-09-01 15:29:28 +020031 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
38bool 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 Holmerdbdb3a02018-07-17 16:03:46 +020043
44RtpConfig::RtpConfig() = default;
45RtpConfig::RtpConfig(const RtpConfig&) = default;
46RtpConfig::~RtpConfig() = default;
47
48RtpConfig::Flexfec::Flexfec() = default;
49RtpConfig::Flexfec::Flexfec(const Flexfec&) = default;
50RtpConfig::Flexfec::~Flexfec() = default;
51
52std::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 Kron9190b822018-10-29 11:22:05 +010066 ss << ", extmap-allow-mixed: " << (extmap_allow_mixed ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020067 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;
Mirta Dvornicicfe68daa2019-05-23 13:21:12 +020079 ss << ", raw_payload: " << (raw_payload ? "true" : "false");
Stefan Holmerdbdb3a02018-07-17 16:03:46 +020080
81 ss << ", flexfec: {payload_type: " << flexfec.payload_type;
82 ss << ", ssrc: " << flexfec.ssrc;
83 ss << ", protected_media_ssrcs: [";
84 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
85 ss << flexfec.protected_media_ssrcs[i];
86 if (i != flexfec.protected_media_ssrcs.size() - 1)
87 ss << ", ";
88 }
89 ss << "]}";
90
91 ss << ", rtx: " << rtx.ToString();
92 ss << ", c_name: " << c_name;
93 ss << '}';
94 return ss.str();
95}
96
97RtpConfig::Rtx::Rtx() = default;
98RtpConfig::Rtx::Rtx(const Rtx&) = default;
99RtpConfig::Rtx::~Rtx() = default;
100
101std::string RtpConfig::Rtx::ToString() const {
102 char buf[1024];
103 rtc::SimpleStringBuilder ss(buf);
104 ss << "{ssrcs: [";
105 for (size_t i = 0; i < ssrcs.size(); ++i) {
106 ss << ssrcs[i];
107 if (i != ssrcs.size() - 1)
108 ss << ", ";
109 }
110 ss << ']';
111
112 ss << ", payload_type: " << payload_type;
113 ss << '}';
114 return ss.str();
115}
Stefan Holmer1acbd682017-09-01 15:29:28 +0200116} // namespace webrtc