blob: cce78ad64c7d91130ff22e9b40543c32d9463793 [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;
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
96RtpConfig::Rtx::Rtx() = default;
97RtpConfig::Rtx::Rtx(const Rtx&) = default;
98RtpConfig::Rtx::~Rtx() = default;
99
100std::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 Holmer1acbd682017-09-01 15:29:28 +0200115} // namespace webrtc