OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGED_BITRATE_ESTIMATOR_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGED_BITRATE_ESTIMATOR_H_ |
| 13 |
| 14 #include <memory> |
| 15 #include <vector> |
| 16 |
| 17 #include "webrtc/base/optional.h" |
| 18 #include "webrtc/modules/congestion_controller/bitrate_estimator.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 struct PacketFeedback; |
| 23 |
| 24 class BitrateEstimatorCreator { |
| 25 public: |
| 26 virtual ~BitrateEstimatorCreator() = default; |
| 27 virtual std::unique_ptr<BitrateEstimator> Create(); |
| 28 }; |
| 29 |
| 30 class AcknowledgedBitrateEstimator { |
| 31 public: |
| 32 explicit AcknowledgedBitrateEstimator( |
| 33 std::unique_ptr<BitrateEstimatorCreator> bitrate_estimator_creator); |
| 34 |
| 35 AcknowledgedBitrateEstimator(); |
| 36 |
| 37 void IncomingPacketFeedbackVector( |
| 38 const std::vector<PacketFeedback>& packet_feedback_vector, |
| 39 bool currently_in_alr); |
| 40 rtc::Optional<uint32_t> bitrate_bps() const; |
| 41 |
| 42 private: |
| 43 bool SentBeforeAlrEnded(const PacketFeedback& packet); |
| 44 bool AlrEnded(bool currently_in_alr) const; |
| 45 void MaybeResetBitrateEstimator(bool currently_in_alr); |
| 46 |
| 47 bool was_in_alr_; |
| 48 rtc::Optional<int64_t> alr_ended_time_ms_; |
| 49 const std::unique_ptr<BitrateEstimatorCreator> bitrate_estimator_creator_; |
| 50 std::unique_ptr<BitrateEstimator> bitrate_estimator_; |
| 51 }; |
| 52 |
| 53 } // namespace webrtc |
| 54 |
| 55 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_ACKNOWLEDGED_BITRATE_ESTIMATOR_H
_ |
OLD | NEW |