OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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_ALR_DETECTOR_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_ALR_DETECTOR_H_ |
| 13 |
| 14 #include "webrtc/common_types.h" |
| 15 #include "webrtc/modules/pacing/paced_sender.h" |
| 16 #include "webrtc/typedefs.h" |
| 17 |
| 18 namespace webrtc { |
| 19 |
| 20 // Application limited region detector is a class that utilizes signals of |
| 21 // elapsed time and bytes sent to estimate whether network traffic is |
| 22 // currently limited by the application's ability to generate traffic. |
| 23 // |
| 24 // AlrDetector provides a signal that can be utilized to adjust |
| 25 // estimate bandwidth. |
| 26 // Note: This class is not thread-safe. |
| 27 class AlrDetector : public PacedSender::PacingObserver { |
| 28 public: |
| 29 AlrDetector(); |
| 30 ~AlrDetector(); |
| 31 // PacingObserver override. |
| 32 void OnBytesSent(size_t bytes_sent, int64_t elapsed_time_ms) override; |
| 33 // Set current estimated bandwidth. |
| 34 void SetEstimatedBitrate(int bitrate_bps); |
| 35 // Returns true if currently in application-limited region. |
| 36 bool InApplicationLimitedRegion(); |
| 37 |
| 38 private: |
| 39 int measurement_interval_bytes_sent_; |
| 40 int64_t measurement_interval_elapsed_time_ms_; |
| 41 int estimated_bitrate_bps_; |
| 42 // Number of consecutive periods over which we observe traffic is application |
| 43 // limited. |
| 44 int application_limited_count_; |
| 45 }; |
| 46 |
| 47 } // namespace webrtc |
| 48 |
| 49 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_ALR_DETECTOR_H_ |
OLD | NEW |