| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class ProbeBitrateEstimator { | 22 class ProbeBitrateEstimator { |
| 23 public: | 23 public: |
| 24 explicit ProbeBitrateEstimator(RtcEventLog* event_log); | 24 explicit ProbeBitrateEstimator(RtcEventLog* event_log); |
| 25 ~ProbeBitrateEstimator(); | 25 ~ProbeBitrateEstimator(); |
| 26 | 26 |
| 27 // Should be called for every probe packet we receive feedback about. | 27 // Should be called for every probe packet we receive feedback about. |
| 28 // Returns the estimated bitrate if the probe completes a valid cluster. | 28 // Returns the estimated bitrate if the probe completes a valid cluster. |
| 29 int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback); | 29 int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback); |
| 30 | 30 |
| 31 rtc::Optional<int> FetchAndResetLastEstimatedBitrateBps(); | 31 rtc::Optional<int> FetchAndResetLastEstimatedBitrateBps(int64_t timeout = 0); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 struct AggregatedCluster { | 34 struct AggregatedCluster { |
| 35 int num_probes = 0; | 35 int num_probes = 0; |
| 36 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); | 36 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); |
| 37 int64_t last_send_ms = 0; | 37 int64_t last_send_ms = 0; |
| 38 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); | 38 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); |
| 39 int64_t last_receive_ms = 0; | 39 int64_t last_receive_ms = 0; |
| 40 int size_last_send = 0; | 40 int size_last_send = 0; |
| 41 int size_first_receive = 0; | 41 int size_first_receive = 0; |
| 42 int size_total = 0; | 42 int size_total = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Erases old cluster data that was seen before |timestamp_ms|. | 45 // Erases old cluster data that was seen before |timestamp_ms|. |
| 46 void EraseOldClusters(int64_t timestamp_ms); | 46 void EraseOldClusters(int64_t timestamp_ms); |
| 47 | 47 |
| 48 std::map<int, AggregatedCluster> clusters_; | 48 std::map<int, AggregatedCluster> clusters_; |
| 49 RtcEventLog* const event_log_; | 49 RtcEventLog* const event_log_; |
| 50 rtc::Optional<int> estimated_bitrate_bps_; | 50 rtc::Optional<int> estimated_bitrate_bps_; |
| 51 int64_t last_estimate_update_ms_ = 0; |
| 52 int64_t start_ = 0; |
| 53 int cluster_id_ = -1; |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace webrtc | 56 } // namespace webrtc |
| 54 | 57 |
| 55 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ | 58 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| OLD | NEW |