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

Side by Side Diff: webrtc/call/bitrate_allocator.cc

Issue 2535593002: RTC_[D]CHECK_op: Remove "u" suffix on integer constants (Closed)
Patch Set: Created 4 years 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/base/flags.cc ('k') | webrtc/call/bitrate_estimator_tests.cc » ('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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 18 matching lines...) Expand all
29 29
30 // Require a bitrate increase of max(10%, 20kbps) to resume paused streams. 30 // Require a bitrate increase of max(10%, 20kbps) to resume paused streams.
31 const double kToggleFactor = 0.1; 31 const double kToggleFactor = 0.1;
32 const uint32_t kMinToggleBitrateBps = 20000; 32 const uint32_t kMinToggleBitrateBps = 20000;
33 33
34 const int64_t kBweLogIntervalMs = 5000; 34 const int64_t kBweLogIntervalMs = 5000;
35 35
36 namespace { 36 namespace {
37 37
38 double MediaRatio(uint32_t allocated_bitrate, uint32_t protection_bitrate) { 38 double MediaRatio(uint32_t allocated_bitrate, uint32_t protection_bitrate) {
39 RTC_DCHECK_GT(allocated_bitrate, 0u); 39 RTC_DCHECK_GT(allocated_bitrate, 0);
40 if (protection_bitrate == 0) 40 if (protection_bitrate == 0)
41 return 1.0; 41 return 1.0;
42 42
43 uint32_t media_bitrate = allocated_bitrate - protection_bitrate; 43 uint32_t media_bitrate = allocated_bitrate - protection_bitrate;
44 return media_bitrate / static_cast<double>(allocated_bitrate); 44 return media_bitrate / static_cast<double>(allocated_bitrate);
45 } 45 }
46 } // namespace 46 } // namespace
47 47
48 BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer) 48 BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
49 : limit_observer_(limit_observer), 49 : limit_observer_(limit_observer),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 ObserverSortingMap list_max_bitrates; 375 ObserverSortingMap list_max_bitrates;
376 for (const auto& observer_config : bitrate_observer_configs_) { 376 for (const auto& observer_config : bitrate_observer_configs_) {
377 if (include_zero_allocations || 377 if (include_zero_allocations ||
378 allocation->at(observer_config.observer) != 0) { 378 allocation->at(observer_config.observer) != 0) {
379 list_max_bitrates.insert(std::pair<uint32_t, const ObserverConfig*>( 379 list_max_bitrates.insert(std::pair<uint32_t, const ObserverConfig*>(
380 observer_config.max_bitrate_bps, &observer_config)); 380 observer_config.max_bitrate_bps, &observer_config));
381 } 381 }
382 } 382 }
383 auto it = list_max_bitrates.begin(); 383 auto it = list_max_bitrates.begin();
384 while (it != list_max_bitrates.end()) { 384 while (it != list_max_bitrates.end()) {
385 RTC_DCHECK_GT(bitrate, 0u); 385 RTC_DCHECK_GT(bitrate, 0);
386 uint32_t extra_allocation = 386 uint32_t extra_allocation =
387 bitrate / static_cast<uint32_t>(list_max_bitrates.size()); 387 bitrate / static_cast<uint32_t>(list_max_bitrates.size());
388 uint32_t total_allocation = 388 uint32_t total_allocation =
389 extra_allocation + allocation->at(it->second->observer); 389 extra_allocation + allocation->at(it->second->observer);
390 bitrate -= extra_allocation; 390 bitrate -= extra_allocation;
391 if (total_allocation > max_multiplier * it->first) { 391 if (total_allocation > max_multiplier * it->first) {
392 // There is more than we can fit for this observer, carry over to the 392 // There is more than we can fit for this observer, carry over to the
393 // remaining observers. 393 // remaining observers.
394 bitrate += total_allocation - max_multiplier * it->first; 394 bitrate += total_allocation - max_multiplier * it->first;
395 total_allocation = max_multiplier * it->first; 395 total_allocation = max_multiplier * it->first;
(...skipping 14 matching lines...) Expand all
410 (bitrate - sum_min_bitrates) / 410 (bitrate - sum_min_bitrates) /
411 static_cast<uint32_t>(bitrate_observer_configs_.size()); 411 static_cast<uint32_t>(bitrate_observer_configs_.size());
412 for (const auto& observer_config : bitrate_observer_configs_) { 412 for (const auto& observer_config : bitrate_observer_configs_) {
413 if (observer_config.min_bitrate_bps + extra_bitrate_per_observer < 413 if (observer_config.min_bitrate_bps + extra_bitrate_per_observer <
414 MinBitrateWithHysteresis(observer_config)) 414 MinBitrateWithHysteresis(observer_config))
415 return false; 415 return false;
416 } 416 }
417 return true; 417 return true;
418 } 418 }
419 } // namespace webrtc 419 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/flags.cc ('k') | webrtc/call/bitrate_estimator_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698