blob: 3458e7354265604a74f1f99419cd714850f54549 [file] [log] [blame]
solenberg940b6d62016-10-25 11:19:07 -07001/*
2 * Copyright (c) 2015 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/audio_send_stream.h"
Jiawei Oudee91912018-01-28 22:40:54 -080012#include "rtc_base/stringencode.h"
solenberg940b6d62016-10-25 11:19:07 -070013
solenberg940b6d62016-10-25 11:19:07 -070014namespace webrtc {
15
16AudioSendStream::Stats::Stats() = default;
hbos1acfbd22016-11-17 23:43:29 -080017AudioSendStream::Stats::~Stats() = default;
solenberg940b6d62016-10-25 11:19:07 -070018
19AudioSendStream::Config::Config(Transport* send_transport)
20 : send_transport(send_transport) {}
21
minyue6b825df2016-10-31 04:08:32 -070022AudioSendStream::Config::~Config() = default;
23
solenberg940b6d62016-10-25 11:19:07 -070024std::string AudioSendStream::Config::ToString() const {
25 std::stringstream ss;
26 ss << "{rtp: " << rtp.ToString();
deadbeef922246a2017-02-26 04:18:12 -080027 ss << ", send_transport: " << (send_transport ? "(Transport)" : "null");
minyue10cbb462016-11-07 09:29:22 -080028 ss << ", min_bitrate_bps: " << min_bitrate_bps;
29 ss << ", max_bitrate_bps: " << max_bitrate_bps;
ossu20a4b3f2017-04-27 02:08:52 -070030 ss << ", send_codec_spec: "
31 << (send_codec_spec ? send_codec_spec->ToString() : "<unset>");
solenberg940b6d62016-10-25 11:19:07 -070032 ss << '}';
33 return ss.str();
34}
35
36AudioSendStream::Config::Rtp::Rtp() = default;
37
38AudioSendStream::Config::Rtp::~Rtp() = default;
39
40std::string AudioSendStream::Config::Rtp::ToString() const {
41 std::stringstream ss;
42 ss << "{ssrc: " << ssrc;
43 ss << ", extensions: [";
44 for (size_t i = 0; i < extensions.size(); ++i) {
45 ss << extensions[i].ToString();
46 if (i != extensions.size() - 1) {
47 ss << ", ";
48 }
49 }
50 ss << ']';
51 ss << ", nack: " << nack.ToString();
52 ss << ", c_name: " << c_name;
53 ss << '}';
54 return ss.str();
55}
56
ossu20a4b3f2017-04-27 02:08:52 -070057AudioSendStream::Config::SendCodecSpec::SendCodecSpec(
58 int payload_type,
59 const SdpAudioFormat& format)
60 : payload_type(payload_type), format(format) {}
61AudioSendStream::Config::SendCodecSpec::~SendCodecSpec() = default;
solenberg940b6d62016-10-25 11:19:07 -070062
63std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
64 std::stringstream ss;
65 ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
66 ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
ossu20a4b3f2017-04-27 02:08:52 -070067 ss << ", cng_payload_type: "
Jiawei Oudee91912018-01-28 22:40:54 -080068 << (cng_payload_type ? rtc::ToString(*cng_payload_type) : "<unset>");
ossu20a4b3f2017-04-27 02:08:52 -070069 ss << ", payload_type: " << payload_type;
70 ss << ", format: " << format;
solenberg940b6d62016-10-25 11:19:07 -070071 ss << '}';
72 return ss.str();
73}
74
75bool AudioSendStream::Config::SendCodecSpec::operator==(
76 const AudioSendStream::Config::SendCodecSpec& rhs) const {
minyue6b825df2016-10-31 04:08:32 -070077 if (nack_enabled == rhs.nack_enabled &&
78 transport_cc_enabled == rhs.transport_cc_enabled &&
minyue6b825df2016-10-31 04:08:32 -070079 cng_payload_type == rhs.cng_payload_type &&
ossu20a4b3f2017-04-27 02:08:52 -070080 payload_type == rhs.payload_type && format == rhs.format &&
81 target_bitrate_bps == rhs.target_bitrate_bps) {
minyue6b825df2016-10-31 04:08:32 -070082 return true;
solenberg940b6d62016-10-25 11:19:07 -070083 }
minyue6b825df2016-10-31 04:08:32 -070084 return false;
solenberg940b6d62016-10-25 11:19:07 -070085}
86} // namespace webrtc