blob: c4f9d410093353dd0c1efbd5aad59dca665b33e1 [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;
66 ss << ", extensions: [";
67 for (size_t i = 0; i < extensions.size(); ++i) {
68 ss << extensions[i].ToString();
69 if (i != extensions.size() - 1)
70 ss << ", ";
71 }
72 ss << ']';
73
74 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
75 ss << ", ulpfec: " << ulpfec.ToString();
76 ss << ", payload_name: " << payload_name;
77 ss << ", payload_type: " << payload_type;
78
79 ss << ", flexfec: {payload_type: " << flexfec.payload_type;
80 ss << ", ssrc: " << flexfec.ssrc;
81 ss << ", protected_media_ssrcs: [";
82 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) {
83 ss << flexfec.protected_media_ssrcs[i];
84 if (i != flexfec.protected_media_ssrcs.size() - 1)
85 ss << ", ";
86 }
87 ss << "]}";
88
89 ss << ", rtx: " << rtx.ToString();
90 ss << ", c_name: " << c_name;
91 ss << '}';
92 return ss.str();
93}
94
95RtpConfig::Rtx::Rtx() = default;
96RtpConfig::Rtx::Rtx(const Rtx&) = default;
97RtpConfig::Rtx::~Rtx() = default;
98
99std::string RtpConfig::Rtx::ToString() const {
100 char buf[1024];
101 rtc::SimpleStringBuilder ss(buf);
102 ss << "{ssrcs: [";
103 for (size_t i = 0; i < ssrcs.size(); ++i) {
104 ss << ssrcs[i];
105 if (i != ssrcs.size() - 1)
106 ss << ", ";
107 }
108 ss << ']';
109
110 ss << ", payload_type: " << payload_type;
111 ss << '}';
112 return ss.str();
113}
114
115RtcpConfig::RtcpConfig() = default;
116RtcpConfig::RtcpConfig(const RtcpConfig&) = default;
117RtcpConfig::~RtcpConfig() = default;
118
119std::string RtcpConfig::ToString() const {
120 char buf[1024];
121 rtc::SimpleStringBuilder ss(buf);
122 ss << "{video_report_interval_ms: " << video_report_interval_ms;
123 ss << ", audio_report_interval_ms: " << audio_report_interval_ms;
124 ss << '}';
125 return ss.str();
126}
127
Stefan Holmer1acbd682017-09-01 15:29:28 +0200128} // namespace webrtc