OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 kEnumCounterAddressFamily, kPeerConnection_IPv6, | 1235 kEnumCounterAddressFamily, kPeerConnection_IPv6, |
1236 kPeerConnectionAddressFamilyCounter_Max); | 1236 kPeerConnectionAddressFamilyCounter_Max); |
1237 } else { | 1237 } else { |
1238 uma_observer_->IncrementEnumCounter( | 1238 uma_observer_->IncrementEnumCounter( |
1239 kEnumCounterAddressFamily, kPeerConnection_IPv4, | 1239 kEnumCounterAddressFamily, kPeerConnection_IPv4, |
1240 kPeerConnectionAddressFamilyCounter_Max); | 1240 kPeerConnectionAddressFamilyCounter_Max); |
1241 } | 1241 } |
1242 } | 1242 } |
1243 } | 1243 } |
1244 | 1244 |
| 1245 RTCError PeerConnection::SetBitrate(const BitrateParameters& bitrate) { |
| 1246 rtc::Thread* worker_thread = factory_->worker_thread(); |
| 1247 if (!worker_thread->IsCurrent()) { |
| 1248 return worker_thread->Invoke<RTCError>( |
| 1249 RTC_FROM_HERE, rtc::Bind(&PeerConnection::SetBitrate, this, bitrate)); |
| 1250 } |
| 1251 |
| 1252 const bool has_min = static_cast<bool>(bitrate.min_bitrate_bps); |
| 1253 const bool has_current = static_cast<bool>(bitrate.current_bitrate_bps); |
| 1254 const bool has_max = static_cast<bool>(bitrate.max_bitrate_bps); |
| 1255 if (has_min && *bitrate.min_bitrate_bps < 0) { |
| 1256 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1257 "min_bitrate_bps <= 0"); |
| 1258 } |
| 1259 if (has_current) { |
| 1260 if (has_min && *bitrate.current_bitrate_bps < *bitrate.min_bitrate_bps) { |
| 1261 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1262 "current_bitrate_bps < min_bitrate_bps"); |
| 1263 } else if (*bitrate.current_bitrate_bps < 0) { |
| 1264 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1265 "curent_bitrate_bps < 0"); |
| 1266 } |
| 1267 } |
| 1268 if (has_max) { |
| 1269 if (has_current && |
| 1270 *bitrate.max_bitrate_bps < *bitrate.current_bitrate_bps) { |
| 1271 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1272 "max_bitrate_bps < current_bitrate_bps"); |
| 1273 } else if (has_min && *bitrate.max_bitrate_bps < *bitrate.min_bitrate_bps) { |
| 1274 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1275 "max_bitrate_bps < min_bitrate_bps"); |
| 1276 } else if (*bitrate.max_bitrate_bps < 0) { |
| 1277 LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER, |
| 1278 "max_bitrate_bps < 0"); |
| 1279 } |
| 1280 } |
| 1281 |
| 1282 Call::Config::BitrateConfigMask mask; |
| 1283 mask.min_bitrate_bps = bitrate.min_bitrate_bps; |
| 1284 mask.start_bitrate_bps = bitrate.current_bitrate_bps; |
| 1285 mask.max_bitrate_bps = bitrate.max_bitrate_bps; |
| 1286 |
| 1287 RTC_DCHECK(call_.get()); |
| 1288 call_->SetBitrateConfigMask(mask); |
| 1289 |
| 1290 return RTCError::OK(); |
| 1291 } |
| 1292 |
1245 bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file, | 1293 bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file, |
1246 int64_t max_size_bytes) { | 1294 int64_t max_size_bytes) { |
1247 return factory_->worker_thread()->Invoke<bool>( | 1295 return factory_->worker_thread()->Invoke<bool>( |
1248 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StartRtcEventLog_w, this, file, | 1296 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StartRtcEventLog_w, this, file, |
1249 max_size_bytes)); | 1297 max_size_bytes)); |
1250 } | 1298 } |
1251 | 1299 |
1252 void PeerConnection::StopRtcEventLog() { | 1300 void PeerConnection::StopRtcEventLog() { |
1253 factory_->worker_thread()->Invoke<void>( | 1301 factory_->worker_thread()->Invoke<void>( |
1254 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StopRtcEventLog_w, this)); | 1302 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StopRtcEventLog_w, this)); |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 call_config.audio_state = | 2384 call_config.audio_state = |
2337 factory_->channel_manager() ->media_engine()->GetAudioState(); | 2385 factory_->channel_manager() ->media_engine()->GetAudioState(); |
2338 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 2386 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
2339 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 2387 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
2340 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 2388 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
2341 | 2389 |
2342 call_.reset(webrtc::Call::Create(call_config)); | 2390 call_.reset(webrtc::Call::Create(call_config)); |
2343 } | 2391 } |
2344 | 2392 |
2345 } // namespace webrtc | 2393 } // namespace webrtc |
OLD | NEW |