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

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

Issue 2703373006: Injectable audio encoders: voice_engine/channel changes. (Closed)
Patch Set: Removed 'virtual' from Channel::SetEncoder. Created 3 years, 8 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 // Reset sending SSRC and sequence number and triggers direct transmission 1267 // Reset sending SSRC and sequence number and triggers direct transmission
1268 // of RTCP BYE 1268 // of RTCP BYE
1269 if (_rtpRtcpModule->SetSendingStatus(false) == -1) { 1269 if (_rtpRtcpModule->SetSendingStatus(false) == -1) {
1270 _engineStatisticsPtr->SetLastError( 1270 _engineStatisticsPtr->SetLastError(
1271 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning, 1271 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning,
1272 "StartSend() RTP/RTCP failed to stop sending"); 1272 "StartSend() RTP/RTCP failed to stop sending");
1273 } 1273 }
1274 _rtpRtcpModule->SetSendingMediaStatus(false); 1274 _rtpRtcpModule->SetSendingMediaStatus(false);
1275 } 1275 }
1276 1276
1277 bool Channel::SetEncoder(int payload_type,
1278 std::unique_ptr<AudioEncoder> encoder) {
1279 RTC_DCHECK_GE(payload_type, 0);
1280 RTC_DCHECK_LE(payload_type, 127);
1281 // TODO(ossu): Make a CodecInst up for now. It seems like very little of this
1282 // information is actually used, possibly only payload type and clock rate.
1283 CodecInst lies;
1284 lies.pltype = payload_type;
1285 strncpy(lies.plname, "audio", sizeof(lies.plname));
1286 lies.plname[sizeof(lies.plname) - 1] = 0;
1287 // Seems unclear if it should be clock rate or sample rate. CodecInst
1288 // supposedly carries the sample rate, but only clock rate seems sensible to
1289 // send to the RTP/RTCP module.
1290 lies.plfreq = encoder->RtpTimestampRateHz();
1291 lies.pacsize = 0;
1292 lies.channels = encoder->NumChannels();
1293 lies.rate = 0;
1294
1295 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) {
1296 _rtpRtcpModule->DeRegisterSendPayload(payload_type);
1297 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) {
1298 WEBRTC_TRACE(
1299 kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
1300 "SetEncoder() failed to register codec to RTP/RTCP module");
1301 return false;
1302 }
1303 }
1304
1305 audio_coding_->SetEncoder(std::move(encoder));
1306 return true;
1307 }
1308
1277 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) { 1309 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) {
1278 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1310 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1279 "Channel::RegisterVoiceEngineObserver()"); 1311 "Channel::RegisterVoiceEngineObserver()");
1280 rtc::CritScope cs(&_callbackCritSect); 1312 rtc::CritScope cs(&_callbackCritSect);
1281 1313
1282 if (_voiceEngineObserverPtr) { 1314 if (_voiceEngineObserverPtr) {
1283 _engineStatisticsPtr->SetLastError( 1315 _engineStatisticsPtr->SetLastError(
1284 VE_INVALID_OPERATION, kTraceError, 1316 VE_INVALID_OPERATION, kTraceError,
1285 "RegisterVoiceEngineObserver() observer already enabled"); 1317 "RegisterVoiceEngineObserver() observer already enabled");
1286 return -1; 1318 return -1;
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 int64_t min_rtt = 0; 3108 int64_t min_rtt = 0;
3077 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3109 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3078 0) { 3110 0) {
3079 return 0; 3111 return 0;
3080 } 3112 }
3081 return rtt; 3113 return rtt;
3082 } 3114 }
3083 3115
3084 } // namespace voe 3116 } // namespace voe
3085 } // namespace webrtc 3117 } // 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