blob: d0043a2df1987e11ffc696daa52a41f4ae2901b6 [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"
solenberg940b6d62016-10-25 11:19:07 -070012
13#include <string>
14
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");
solenberg940b6d62016-10-25 11:19:07 -070029 ss << ", voe_channel_id: " << voe_channel_id;
minyue10cbb462016-11-07 09:29:22 -080030 ss << ", min_bitrate_bps: " << min_bitrate_bps;
31 ss << ", max_bitrate_bps: " << max_bitrate_bps;
ossu20a4b3f2017-04-27 02:08:52 -070032 ss << ", send_codec_spec: "
33 << (send_codec_spec ? send_codec_spec->ToString() : "<unset>");
solenberg940b6d62016-10-25 11:19:07 -070034 ss << '}';
35 return ss.str();
36}
37
38AudioSendStream::Config::Rtp::Rtp() = default;
39
40AudioSendStream::Config::Rtp::~Rtp() = default;
41
42std::string AudioSendStream::Config::Rtp::ToString() const {
43 std::stringstream ss;
44 ss << "{ssrc: " << ssrc;
45 ss << ", extensions: [";
46 for (size_t i = 0; i < extensions.size(); ++i) {
47 ss << extensions[i].ToString();
48 if (i != extensions.size() - 1) {
49 ss << ", ";
50 }
51 }
52 ss << ']';
53 ss << ", nack: " << nack.ToString();
54 ss << ", c_name: " << c_name;
55 ss << '}';
56 return ss.str();
57}
58
ossu20a4b3f2017-04-27 02:08:52 -070059AudioSendStream::Config::SendCodecSpec::SendCodecSpec(
60 int payload_type,
61 const SdpAudioFormat& format)
62 : payload_type(payload_type), format(format) {}
63AudioSendStream::Config::SendCodecSpec::~SendCodecSpec() = default;
solenberg940b6d62016-10-25 11:19:07 -070064
65std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
66 std::stringstream ss;
67 ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
68 ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
ossu20a4b3f2017-04-27 02:08:52 -070069 ss << ", cng_payload_type: "
70 << (cng_payload_type ? std::to_string(*cng_payload_type) : "<unset>");
71 ss << ", payload_type: " << payload_type;
72 ss << ", format: " << format;
solenberg940b6d62016-10-25 11:19:07 -070073 ss << '}';
74 return ss.str();
75}
76
77bool AudioSendStream::Config::SendCodecSpec::operator==(
78 const AudioSendStream::Config::SendCodecSpec& rhs) const {
minyue6b825df2016-10-31 04:08:32 -070079 if (nack_enabled == rhs.nack_enabled &&
80 transport_cc_enabled == rhs.transport_cc_enabled &&
minyue6b825df2016-10-31 04:08:32 -070081 cng_payload_type == rhs.cng_payload_type &&
ossu20a4b3f2017-04-27 02:08:52 -070082 payload_type == rhs.payload_type && format == rhs.format &&
83 target_bitrate_bps == rhs.target_bitrate_bps) {
minyue6b825df2016-10-31 04:08:32 -070084 return true;
solenberg940b6d62016-10-25 11:19:07 -070085 }
minyue6b825df2016-10-31 04:08:32 -070086 return false;
solenberg940b6d62016-10-25 11:19:07 -070087}
88} // namespace webrtc