Chromium Code Reviews| 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 |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1195 if (_rtpRtcpModule->SetSendingStatus(false) == -1) { | 1195 if (_rtpRtcpModule->SetSendingStatus(false) == -1) { |
| 1196 _engineStatisticsPtr->SetLastError( | 1196 _engineStatisticsPtr->SetLastError( |
| 1197 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning, | 1197 VE_RTP_RTCP_MODULE_ERROR, kTraceWarning, |
| 1198 "StartSend() RTP/RTCP failed to stop sending"); | 1198 "StartSend() RTP/RTCP failed to stop sending"); |
| 1199 } | 1199 } |
| 1200 _rtpRtcpModule->SetSendingMediaStatus(false); | 1200 _rtpRtcpModule->SetSendingMediaStatus(false); |
| 1201 | 1201 |
| 1202 return 0; | 1202 return 0; |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 bool Channel::SetSendFormat(int payload_type, | |
| 1206 const SdpAudioFormat& format, | |
| 1207 AudioEncoderFactory* factory) { | |
| 1208 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 1209 "Channel::SetSendFormat()"); | |
| 1210 | |
| 1211 auto encoder = factory->MakeAudioEncoder(payload_type, format); | |
| 1212 if (!encoder) { | |
| 1213 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 1214 "SetSendFormat() failed to create encoder"); | |
| 1215 return false; | |
| 1216 } | |
| 1217 | |
| 1218 // TODO(ossu): Make a CodecInst up for now. | |
|
the sun
2017/02/22 14:08:38
You need to explain why we should accept your lies
ossu
2017/02/22 14:24:41
Alright. I'll elaborate and give it a less offensi
| |
| 1219 CodecInst lies; | |
| 1220 lies.pltype = payload_type; | |
| 1221 strncpy(lies.plname, format.name.c_str(), sizeof(lies.plname)); | |
| 1222 lies.plname[sizeof(lies.plname) - 1] = 0; | |
| 1223 // Seems unclear if it should be clock rate or sample rate. CodecInst | |
| 1224 // supposedly carries the sample rate, but only clock rate seems sensible to | |
| 1225 // send to the RTP/RTCP module. | |
| 1226 lies.plfreq = format.clockrate_hz; | |
| 1227 //lies.plfreq = encoder->SampleRateHz(); | |
| 1228 lies.pacsize = 0; | |
| 1229 lies.channels = encoder->NumChannels(); | |
| 1230 lies.rate = 0; | |
| 1231 | |
| 1232 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) { | |
| 1233 _rtpRtcpModule->DeRegisterSendPayload(payload_type); | |
| 1234 if (_rtpRtcpModule->RegisterSendPayload(lies) != 0) { | |
| 1235 WEBRTC_TRACE( | |
| 1236 kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 1237 "SetSendFormat() failed to register codec to RTP/RTCP module"); | |
| 1238 return false; | |
| 1239 } | |
| 1240 } | |
| 1241 | |
| 1242 audio_coding_->SetEncoder(std::move(encoder)); | |
| 1243 | |
| 1244 return true; | |
| 1245 } | |
| 1246 | |
| 1205 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) { | 1247 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) { |
| 1206 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1248 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1207 "Channel::RegisterVoiceEngineObserver()"); | 1249 "Channel::RegisterVoiceEngineObserver()"); |
| 1208 rtc::CritScope cs(&_callbackCritSect); | 1250 rtc::CritScope cs(&_callbackCritSect); |
| 1209 | 1251 |
| 1210 if (_voiceEngineObserverPtr) { | 1252 if (_voiceEngineObserverPtr) { |
| 1211 _engineStatisticsPtr->SetLastError( | 1253 _engineStatisticsPtr->SetLastError( |
| 1212 VE_INVALID_OPERATION, kTraceError, | 1254 VE_INVALID_OPERATION, kTraceError, |
| 1213 "RegisterVoiceEngineObserver() observer already enabled"); | 1255 "RegisterVoiceEngineObserver() observer already enabled"); |
| 1214 return -1; | 1256 return -1; |
| (...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3011 int64_t min_rtt = 0; | 3053 int64_t min_rtt = 0; |
| 3012 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3054 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3013 0) { | 3055 0) { |
| 3014 return 0; | 3056 return 0; |
| 3015 } | 3057 } |
| 3016 return rtt; | 3058 return rtt; |
| 3017 } | 3059 } |
| 3018 | 3060 |
| 3019 } // namespace voe | 3061 } // namespace voe |
| 3020 } // namespace webrtc | 3062 } // namespace webrtc |
| OLD | NEW |