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

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

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Channel::GetSendCodec asks both its acm and its codec manager. Created 3 years, 7 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/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 _rtpRtcpModule->DeRegisterSendPayload(payload_type); 1296 _rtpRtcpModule->DeRegisterSendPayload(payload_type);
1297 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) { 1297 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) {
1298 WEBRTC_TRACE( 1298 WEBRTC_TRACE(
1299 kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), 1299 kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
1300 "SetEncoder() failed to register codec to RTP/RTCP module"); 1300 "SetEncoder() failed to register codec to RTP/RTCP module");
1301 return false; 1301 return false;
1302 } 1302 }
1303 } 1303 }
1304 1304
1305 audio_coding_->SetEncoder(std::move(encoder)); 1305 audio_coding_->SetEncoder(std::move(encoder));
1306 codec_manager_.UnsetCodecInst();
1306 return true; 1307 return true;
1307 } 1308 }
1308 1309
1310 void Channel::ModifyEncoder(
1311 rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
1312 audio_coding_->ModifyEncoder(modifier);
1313 }
1314
1309 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) { 1315 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) {
1310 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1316 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1311 "Channel::RegisterVoiceEngineObserver()"); 1317 "Channel::RegisterVoiceEngineObserver()");
1312 rtc::CritScope cs(&_callbackCritSect); 1318 rtc::CritScope cs(&_callbackCritSect);
1313 1319
1314 if (_voiceEngineObserverPtr) { 1320 if (_voiceEngineObserverPtr) {
1315 _engineStatisticsPtr->SetLastError( 1321 _engineStatisticsPtr->SetLastError(
1316 VE_INVALID_OPERATION, kTraceError, 1322 VE_INVALID_OPERATION, kTraceError,
1317 "RegisterVoiceEngineObserver() observer already enabled"); 1323 "RegisterVoiceEngineObserver() observer already enabled");
1318 return -1; 1324 return -1;
(...skipping 11 matching lines...) Expand all
1330 _engineStatisticsPtr->SetLastError( 1336 _engineStatisticsPtr->SetLastError(
1331 VE_INVALID_OPERATION, kTraceWarning, 1337 VE_INVALID_OPERATION, kTraceWarning,
1332 "DeRegisterVoiceEngineObserver() observer already disabled"); 1338 "DeRegisterVoiceEngineObserver() observer already disabled");
1333 return 0; 1339 return 0;
1334 } 1340 }
1335 _voiceEngineObserverPtr = NULL; 1341 _voiceEngineObserverPtr = NULL;
1336 return 0; 1342 return 0;
1337 } 1343 }
1338 1344
1339 int32_t Channel::GetSendCodec(CodecInst& codec) { 1345 int32_t Channel::GetSendCodec(CodecInst& codec) {
1340 auto send_codec = codec_manager_.GetCodecInst(); 1346 {
ossu 2017/04/26 15:45:36 At first, I had this code just ask the ACM directl
kwiberg-webrtc 2017/04/26 20:03:36 Yes. Hopefully we can remove that soon-ish.
1341 if (send_codec) { 1347 const CodecInst* send_codec = codec_manager_.GetCodecInst();
1342 codec = *send_codec; 1348 if (send_codec) {
1349 codec = *send_codec;
1350 return 0;
1351 }
1352 }
1353 rtc::Optional<CodecInst> acm_send_codec = audio_coding_->SendCodec();
1354 if (acm_send_codec) {
1355 codec = *acm_send_codec;
1343 return 0; 1356 return 0;
1344 } 1357 }
1345 return -1; 1358 return -1;
1346 } 1359 }
1347 1360
1348 int32_t Channel::GetRecCodec(CodecInst& codec) { 1361 int32_t Channel::GetRecCodec(CodecInst& codec) {
1349 return (audio_coding_->ReceiveCodec(&codec)); 1362 return (audio_coding_->ReceiveCodec(&codec));
1350 } 1363 }
1351 1364
1352 int32_t Channel::SetSendCodec(const CodecInst& codec) { 1365 int32_t Channel::SetSendCodec(const CodecInst& codec) {
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 int64_t min_rtt = 0; 3121 int64_t min_rtt = 0;
3109 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3122 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3110 0) { 3123 0) {
3111 return 0; 3124 return 0;
3112 } 3125 }
3113 return rtt; 3126 return rtt;
3114 } 3127 }
3115 3128
3116 } // namespace voe 3129 } // namespace voe
3117 } // namespace webrtc 3130 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698