OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 |
11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
13 | 13 |
14 #include <memory> | |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
17 #include "webrtc/base/function_view.h" | |
kwiberg-webrtc
2017/06/08 23:00:29
Remove this? You don't appear to use it.
tschumi
2017/06/12 11:33:28
Done.
| |
16 #include "webrtc/base/optional.h" | 18 #include "webrtc/base/optional.h" |
19 #include "webrtc/modules/congestion_controller/bitrate_estimator.h" | |
17 | 20 |
18 namespace webrtc { | 21 namespace webrtc { |
19 | 22 |
20 struct PacketFeedback; | 23 struct PacketFeedback; |
21 | 24 |
22 // Computes a bayesian estimate of the throughput given acks containing | 25 using BitrateEstimatorCreator = |
23 // the arrival time and payload size. Samples which are far from the current | 26 std::function<std::unique_ptr<BitrateEstimator>()>; |
kwiberg-webrtc
2017/06/08 23:00:29
Hmm. I wonder if it wouldn't be simpler (in the se
tschumi
2017/06/12 11:33:28
Ok I went for that solution.
Looks fine to me :)
| |
24 // estimate or are based on few packets are given a smaller weight, as they | 27 |
25 // are considered to be more likely to have been caused by, e.g., delay spikes | |
26 // unrelated to congestion. | |
27 class AcknowledgedBitrateEstimator { | 28 class AcknowledgedBitrateEstimator { |
minyue-webrtc
2017/06/12 10:08:07
shouldn't the file name be called acknowledge"d"_b
tschumi
2017/06/12 11:33:28
Done.
| |
28 public: | 29 public: |
29 AcknowledgedBitrateEstimator(); | 30 AcknowledgedBitrateEstimator( |
31 BitrateEstimatorCreator&& bitrate_estimator_creator = nullptr); | |
kwiberg-webrtc
2017/06/08 23:00:29
The style guide says to not use rvalue ref argumen
tschumi
2017/06/12 11:33:28
Pass now a std::unique_ptr<BitrateEstimatorCreator
| |
30 | 32 |
31 void IncomingPacketFeedbackVector( | 33 void IncomingPacketFeedbackVector( |
32 const std::vector<PacketFeedback>& packet_feedback_vector); | 34 const std::vector<PacketFeedback>& packet_feedback_vector, |
35 bool alr_state); | |
minyue-webrtc
2017/06/12 10:08:07
what is alr? good to mention it in a comment
tschumi
2017/06/12 11:33:28
alr = ApplicationLimitedRegion
I'm not sure if we
| |
33 rtc::Optional<uint32_t> bitrate_bps() const; | 36 rtc::Optional<uint32_t> bitrate_bps() const; |
34 | 37 |
35 private: | 38 private: |
36 void Update(int64_t now_ms, int bytes); | 39 bool ShouldSkipPreAlrPacket(const PacketFeedback& packet); |
37 float UpdateWindow(int64_t now_ms, int bytes, int rate_window_ms); | 40 bool HasLeftAlrState(bool alr_state) const; |
41 void MaybeResetBitrateEstimator(bool alr_state); | |
38 | 42 |
39 int sum_; | 43 bool last_alr_state_; |
40 int64_t current_win_ms_; | 44 rtc::Optional<int64_t> left_alr_state_ms_; |
41 int64_t prev_time_ms_; | 45 BitrateEstimatorCreator bitrate_estimator_creator_; |
42 float bitrate_estimate_; | 46 std::unique_ptr<BitrateEstimator> bitrate_estimator_; |
43 float bitrate_estimate_var_; | |
44 }; | 47 }; |
45 | 48 |
46 } // namespace webrtc | 49 } // namespace webrtc |
47 | 50 |
48 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ | 51 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGE_BITRATE_ESTIMATOR_H_ |
OLD | NEW |