OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 12 matching lines...) Expand all Loading... |
23 const VideoCodec& codec, | 23 const VideoCodec& codec, |
24 std::unique_ptr<TemporalLayersFactory> tl_factory) | 24 std::unique_ptr<TemporalLayersFactory> tl_factory) |
25 : codec_(codec), tl_factory_(std::move(tl_factory)) { | 25 : codec_(codec), tl_factory_(std::move(tl_factory)) { |
26 if (tl_factory_.get()) | 26 if (tl_factory_.get()) |
27 tl_factory_->SetListener(this); | 27 tl_factory_->SetListener(this); |
28 } | 28 } |
29 | 29 |
30 void SimulcastRateAllocator::OnTemporalLayersCreated(int simulcast_id, | 30 void SimulcastRateAllocator::OnTemporalLayersCreated(int simulcast_id, |
31 TemporalLayers* layers) { | 31 TemporalLayers* layers) { |
32 RTC_DCHECK(temporal_layers_.find(simulcast_id) == temporal_layers_.end()); | 32 RTC_DCHECK(temporal_layers_.find(simulcast_id) == temporal_layers_.end()); |
| 33 RTC_DCHECK(layers); |
33 temporal_layers_[simulcast_id] = layers; | 34 temporal_layers_[simulcast_id] = layers; |
34 } | 35 } |
35 | 36 |
36 BitrateAllocation SimulcastRateAllocator::GetAllocation( | 37 BitrateAllocation SimulcastRateAllocator::GetAllocation( |
37 uint32_t total_bitrate_bps, | 38 uint32_t total_bitrate_bps, |
38 uint32_t framerate) { | 39 uint32_t framerate) { |
39 uint32_t left_to_allocate = total_bitrate_bps; | 40 uint32_t left_to_allocate = total_bitrate_bps; |
40 if (codec_.maxBitrate && codec_.maxBitrate * 1000 < left_to_allocate) | 41 if (codec_.maxBitrate && codec_.maxBitrate * 1000 < left_to_allocate) |
41 left_to_allocate = codec_.maxBitrate * 1000; | 42 left_to_allocate = codec_.maxBitrate * 1000; |
42 | 43 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 BitrateAllocation allocation = | 154 BitrateAllocation allocation = |
154 temp_allocator.GetAllocation(codec_.maxBitrate * 1000, framerate); | 155 temp_allocator.GetAllocation(codec_.maxBitrate * 1000, framerate); |
155 return allocation.get_sum_bps(); | 156 return allocation.get_sum_bps(); |
156 } | 157 } |
157 | 158 |
158 const VideoCodec& webrtc::SimulcastRateAllocator::GetCodec() const { | 159 const VideoCodec& webrtc::SimulcastRateAllocator::GetCodec() const { |
159 return codec_; | 160 return codec_; |
160 } | 161 } |
161 | 162 |
162 } // namespace webrtc | 163 } // namespace webrtc |
OLD | NEW |