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

Side by Side Diff: webrtc/pc/peerconnection.cc

Issue 2793913008: Add PeerConnectionInterface::UpdateCallBitrate. (Closed)
Patch Set: move start DCHECK in SetBitrateConfig with other DCHECKs 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
OLDNEW
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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 kEnumCounterAddressFamily, kPeerConnection_IPv6, 1228 kEnumCounterAddressFamily, kPeerConnection_IPv6,
1229 kPeerConnectionAddressFamilyCounter_Max); 1229 kPeerConnectionAddressFamilyCounter_Max);
1230 } else { 1230 } else {
1231 uma_observer_->IncrementEnumCounter( 1231 uma_observer_->IncrementEnumCounter(
1232 kEnumCounterAddressFamily, kPeerConnection_IPv4, 1232 kEnumCounterAddressFamily, kPeerConnection_IPv4,
1233 kPeerConnectionAddressFamilyCounter_Max); 1233 kPeerConnectionAddressFamilyCounter_Max);
1234 } 1234 }
1235 } 1235 }
1236 } 1236 }
1237 1237
1238 RTCError PeerConnection::SetBitrate(const BitrateParameters& bitrate) {
1239 return factory_->worker_thread()->Invoke<RTCError>(
Taylor Brandstetter 2017/04/19 01:06:54 To avoid the extra indentation, and because the ch
Zach Stein 2017/04/20 20:48:00 Done.
1240 RTC_FROM_HERE, [this, &bitrate]() {
1241 const bool has_min = static_cast<bool>(bitrate.min_bitrate_bps);
1242 const bool has_current = static_cast<bool>(bitrate.current_bitrate_bps);
1243 const bool has_max = static_cast<bool>(bitrate.max_bitrate_bps);
1244 if (has_min && *bitrate.min_bitrate_bps <= 0) {
Taylor Brandstetter 2017/04/19 01:06:54 Isn't "min == 0" ok?
Zach Stein 2017/04/20 20:48:00 This makes setting all of the parameters to 0 lega
1245 return RTCError(RTCErrorType::INVALID_PARAMETER,
Taylor Brandstetter 2017/04/19 01:06:54 Can you use the "RETURN_AND_LOG_ERROR" macro, so t
Zach Stein 2017/04/20 20:48:00 Done.
1246 "min_bitrate_bps <= 0");
1247 }
1248 if (has_current) {
1249 if (has_min &&
1250 *bitrate.current_bitrate_bps < *bitrate.min_bitrate_bps) {
1251 return RTCError(RTCErrorType::INVALID_PARAMETER,
1252 "current_bitrate_bps < min_bitrate_bps");
1253 } else if (*bitrate.current_bitrate_bps < 0) {
1254 return RTCError(RTCErrorType::INVALID_PARAMETER,
1255 "curent_bitrate_bps < 0");
1256 }
1257 }
1258 if (has_max) {
1259 if (has_current &&
1260 *bitrate.max_bitrate_bps < *bitrate.current_bitrate_bps) {
1261 return RTCError(RTCErrorType::INVALID_PARAMETER,
1262 "max_bitrate_bps < current_bitrate_bps");
1263 } else if (has_min &&
1264 *bitrate.max_bitrate_bps < *bitrate.min_bitrate_bps) {
1265 return RTCError(RTCErrorType::INVALID_PARAMETER,
1266 "max_bitrate_bps < min_bitrate_bps");
1267 } else if (*bitrate.max_bitrate_bps < 0) {
1268 return RTCError(RTCErrorType::INVALID_PARAMETER,
1269 "max_bitrate_bps < 0");
1270 }
1271 }
1272
1273 Call::Config::BitrateConfigMask mask;
1274 mask.min_bitrate_bps = bitrate.min_bitrate_bps;
1275 mask.start_bitrate_bps = bitrate.current_bitrate_bps;
1276 mask.max_bitrate_bps = bitrate.max_bitrate_bps;
1277
1278 RTC_DCHECK(media_controller_);
1279 Call* call = media_controller_->call_w();
1280 call->SetBitrateConfigMask(mask);
1281
1282 return RTCError::OK();
1283 });
1284 }
1285
1238 bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file, 1286 bool PeerConnection::StartRtcEventLog(rtc::PlatformFile file,
1239 int64_t max_size_bytes) { 1287 int64_t max_size_bytes) {
1240 return factory_->worker_thread()->Invoke<bool>( 1288 return factory_->worker_thread()->Invoke<bool>(
1241 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StartRtcEventLog_w, this, file, 1289 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StartRtcEventLog_w, this, file,
1242 max_size_bytes)); 1290 max_size_bytes));
1243 } 1291 }
1244 1292
1245 void PeerConnection::StopRtcEventLog() { 1293 void PeerConnection::StopRtcEventLog() {
1246 factory_->worker_thread()->Invoke<void>( 1294 factory_->worker_thread()->Invoke<void>(
1247 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StopRtcEventLog_w, this)); 1295 RTC_FROM_HERE, rtc::Bind(&PeerConnection::StopRtcEventLog_w, this));
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 } 2356 }
2309 return event_log_->StartLogging(file, max_size_bytes); 2357 return event_log_->StartLogging(file, max_size_bytes);
2310 } 2358 }
2311 2359
2312 void PeerConnection::StopRtcEventLog_w() { 2360 void PeerConnection::StopRtcEventLog_w() {
2313 if (event_log_) { 2361 if (event_log_) {
2314 event_log_->StopLogging(); 2362 event_log_->StopLogging();
2315 } 2363 }
2316 } 2364 }
2317 } // namespace webrtc 2365 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698