OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/call/audio_send_stream.h" | 11 #include "webrtc/call/audio_send_stream.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 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 { | 15 namespace webrtc { |
31 | 16 |
32 AudioSendStream::Stats::Stats() = default; | 17 AudioSendStream::Stats::Stats() = default; |
33 AudioSendStream::Stats::~Stats() = default; | 18 AudioSendStream::Stats::~Stats() = default; |
34 | 19 |
35 AudioSendStream::Config::Config(Transport* send_transport) | 20 AudioSendStream::Config::Config(Transport* send_transport) |
36 : send_transport(send_transport) {} | 21 : send_transport(send_transport) {} |
37 | 22 |
38 AudioSendStream::Config::~Config() = default; | 23 AudioSendStream::Config::~Config() = default; |
39 | 24 |
40 std::string AudioSendStream::Config::ToString() const { | 25 std::string AudioSendStream::Config::ToString() const { |
41 std::stringstream ss; | 26 std::stringstream ss; |
42 ss << "{rtp: " << rtp.ToString(); | 27 ss << "{rtp: " << rtp.ToString(); |
43 ss << ", send_transport: " << (send_transport ? "(Transport)" : "null"); | 28 ss << ", send_transport: " << (send_transport ? "(Transport)" : "null"); |
44 ss << ", voe_channel_id: " << voe_channel_id; | 29 ss << ", voe_channel_id: " << voe_channel_id; |
45 ss << ", min_bitrate_bps: " << min_bitrate_bps; | 30 ss << ", min_bitrate_bps: " << min_bitrate_bps; |
46 ss << ", max_bitrate_bps: " << max_bitrate_bps; | 31 ss << ", max_bitrate_bps: " << max_bitrate_bps; |
47 ss << ", send_codec_spec: " << send_codec_spec.ToString(); | 32 ss << ", send_codec_spec: " |
| 33 << (send_codec_spec ? send_codec_spec->ToString() : "<unset>"); |
48 ss << '}'; | 34 ss << '}'; |
49 return ss.str(); | 35 return ss.str(); |
50 } | 36 } |
51 | 37 |
52 AudioSendStream::Config::Rtp::Rtp() = default; | 38 AudioSendStream::Config::Rtp::Rtp() = default; |
53 | 39 |
54 AudioSendStream::Config::Rtp::~Rtp() = default; | 40 AudioSendStream::Config::Rtp::~Rtp() = default; |
55 | 41 |
56 std::string AudioSendStream::Config::Rtp::ToString() const { | 42 std::string AudioSendStream::Config::Rtp::ToString() const { |
57 std::stringstream ss; | 43 std::stringstream ss; |
58 ss << "{ssrc: " << ssrc; | 44 ss << "{ssrc: " << ssrc; |
59 ss << ", extensions: ["; | 45 ss << ", extensions: ["; |
60 for (size_t i = 0; i < extensions.size(); ++i) { | 46 for (size_t i = 0; i < extensions.size(); ++i) { |
61 ss << extensions[i].ToString(); | 47 ss << extensions[i].ToString(); |
62 if (i != extensions.size() - 1) { | 48 if (i != extensions.size() - 1) { |
63 ss << ", "; | 49 ss << ", "; |
64 } | 50 } |
65 } | 51 } |
66 ss << ']'; | 52 ss << ']'; |
67 ss << ", nack: " << nack.ToString(); | 53 ss << ", nack: " << nack.ToString(); |
68 ss << ", c_name: " << c_name; | 54 ss << ", c_name: " << c_name; |
69 ss << '}'; | 55 ss << '}'; |
70 return ss.str(); | 56 return ss.str(); |
71 } | 57 } |
72 | 58 |
73 AudioSendStream::Config::SendCodecSpec::SendCodecSpec() { | 59 AudioSendStream::Config::SendCodecSpec::SendCodecSpec( |
74 webrtc::CodecInst empty_inst = {0}; | 60 int payload_type, |
75 codec_inst = empty_inst; | 61 const SdpAudioFormat& format) |
76 codec_inst.pltype = -1; | 62 : payload_type(payload_type), format(format) {} |
77 } | 63 AudioSendStream::Config::SendCodecSpec::~SendCodecSpec() = default; |
78 | 64 |
79 std::string AudioSendStream::Config::SendCodecSpec::ToString() const { | 65 std::string AudioSendStream::Config::SendCodecSpec::ToString() const { |
80 std::stringstream ss; | 66 std::stringstream ss; |
81 ss << "{nack_enabled: " << (nack_enabled ? "true" : "false"); | 67 ss << "{nack_enabled: " << (nack_enabled ? "true" : "false"); |
82 ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false"); | 68 ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false"); |
83 ss << ", enable_codec_fec: " << (enable_codec_fec ? "true" : "false"); | 69 ss << ", cng_payload_type: " |
84 ss << ", enable_opus_dtx: " << (enable_opus_dtx ? "true" : "false"); | 70 << (cng_payload_type ? std::to_string(*cng_payload_type) : "<unset>"); |
85 ss << ", opus_max_playback_rate: " << opus_max_playback_rate; | 71 ss << ", payload_type: " << payload_type; |
86 ss << ", cng_payload_type: " << cng_payload_type; | 72 ss << ", format: " << format; |
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 << '}'; | 73 ss << '}'; |
92 return ss.str(); | 74 return ss.str(); |
93 } | 75 } |
94 | 76 |
95 bool AudioSendStream::Config::SendCodecSpec::operator==( | 77 bool AudioSendStream::Config::SendCodecSpec::operator==( |
96 const AudioSendStream::Config::SendCodecSpec& rhs) const { | 78 const AudioSendStream::Config::SendCodecSpec& rhs) const { |
97 if (nack_enabled == rhs.nack_enabled && | 79 if (nack_enabled == rhs.nack_enabled && |
98 transport_cc_enabled == rhs.transport_cc_enabled && | 80 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 && | 81 cng_payload_type == rhs.cng_payload_type && |
103 cng_plfreq == rhs.cng_plfreq && max_ptime_ms == rhs.max_ptime_ms && | 82 payload_type == rhs.payload_type && format == rhs.format && |
104 min_ptime_ms == rhs.min_ptime_ms && codec_inst == rhs.codec_inst) { | 83 target_bitrate_bps == rhs.target_bitrate_bps) { |
105 return true; | 84 return true; |
106 } | 85 } |
107 return false; | 86 return false; |
108 } | 87 } |
109 } // namespace webrtc | 88 } // namespace webrtc |
OLD | NEW |