OLD | NEW |
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 |
11 #include "webrtc/voice_engine/voe_codec_impl.h" | 11 #include "webrtc/voice_engine/voe_codec_impl.h" |
12 | 12 |
| 13 #include "webrtc/base/format_macros.h" |
13 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 14 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
14 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 15 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
15 #include "webrtc/system_wrappers/include/trace.h" | 16 #include "webrtc/system_wrappers/include/trace.h" |
16 #include "webrtc/voice_engine/channel.h" | 17 #include "webrtc/voice_engine/channel.h" |
17 #include "webrtc/voice_engine/include/voe_errors.h" | 18 #include "webrtc/voice_engine/include/voe_errors.h" |
18 #include "webrtc/voice_engine/voice_engine_impl.h" | 19 #include "webrtc/voice_engine/voice_engine_impl.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 VoECodec* VoECodec::GetInterface(VoiceEngine* voiceEngine) { | 23 VoECodec* VoECodec::GetInterface(VoiceEngine* voiceEngine) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return -1; | 58 return -1; |
58 } | 59 } |
59 return 0; | 60 return 0; |
60 } | 61 } |
61 | 62 |
62 int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec) { | 63 int VoECodecImpl::SetSendCodec(int channel, const CodecInst& codec) { |
63 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 64 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
64 "SetSendCodec(channel=%d, codec)", channel); | 65 "SetSendCodec(channel=%d, codec)", channel); |
65 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), | 66 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), |
66 "codec: plname=%s, pacsize=%d, plfreq=%d, pltype=%d, " | 67 "codec: plname=%s, pacsize=%d, plfreq=%d, pltype=%d, " |
67 "channels=%d, rate=%d", | 68 "channels=%" PRIuS ", rate=%d", |
68 codec.plname, codec.pacsize, codec.plfreq, codec.pltype, | 69 codec.plname, codec.pacsize, codec.plfreq, codec.pltype, |
69 codec.channels, codec.rate); | 70 codec.channels, codec.rate); |
70 if (!_shared->statistics().Initialized()) { | 71 if (!_shared->statistics().Initialized()) { |
71 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 72 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
72 return -1; | 73 return -1; |
73 } | 74 } |
74 // External sanity checks performed outside the ACM | 75 // External sanity checks performed outside the ACM |
75 if ((STR_CASE_CMP(codec.plname, "L16") == 0) && (codec.pacsize >= 960)) { | 76 if ((STR_CASE_CMP(codec.plname, "L16") == 0) && (codec.pacsize >= 960)) { |
76 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, | 77 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
77 "SetSendCodec() invalid L16 packet size"); | 78 "SetSendCodec() invalid L16 packet size"); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 "GetRecCodec() failed to locate channel"); | 155 "GetRecCodec() failed to locate channel"); |
155 return -1; | 156 return -1; |
156 } | 157 } |
157 return channelPtr->GetRecCodec(codec); | 158 return channelPtr->GetRecCodec(codec); |
158 } | 159 } |
159 | 160 |
160 int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) { | 161 int VoECodecImpl::SetRecPayloadType(int channel, const CodecInst& codec) { |
161 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 162 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
162 "SetRecPayloadType(channel=%d, codec)", channel); | 163 "SetRecPayloadType(channel=%d, codec)", channel); |
163 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), | 164 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), |
164 "codec: plname=%s, plfreq=%d, pltype=%d, channels=%u, " | 165 "codec: plname=%s, plfreq=%d, pltype=%d, channels=%" PRIuS ", " |
165 "pacsize=%d, rate=%d", | 166 "pacsize=%d, rate=%d", |
166 codec.plname, codec.plfreq, codec.pltype, codec.channels, | 167 codec.plname, codec.plfreq, codec.pltype, codec.channels, |
167 codec.pacsize, codec.rate); | 168 codec.pacsize, codec.rate); |
168 if (!_shared->statistics().Initialized()) { | 169 if (!_shared->statistics().Initialized()) { |
169 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 170 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
170 return -1; | 171 return -1; |
171 } | 172 } |
172 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 173 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
173 voe::Channel* channelPtr = ch.channel(); | 174 voe::Channel* channelPtr = ch.channel(); |
174 if (channelPtr == NULL) { | 175 if (channelPtr == NULL) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return channelPtr->SetOpusDtx(enable_dtx); | 377 return channelPtr->SetOpusDtx(enable_dtx); |
377 } | 378 } |
378 | 379 |
379 RtcEventLog* VoECodecImpl::GetEventLog() { | 380 RtcEventLog* VoECodecImpl::GetEventLog() { |
380 return _shared->channel_manager().GetEventLog(); | 381 return _shared->channel_manager().GetEventLog(); |
381 } | 382 } |
382 | 383 |
383 #endif // WEBRTC_VOICE_ENGINE_CODEC_API | 384 #endif // WEBRTC_VOICE_ENGINE_CODEC_API |
384 | 385 |
385 } // namespace webrtc | 386 } // namespace webrtc |
OLD | NEW |