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 21 matching lines...) Expand all Loading... |
32 : clock_(clock), | 32 : clock_(clock), |
33 protection_callback_(protection_callback), | 33 protection_callback_(protection_callback), |
34 loss_prot_logic_(new media_optimization::VCMLossProtectionLogic( | 34 loss_prot_logic_(new media_optimization::VCMLossProtectionLogic( |
35 clock_->TimeInMilliseconds())), | 35 clock_->TimeInMilliseconds())), |
36 max_payload_size_(1460) {} | 36 max_payload_size_(1460) {} |
37 | 37 |
38 ProtectionBitrateCalculator::~ProtectionBitrateCalculator(void) { | 38 ProtectionBitrateCalculator::~ProtectionBitrateCalculator(void) { |
39 loss_prot_logic_->Release(); | 39 loss_prot_logic_->Release(); |
40 } | 40 } |
41 | 41 |
42 void ProtectionBitrateCalculator::SetEncodingData(uint32_t target_bitrate, | 42 void ProtectionBitrateCalculator::SetEncodingData(size_t width, |
43 uint16_t width, | 43 size_t height, |
44 uint16_t height, | |
45 uint32_t frame_rate, | |
46 size_t num_temporal_layers, | 44 size_t num_temporal_layers, |
47 size_t max_payload_size) { | 45 size_t max_payload_size) { |
48 CritScope lock(&crit_sect_); | 46 CritScope lock(&crit_sect_); |
49 // Everything codec specific should be reset here since this means the codec | |
50 // has changed. | |
51 float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f; | |
52 loss_prot_logic_->UpdateBitRate(target_bitrate_kbps); | |
53 loss_prot_logic_->UpdateFrameRate(static_cast<float>(frame_rate)); | |
54 loss_prot_logic_->UpdateFrameSize(width, height); | 47 loss_prot_logic_->UpdateFrameSize(width, height); |
55 loss_prot_logic_->UpdateNumLayers(num_temporal_layers); | 48 loss_prot_logic_->UpdateNumLayers(num_temporal_layers); |
56 max_payload_size_ = max_payload_size; | 49 max_payload_size_ = max_payload_size; |
57 } | 50 } |
58 | 51 |
59 uint32_t ProtectionBitrateCalculator::SetTargetRates( | 52 uint32_t ProtectionBitrateCalculator::SetTargetRates( |
60 uint32_t estimated_bitrate_bps, | 53 uint32_t estimated_bitrate_bps, |
61 int actual_framerate_fps, | 54 int actual_framerate_fps, |
62 uint8_t fraction_lost, | 55 uint8_t fraction_lost, |
63 int64_t round_trip_time_ms) { | 56 int64_t round_trip_time_ms) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 min_packets_per_frame, clock_->TimeInMilliseconds()); | 182 min_packets_per_frame, clock_->TimeInMilliseconds()); |
190 } | 183 } |
191 } | 184 } |
192 if (!delta_frame && encoded_length > 0) { | 185 if (!delta_frame && encoded_length > 0) { |
193 loss_prot_logic_->UpdateKeyFrameSize(static_cast<float>(encoded_length)); | 186 loss_prot_logic_->UpdateKeyFrameSize(static_cast<float>(encoded_length)); |
194 } | 187 } |
195 } | 188 } |
196 } | 189 } |
197 | 190 |
198 } // namespace webrtc | 191 } // namespace webrtc |
OLD | NEW |