Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1325)

Side by Side Diff: webrtc/voice_engine/voe_codec_impl.cc

Issue 1347353004: Reduce LS_INFO spam from voice_engine/. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/voe_audio_processing_impl.cc ('k') | webrtc/voice_engine/voe_dtmf_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
(...skipping 27 matching lines...) Expand all
38 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), 38 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
39 "VoECodecImpl() - ctor"); 39 "VoECodecImpl() - ctor");
40 } 40 }
41 41
42 VoECodecImpl::~VoECodecImpl() { 42 VoECodecImpl::~VoECodecImpl() {
43 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), 43 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
44 "~VoECodecImpl() - dtor"); 44 "~VoECodecImpl() - dtor");
45 } 45 }
46 46
47 int VoECodecImpl::NumOfCodecs() { 47 int VoECodecImpl::NumOfCodecs() {
48 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
49 "NumOfCodecs()");
50
51 // Number of supported codecs in the ACM 48 // Number of supported codecs in the ACM
52 uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs(); 49 uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs();
53
54 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
55 "NumOfCodecs() => %u", nSupportedCodecs);
56 return (nSupportedCodecs); 50 return (nSupportedCodecs);
57 } 51 }
58 52
59 int VoECodecImpl::GetCodec(int index, CodecInst& codec) { 53 int VoECodecImpl::GetCodec(int index, CodecInst& codec) {
60 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
61 "GetCodec(index=%d, codec=?)", index);
62 CodecInst acmCodec; 54 CodecInst acmCodec;
63 if (AudioCodingModule::Codec(index, &acmCodec) == -1) { 55 if (AudioCodingModule::Codec(index, &acmCodec) == -1) {
64 _shared->SetLastError(VE_INVALID_LISTNR, kTraceError, 56 _shared->SetLastError(VE_INVALID_LISTNR, kTraceError,
65 "GetCodec() invalid index"); 57 "GetCodec() invalid index");
66 return -1; 58 return -1;
67 } 59 }
68 ACMToExternalCodecRepresentation(codec, acmCodec); 60 ACMToExternalCodecRepresentation(codec, acmCodec);
69 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
70 "GetCodec() => plname=%s, pacsize=%d, plfreq=%d, pltype=%d, "
71 "channels=%d, rate=%d",
72 codec.plname, codec.pacsize, codec.plfreq, codec.pltype,
73 codec.channels, codec.rate);
74 return 0; 61 return 0;
75 } 62 }
76 63
77 int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec) { 64 int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec) {
78 CodecInst copyCodec; 65 CodecInst copyCodec;
79 ExternalToACMCodecRepresentation(copyCodec, codec); 66 ExternalToACMCodecRepresentation(copyCodec, codec);
80 67
81 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 68 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
82 "SetSendCodec(channel=%d, codec)", channel); 69 "SetSendCodec(channel=%d, codec)", channel);
83 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), 70 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (channelPtr->SetSendCodec(copyCodec) != 0) { 110 if (channelPtr->SetSendCodec(copyCodec) != 0) {
124 _shared->SetLastError(VE_CANNOT_SET_SEND_CODEC, kTraceError, 111 _shared->SetLastError(VE_CANNOT_SET_SEND_CODEC, kTraceError,
125 "SetSendCodec() failed to set send codec"); 112 "SetSendCodec() failed to set send codec");
126 return -1; 113 return -1;
127 } 114 }
128 115
129 return 0; 116 return 0;
130 } 117 }
131 118
132 int VoECodecImpl::GetSendCodec(int channel, CodecInst& codec) { 119 int VoECodecImpl::GetSendCodec(int channel, CodecInst& codec) {
133 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
134 "GetSendCodec(channel=%d, codec=?)", channel);
135 if (!_shared->statistics().Initialized()) { 120 if (!_shared->statistics().Initialized()) {
136 _shared->SetLastError(VE_NOT_INITED, kTraceError); 121 _shared->SetLastError(VE_NOT_INITED, kTraceError);
137 return -1; 122 return -1;
138 } 123 }
139 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 124 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
140 voe::Channel* channelPtr = ch.channel(); 125 voe::Channel* channelPtr = ch.channel();
141 if (channelPtr == NULL) { 126 if (channelPtr == NULL) {
142 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 127 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
143 "GetSendCodec() failed to locate channel"); 128 "GetSendCodec() failed to locate channel");
144 return -1; 129 return -1;
145 } 130 }
146 CodecInst acmCodec; 131 CodecInst acmCodec;
147 if (channelPtr->GetSendCodec(acmCodec) != 0) { 132 if (channelPtr->GetSendCodec(acmCodec) != 0) {
148 _shared->SetLastError(VE_CANNOT_GET_SEND_CODEC, kTraceError, 133 _shared->SetLastError(VE_CANNOT_GET_SEND_CODEC, kTraceError,
149 "GetSendCodec() failed to get send codec"); 134 "GetSendCodec() failed to get send codec");
150 return -1; 135 return -1;
151 } 136 }
152 ACMToExternalCodecRepresentation(codec, acmCodec); 137 ACMToExternalCodecRepresentation(codec, acmCodec);
153 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
154 "GetSendCodec() => plname=%s, pacsize=%d, plfreq=%d, "
155 "channels=%d, rate=%d",
156 codec.plname, codec.pacsize, codec.plfreq, codec.channels,
157 codec.rate);
158 return 0; 138 return 0;
159 } 139 }
160 140
161 int VoECodecImpl::SetBitRate(int channel, int bitrate_bps) { 141 int VoECodecImpl::SetBitRate(int channel, int bitrate_bps) {
162 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 142 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
163 "SetBitRate(bitrate_bps=%d)", bitrate_bps); 143 "SetBitRate(bitrate_bps=%d)", bitrate_bps);
164 if (!_shared->statistics().Initialized()) { 144 if (!_shared->statistics().Initialized()) {
165 _shared->SetLastError(VE_NOT_INITED, kTraceError); 145 _shared->SetLastError(VE_NOT_INITED, kTraceError);
166 return -1; 146 return -1;
167 } 147 }
168 _shared->channel_manager().GetChannel(channel).channel()->SetBitRate( 148 _shared->channel_manager().GetChannel(channel).channel()->SetBitRate(
169 bitrate_bps); 149 bitrate_bps);
170 return 0; 150 return 0;
171 } 151 }
172 152
173 int VoECodecImpl::GetRecCodec(int channel, CodecInst& codec) { 153 int VoECodecImpl::GetRecCodec(int channel, CodecInst& codec) {
174 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
175 "GetRecCodec(channel=%d, codec=?)", channel);
176 if (!_shared->statistics().Initialized()) { 154 if (!_shared->statistics().Initialized()) {
177 _shared->SetLastError(VE_NOT_INITED, kTraceError); 155 _shared->SetLastError(VE_NOT_INITED, kTraceError);
178 return -1; 156 return -1;
179 } 157 }
180 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 158 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
181 voe::Channel* channelPtr = ch.channel(); 159 voe::Channel* channelPtr = ch.channel();
182 if (channelPtr == NULL) { 160 if (channelPtr == NULL) {
183 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 161 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
184 "GetRecCodec() failed to locate channel"); 162 "GetRecCodec() failed to locate channel");
185 return -1; 163 return -1;
186 } 164 }
187 CodecInst acmCodec; 165 CodecInst acmCodec;
188 if (channelPtr->GetRecCodec(acmCodec) != 0) { 166 if (channelPtr->GetRecCodec(acmCodec) != 0) {
189 _shared->SetLastError(VE_CANNOT_GET_REC_CODEC, kTraceError,
190 "GetRecCodec() failed to get received codec");
191 return -1; 167 return -1;
192 } 168 }
193 ACMToExternalCodecRepresentation(codec, acmCodec); 169 ACMToExternalCodecRepresentation(codec, acmCodec);
194 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
195 "GetRecCodec() => plname=%s, pacsize=%d, plfreq=%d, "
196 "channels=%d, rate=%d",
197 codec.plname, codec.pacsize, codec.plfreq, codec.channels,
198 codec.rate);
199 return 0; 170 return 0;
200 } 171 }
201 172
202 int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) { 173 int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) {
203 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 174 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
204 "SetRecPayloadType(channel=%d, codec)", channel); 175 "SetRecPayloadType(channel=%d, codec)", channel);
205 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), 176 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
206 "codec: plname=%s, plfreq=%d, pltype=%d, channels=%u, " 177 "codec: plname=%s, plfreq=%d, pltype=%d, channels=%u, "
207 "pacsize=%d, rate=%d", 178 "pacsize=%d, rate=%d",
208 codec.plname, codec.plfreq, codec.pltype, codec.channels, 179 codec.plname, codec.plfreq, codec.pltype, codec.channels,
209 codec.pacsize, codec.rate); 180 codec.pacsize, codec.rate);
210 if (!_shared->statistics().Initialized()) { 181 if (!_shared->statistics().Initialized()) {
211 _shared->SetLastError(VE_NOT_INITED, kTraceError); 182 _shared->SetLastError(VE_NOT_INITED, kTraceError);
212 return -1; 183 return -1;
213 } 184 }
214 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 185 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
215 voe::Channel* channelPtr = ch.channel(); 186 voe::Channel* channelPtr = ch.channel();
216 if (channelPtr == NULL) { 187 if (channelPtr == NULL) {
217 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 188 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
218 "GetRecPayloadType() failed to locate channel"); 189 "GetRecPayloadType() failed to locate channel");
219 return -1; 190 return -1;
220 } 191 }
221 return channelPtr->SetRecPayloadType(codec); 192 return channelPtr->SetRecPayloadType(codec);
222 } 193 }
223 194
224 int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec) { 195 int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec) {
225 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
226 "GetRecPayloadType(channel=%d, codec)", channel);
227 if (!_shared->statistics().Initialized()) { 196 if (!_shared->statistics().Initialized()) {
228 _shared->SetLastError(VE_NOT_INITED, kTraceError); 197 _shared->SetLastError(VE_NOT_INITED, kTraceError);
229 return -1; 198 return -1;
230 } 199 }
231 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 200 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
232 voe::Channel* channelPtr = ch.channel(); 201 voe::Channel* channelPtr = ch.channel();
233 if (channelPtr == NULL) { 202 if (channelPtr == NULL) {
234 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 203 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
235 "GetRecPayloadType() failed to locate channel"); 204 "GetRecPayloadType() failed to locate channel");
236 return -1; 205 return -1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 voe::Channel* channelPtr = ch.channel(); 252 voe::Channel* channelPtr = ch.channel();
284 if (channelPtr == NULL) { 253 if (channelPtr == NULL) {
285 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 254 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
286 "SetCodecFECStatus() failed to locate channel"); 255 "SetCodecFECStatus() failed to locate channel");
287 return -1; 256 return -1;
288 } 257 }
289 return channelPtr->SetCodecFECStatus(enable); 258 return channelPtr->SetCodecFECStatus(enable);
290 } 259 }
291 260
292 int VoECodecImpl::GetFECStatus(int channel, bool& enabled) { 261 int VoECodecImpl::GetFECStatus(int channel, bool& enabled) {
293 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
294 "GetCodecFECStatus(channel=%d)", channel);
295 if (!_shared->statistics().Initialized()) { 262 if (!_shared->statistics().Initialized()) {
296 _shared->SetLastError(VE_NOT_INITED, kTraceError); 263 _shared->SetLastError(VE_NOT_INITED, kTraceError);
297 return -1; 264 return -1;
298 } 265 }
299 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 266 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
300 voe::Channel* channelPtr = ch.channel(); 267 voe::Channel* channelPtr = ch.channel();
301 if (channelPtr == NULL) { 268 if (channelPtr == NULL) {
302 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 269 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
303 "GetFECStatus() failed to locate channel"); 270 "GetFECStatus() failed to locate channel");
304 return -1; 271 return -1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 vadMode = VADVeryAggr; 309 vadMode = VADVeryAggr;
343 break; 310 break;
344 } 311 }
345 return channelPtr->SetVADStatus(enable, vadMode, disableDTX); 312 return channelPtr->SetVADStatus(enable, vadMode, disableDTX);
346 } 313 }
347 314
348 int VoECodecImpl::GetVADStatus(int channel, 315 int VoECodecImpl::GetVADStatus(int channel,
349 bool& enabled, 316 bool& enabled,
350 VadModes& mode, 317 VadModes& mode,
351 bool& disabledDTX) { 318 bool& disabledDTX) {
352 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
353 "GetVADStatus(channel=%i)", channel);
354
355 if (!_shared->statistics().Initialized()) { 319 if (!_shared->statistics().Initialized()) {
356 _shared->SetLastError(VE_NOT_INITED, kTraceError); 320 _shared->SetLastError(VE_NOT_INITED, kTraceError);
357 return -1; 321 return -1;
358 } 322 }
359 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 323 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
360 voe::Channel* channelPtr = ch.channel(); 324 voe::Channel* channelPtr = ch.channel();
361 if (channelPtr == NULL) { 325 if (channelPtr == NULL) {
362 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 326 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
363 "GetVADStatus failed to locate channel"); 327 "GetVADStatus failed to locate channel");
364 return -1; 328 return -1;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 437 }
474 } 438 }
475 439
476 RtcEventLog* VoECodecImpl::GetEventLog() { 440 RtcEventLog* VoECodecImpl::GetEventLog() {
477 return _shared->channel_manager().GetEventLog(); 441 return _shared->channel_manager().GetEventLog();
478 } 442 }
479 443
480 #endif // WEBRTC_VOICE_ENGINE_CODEC_API 444 #endif // WEBRTC_VOICE_ENGINE_CODEC_API
481 445
482 } // namespace webrtc 446 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/voe_audio_processing_impl.cc ('k') | webrtc/voice_engine/voe_dtmf_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698