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

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

Issue 2516993002: Pass SdpAudioFormat through Channel, without converting to CodecInst (Closed)
Patch Set: Created 4 years 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
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
11 #include <sstream>
12
11 #include "webrtc/voice_engine/voe_codec_impl.h" 13 #include "webrtc/voice_engine/voe_codec_impl.h"
12 14
13 #include "webrtc/base/format_macros.h" 15 #include "webrtc/base/format_macros.h"
14 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" 16 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
15 #include "webrtc/system_wrappers/include/trace.h" 17 #include "webrtc/system_wrappers/include/trace.h"
16 #include "webrtc/voice_engine/channel.h" 18 #include "webrtc/voice_engine/channel.h"
17 #include "webrtc/voice_engine/include/voe_errors.h" 19 #include "webrtc/voice_engine/include/voe_errors.h"
18 #include "webrtc/voice_engine/voice_engine_impl.h" 20 #include "webrtc/voice_engine/voice_engine_impl.h"
19 21
20 namespace webrtc { 22 namespace webrtc {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 174 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
173 voe::Channel* channelPtr = ch.channel(); 175 voe::Channel* channelPtr = ch.channel();
174 if (channelPtr == NULL) { 176 if (channelPtr == NULL) {
175 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 177 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
176 "GetRecPayloadType() failed to locate channel"); 178 "GetRecPayloadType() failed to locate channel");
177 return -1; 179 return -1;
178 } 180 }
179 return channelPtr->SetRecPayloadType(codec); 181 return channelPtr->SetRecPayloadType(codec);
180 } 182 }
181 183
184 int VoECodecImpl::SetRecPayloadType(int channel,
185 int payload_type,
186 const SdpAudioFormat& format) {
187 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
188 "SetRecPayloadType(channel=%d, payload_type=%d, format)",
189 channel, payload_type);
190 auto sdp_fmt = [](const SdpAudioFormat& format) {
191 std::ostringstream o;
192 o << format;
193 return o.str();
194 };
195 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
196 "format: %s", sdp_fmt(format).c_str());
197 if (!_shared->statistics().Initialized()) {
198 _shared->SetLastError(VE_NOT_INITED, kTraceError);
199 return -1;
200 }
201 voe::Channel* const channel_ptr =
202 _shared->channel_manager().GetChannel(channel).channel();
203 if (!channel_ptr) {
204 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
205 "GetRecPayloadType() failed to locate channel");
206 return -1;
207 }
208 return channel_ptr->SetRecPayloadType(payload_type, format);
209 }
210
182 int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec) { 211 int VoECodecImpl::GetRecPayloadType(int channel, CodecInst& codec) {
183 if (!_shared->statistics().Initialized()) { 212 if (!_shared->statistics().Initialized()) {
184 _shared->SetLastError(VE_NOT_INITED, kTraceError); 213 _shared->SetLastError(VE_NOT_INITED, kTraceError);
185 return -1; 214 return -1;
186 } 215 }
187 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 216 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
188 voe::Channel* channelPtr = ch.channel(); 217 voe::Channel* channelPtr = ch.channel();
189 if (channelPtr == NULL) { 218 if (channelPtr == NULL) {
190 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 219 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
191 "GetRecPayloadType() failed to locate channel"); 220 "GetRecPayloadType() failed to locate channel");
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 418 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
390 "GetOpusDtx failed to locate channel"); 419 "GetOpusDtx failed to locate channel");
391 return -1; 420 return -1;
392 } 421 }
393 return channelPtr->GetOpusDtx(enabled); 422 return channelPtr->GetOpusDtx(enabled);
394 } 423 }
395 424
396 #endif // WEBRTC_VOICE_ENGINE_CODEC_API 425 #endif // WEBRTC_VOICE_ENGINE_CODEC_API
397 426
398 } // namespace webrtc 427 } // namespace webrtc
OLDNEW
« webrtc/voice_engine/include/voe_codec.h ('K') | « webrtc/voice_engine/voe_codec_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698