Line data Source code
1 : /*
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 :
11 : #include "webrtc/call/audio_send_stream.h"
12 :
13 : #include <string>
14 :
15 : namespace {
16 :
17 0 : std::string ToString(const webrtc::CodecInst& codec_inst) {
18 0 : std::stringstream ss;
19 0 : ss << "{pltype: " << codec_inst.pltype;
20 0 : ss << ", plname: \"" << codec_inst.plname << "\"";
21 0 : ss << ", plfreq: " << codec_inst.plfreq;
22 0 : ss << ", pacsize: " << codec_inst.pacsize;
23 0 : ss << ", channels: " << codec_inst.channels;
24 0 : ss << ", rate: " << codec_inst.rate;
25 0 : ss << '}';
26 0 : return ss.str();
27 : }
28 : } // namespace
29 :
30 : namespace webrtc {
31 :
32 : AudioSendStream::Stats::Stats() = default;
33 : AudioSendStream::Stats::~Stats() = default;
34 :
35 0 : AudioSendStream::Config::Config(Transport* send_transport)
36 0 : : send_transport(send_transport) {}
37 :
38 : AudioSendStream::Config::~Config() = default;
39 :
40 0 : std::string AudioSendStream::Config::ToString() const {
41 0 : std::stringstream ss;
42 0 : ss << "{rtp: " << rtp.ToString();
43 0 : ss << ", send_transport: " << (send_transport ? "(Transport)" : "nullptr");
44 0 : ss << ", voe_channel_id: " << voe_channel_id;
45 0 : ss << ", min_bitrate_bps: " << min_bitrate_bps;
46 0 : ss << ", max_bitrate_bps: " << max_bitrate_bps;
47 0 : ss << ", send_codec_spec: " << send_codec_spec.ToString();
48 0 : ss << '}';
49 0 : return ss.str();
50 : }
51 :
52 : AudioSendStream::Config::Rtp::Rtp() = default;
53 :
54 : AudioSendStream::Config::Rtp::~Rtp() = default;
55 :
56 0 : std::string AudioSendStream::Config::Rtp::ToString() const {
57 0 : std::stringstream ss;
58 0 : ss << "{ssrc: " << ssrc;
59 0 : ss << ", extensions: [";
60 0 : for (size_t i = 0; i < extensions.size(); ++i) {
61 0 : ss << extensions[i].ToString();
62 0 : if (i != extensions.size() - 1) {
63 0 : ss << ", ";
64 : }
65 : }
66 0 : ss << ']';
67 0 : ss << ", nack: " << nack.ToString();
68 0 : ss << ", c_name: " << c_name;
69 0 : ss << '}';
70 0 : return ss.str();
71 : }
72 :
73 0 : AudioSendStream::Config::SendCodecSpec::SendCodecSpec() {
74 0 : webrtc::CodecInst empty_inst = {0};
75 0 : codec_inst = empty_inst;
76 0 : codec_inst.pltype = -1;
77 0 : }
78 :
79 0 : std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
80 0 : std::stringstream ss;
81 0 : ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
82 0 : ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
83 0 : ss << ", enable_codec_fec: " << (enable_codec_fec ? "true" : "false");
84 0 : ss << ", enable_opus_dtx: " << (enable_opus_dtx ? "true" : "false");
85 0 : ss << ", opus_max_playback_rate: " << opus_max_playback_rate;
86 0 : ss << ", cng_payload_type: " << cng_payload_type;
87 0 : ss << ", cng_plfreq: " << cng_plfreq;
88 0 : ss << ", min_ptime: " << min_ptime_ms;
89 0 : ss << ", max_ptime: " << max_ptime_ms;
90 0 : ss << ", codec_inst: " << ::ToString(codec_inst);
91 0 : ss << '}';
92 0 : return ss.str();
93 : }
94 :
95 0 : bool AudioSendStream::Config::SendCodecSpec::operator==(
96 : const AudioSendStream::Config::SendCodecSpec& rhs) const {
97 0 : if (nack_enabled == rhs.nack_enabled &&
98 0 : transport_cc_enabled == rhs.transport_cc_enabled &&
99 0 : enable_codec_fec == rhs.enable_codec_fec &&
100 0 : enable_opus_dtx == rhs.enable_opus_dtx &&
101 0 : opus_max_playback_rate == rhs.opus_max_playback_rate &&
102 0 : cng_payload_type == rhs.cng_payload_type &&
103 0 : cng_plfreq == rhs.cng_plfreq && max_ptime_ms == rhs.max_ptime_ms &&
104 0 : min_ptime_ms == rhs.min_ptime_ms && codec_inst == rhs.codec_inst) {
105 0 : return true;
106 : }
107 0 : return false;
108 : }
109 : } // namespace webrtc
|