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