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

Side by Side Diff: webrtc/modules/bitrate_controller/bitrate_allocator.cc

Issue 1413663004: Set pacer target bitrate to max of bwe and bitrate allocation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 (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 14 matching lines...) Expand all
25 25
26 BitrateAllocator::BitrateAllocator() 26 BitrateAllocator::BitrateAllocator()
27 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 27 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
28 bitrate_observers_(), 28 bitrate_observers_(),
29 enforce_min_bitrate_(true), 29 enforce_min_bitrate_(true),
30 last_bitrate_bps_(kDefaultBitrateBps), 30 last_bitrate_bps_(kDefaultBitrateBps),
31 last_fraction_loss_(0), 31 last_fraction_loss_(0),
32 last_rtt_(0) { 32 last_rtt_(0) {
33 } 33 }
34 34
35 35 uint32_t BitrateAllocator::OnNetworkChanged(uint32_t bitrate,
36 void BitrateAllocator::OnNetworkChanged(uint32_t bitrate, 36 uint8_t fraction_loss,
37 uint8_t fraction_loss, 37 int64_t rtt) {
38 int64_t rtt) {
39 CriticalSectionScoped lock(crit_sect_.get()); 38 CriticalSectionScoped lock(crit_sect_.get());
40 last_bitrate_bps_ = bitrate; 39 last_bitrate_bps_ = bitrate;
41 last_fraction_loss_ = fraction_loss; 40 last_fraction_loss_ = fraction_loss;
42 last_rtt_ = rtt; 41 last_rtt_ = rtt;
42 uint32_t allocated_bitrate = 0;
43 ObserverBitrateMap allocation = AllocateBitrates(); 43 ObserverBitrateMap allocation = AllocateBitrates();
44 for (const auto& kv : allocation) 44 for (const auto& kv : allocation) {
45 kv.first->OnNetworkChanged(kv.second, last_fraction_loss_, last_rtt_); 45 kv.first->OnNetworkChanged(kv.second, last_fraction_loss_, last_rtt_);
46 allocated_bitrate += kv.second;
47 }
48 return allocated_bitrate;
46 } 49 }
47 50
48 BitrateAllocator::ObserverBitrateMap BitrateAllocator::AllocateBitrates() { 51 BitrateAllocator::ObserverBitrateMap BitrateAllocator::AllocateBitrates() {
49 if (bitrate_observers_.empty()) 52 if (bitrate_observers_.empty())
50 return ObserverBitrateMap(); 53 return ObserverBitrateMap();
51 54
52 uint32_t sum_min_bitrates = 0; 55 uint32_t sum_min_bitrates = 0;
53 for (const auto& observer : bitrate_observers_) 56 for (const auto& observer : bitrate_observers_)
54 sum_min_bitrates += observer.second.min_bitrate; 57 sum_min_bitrates += observer.second.min_bitrate;
55 if (last_bitrate_bps_ <= sum_min_bitrates) 58 if (last_bitrate_bps_ <= sum_min_bitrates)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 for (const auto& observer : bitrate_observers_) { 184 for (const auto& observer : bitrate_observers_) {
182 uint32_t allocated_bitrate = 185 uint32_t allocated_bitrate =
183 std::min(remainder, observer.second.min_bitrate); 186 std::min(remainder, observer.second.min_bitrate);
184 allocation[observer.first] = allocated_bitrate; 187 allocation[observer.first] = allocated_bitrate;
185 remainder -= allocated_bitrate; 188 remainder -= allocated_bitrate;
186 } 189 }
187 } 190 }
188 return allocation; 191 return allocation;
189 } 192 }
190 } // namespace webrtc 193 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/bitrate_controller/include/bitrate_allocator.h » ('j') | webrtc/video_engine/vie_channel_group.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698