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 17 matching lines...) Expand all Loading... |
28 FrameLengthChange(int from_frame_length_ms, int to_frame_length_ms); | 28 FrameLengthChange(int from_frame_length_ms, int to_frame_length_ms); |
29 bool operator<(const FrameLengthChange& rhs) const; | 29 bool operator<(const FrameLengthChange& rhs) const; |
30 int from_frame_length_ms; | 30 int from_frame_length_ms; |
31 int to_frame_length_ms; | 31 int to_frame_length_ms; |
32 }; | 32 }; |
33 Config(const std::vector<int>& encoder_frame_lengths_ms, | 33 Config(const std::vector<int>& encoder_frame_lengths_ms, |
34 int initial_frame_length_ms, | 34 int initial_frame_length_ms, |
35 int min_encoder_bitrate_bps, | 35 int min_encoder_bitrate_bps, |
36 float fl_increasing_packet_loss_fraction, | 36 float fl_increasing_packet_loss_fraction, |
37 float fl_decreasing_packet_loss_fraction, | 37 float fl_decreasing_packet_loss_fraction, |
| 38 int fl_increase_overhead_offset, |
| 39 int fl_decrease_overhead_offset, |
38 std::map<FrameLengthChange, int> fl_changing_bandwidths_bps); | 40 std::map<FrameLengthChange, int> fl_changing_bandwidths_bps); |
39 Config(const Config& other); | 41 Config(const Config& other); |
40 ~Config(); | 42 ~Config(); |
41 std::vector<int> encoder_frame_lengths_ms; | 43 std::vector<int> encoder_frame_lengths_ms; |
42 int initial_frame_length_ms; | 44 int initial_frame_length_ms; |
43 int min_encoder_bitrate_bps; | 45 int min_encoder_bitrate_bps; |
44 // Uplink packet loss fraction below which frame length can increase. | 46 // Uplink packet loss fraction below which frame length can increase. |
45 float fl_increasing_packet_loss_fraction; | 47 float fl_increasing_packet_loss_fraction; |
46 // Uplink packet loss fraction below which frame length should decrease. | 48 // Uplink packet loss fraction below which frame length should decrease. |
47 float fl_decreasing_packet_loss_fraction; | 49 float fl_decreasing_packet_loss_fraction; |
| 50 // Offset to apply to overhead calculation when increasing frame length. |
| 51 int fl_increase_overhead_offset; |
| 52 // Offset to apply to overhead calculation when decreasing frame length. |
| 53 int fl_decrease_overhead_offset; |
48 std::map<FrameLengthChange, int> fl_changing_bandwidths_bps; | 54 std::map<FrameLengthChange, int> fl_changing_bandwidths_bps; |
49 }; | 55 }; |
50 | 56 |
51 explicit FrameLengthController(const Config& config); | 57 explicit FrameLengthController(const Config& config); |
52 | 58 |
53 ~FrameLengthController() override; | 59 ~FrameLengthController() override; |
54 | 60 |
55 void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override; | 61 void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override; |
56 | 62 |
57 void MakeDecision(AudioEncoderRuntimeConfig* config) override; | 63 void MakeDecision(AudioEncoderRuntimeConfig* config) override; |
58 | 64 |
59 private: | 65 private: |
60 bool FrameLengthIncreasingDecision( | 66 bool FrameLengthIncreasingDecision( |
61 const AudioEncoderRuntimeConfig& config) const; | 67 const AudioEncoderRuntimeConfig& config) const; |
62 | 68 |
63 bool FrameLengthDecreasingDecision( | 69 bool FrameLengthDecreasingDecision( |
64 const AudioEncoderRuntimeConfig& config) const; | 70 const AudioEncoderRuntimeConfig& config) const; |
65 | 71 |
66 const Config config_; | 72 const Config config_; |
67 | 73 |
68 std::vector<int>::const_iterator frame_length_ms_; | 74 std::vector<int>::const_iterator frame_length_ms_; |
69 | 75 |
70 rtc::Optional<int> uplink_bandwidth_bps_; | 76 rtc::Optional<int> uplink_bandwidth_bps_; |
71 | 77 |
72 rtc::Optional<float> uplink_packet_loss_fraction_; | 78 rtc::Optional<float> uplink_packet_loss_fraction_; |
73 | 79 |
74 rtc::Optional<size_t> overhead_bytes_per_packet_; | 80 rtc::Optional<size_t> overhead_bytes_per_packet_; |
75 | 81 |
| 82 // True if the previous frame length decision was an increase, otherwise |
| 83 // false. |
| 84 bool prev_decision_increase_ = false; |
| 85 |
76 RTC_DISALLOW_COPY_AND_ASSIGN(FrameLengthController); | 86 RTC_DISALLOW_COPY_AND_ASSIGN(FrameLengthController); |
77 }; | 87 }; |
78 | 88 |
79 } // namespace webrtc | 89 } // namespace webrtc |
80 | 90 |
81 #endif // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_FRAME_LENGTH_CONTROLLER_H_ | 91 #endif // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_FRAME_LENGTH_CONTROLLER_H_ |
OLD | NEW |