blob: 1c08c2eeed5f5eac9d9eb0d8e642f34549ff2bd1 [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"
Jonas Olssonabbe8412018-04-03 13:40:05 +020013#include "rtc_base/strings/audio_format_to_string.h"
solenberg940b6d62016-10-25 11:19:07 -070014
solenberg940b6d62016-10-25 11:19:07 -070015namespace webrtc {
16
17AudioSendStream::Stats::Stats() = default;
hbos1acfbd22016-11-17 23:43:29 -080018AudioSendStream::Stats::~Stats() = default;
solenberg940b6d62016-10-25 11:19:07 -070019
20AudioSendStream::Config::Config(Transport* send_transport)
21 : send_transport(send_transport) {}
22
minyue6b825df2016-10-31 04:08:32 -070023AudioSendStream::Config::~Config() = default;
24
solenberg940b6d62016-10-25 11:19:07 -070025std::string AudioSendStream::Config::ToString() const {
26 std::stringstream ss;
27 ss << "{rtp: " << rtp.ToString();
deadbeef922246a2017-02-26 04:18:12 -080028 ss << ", send_transport: " << (send_transport ? "(Transport)" : "null");
minyue10cbb462016-11-07 09:29:22 -080029 ss << ", min_bitrate_bps: " << min_bitrate_bps;
30 ss << ", max_bitrate_bps: " << max_bitrate_bps;
ossu20a4b3f2017-04-27 02:08:52 -070031 ss << ", send_codec_spec: "
32 << (send_codec_spec ? send_codec_spec->ToString() : "<unset>");
solenberg940b6d62016-10-25 11:19:07 -070033 ss << '}';
34 return ss.str();
35}
36
37AudioSendStream::Config::Rtp::Rtp() = default;
38
39AudioSendStream::Config::Rtp::~Rtp() = default;
40
41std::string AudioSendStream::Config::Rtp::ToString() const {
42 std::stringstream ss;
43 ss << "{ssrc: " << ssrc;
44 ss << ", extensions: [";
45 for (size_t i = 0; i < extensions.size(); ++i) {
46 ss << extensions[i].ToString();
47 if (i != extensions.size() - 1) {
48 ss << ", ";
49 }
50 }
51 ss << ']';
52 ss << ", nack: " << nack.ToString();
53 ss << ", c_name: " << c_name;
54 ss << '}';
55 return ss.str();
56}
57
ossu20a4b3f2017-04-27 02:08:52 -070058AudioSendStream::Config::SendCodecSpec::SendCodecSpec(
59 int payload_type,
60 const SdpAudioFormat& format)
61 : payload_type(payload_type), format(format) {}
62AudioSendStream::Config::SendCodecSpec::~SendCodecSpec() = default;
solenberg940b6d62016-10-25 11:19:07 -070063
64std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
65 std::stringstream ss;
66 ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
67 ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
ossu20a4b3f2017-04-27 02:08:52 -070068 ss << ", cng_payload_type: "
Jiawei Oudee91912018-01-28 22:40:54 -080069 << (cng_payload_type ? rtc::ToString(*cng_payload_type) : "<unset>");
ossu20a4b3f2017-04-27 02:08:52 -070070 ss << ", payload_type: " << payload_type;
Jonas Olssonabbe8412018-04-03 13:40:05 +020071 ss << ", format: " << rtc::ToString(format);
solenberg940b6d62016-10-25 11:19:07 -070072 ss << '}';
73 return ss.str();
74}
75
76bool AudioSendStream::Config::SendCodecSpec::operator==(
77 const AudioSendStream::Config::SendCodecSpec& rhs) const {
minyue6b825df2016-10-31 04:08:32 -070078 if (nack_enabled == rhs.nack_enabled &&
79 transport_cc_enabled == rhs.transport_cc_enabled &&
minyue6b825df2016-10-31 04:08:32 -070080 cng_payload_type == rhs.cng_payload_type &&
ossu20a4b3f2017-04-27 02:08:52 -070081 payload_type == rhs.payload_type && format == rhs.format &&
82 target_bitrate_bps == rhs.target_bitrate_bps) {
minyue6b825df2016-10-31 04:08:32 -070083 return true;
solenberg940b6d62016-10-25 11:19:07 -070084 }
minyue6b825df2016-10-31 04:08:32 -070085 return false;
solenberg940b6d62016-10-25 11:19:07 -070086}
87} // namespace webrtc