| 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 |
| 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <limits> | 15 #include <limits> |
| 16 | 16 |
| 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 18 | 18 |
| 19 namespace webrtc { | 19 namespace webrtc { |
| 20 class RtcEventLog; |
| 20 | 21 |
| 21 class ProbeBitrateEstimator { | 22 class ProbeBitrateEstimator { |
| 22 public: | 23 public: |
| 23 ProbeBitrateEstimator(); | 24 explicit ProbeBitrateEstimator(RtcEventLog* event_log); |
| 24 | 25 |
| 25 // Should be called for every probe packet we receive feedback about. | 26 // Should be called for every probe packet we receive feedback about. |
| 26 // Returns the estimated bitrate if the probe completes a valid cluster. | 27 // Returns the estimated bitrate if the probe completes a valid cluster. |
| 27 int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback); | 28 int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback); |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 struct AggregatedCluster { | 31 struct AggregatedCluster { |
| 31 int num_probes = 0; | 32 int num_probes = 0; |
| 32 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); | 33 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); |
| 33 int64_t last_send_ms = 0; | 34 int64_t last_send_ms = 0; |
| 34 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); | 35 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); |
| 35 int64_t last_receive_ms = 0; | 36 int64_t last_receive_ms = 0; |
| 36 int size_last_send = 0; | 37 int size_last_send = 0; |
| 37 int size_first_receive = 0; | 38 int size_first_receive = 0; |
| 38 int size_total = 0; | 39 int size_total = 0; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 // Erases old cluster data that was seen before |timestamp_ms|. | 42 // Erases old cluster data that was seen before |timestamp_ms|. |
| 42 void EraseOldClusters(int64_t timestamp_ms); | 43 void EraseOldClusters(int64_t timestamp_ms); |
| 43 | 44 |
| 44 std::map<int, AggregatedCluster> clusters_; | 45 std::map<int, AggregatedCluster> clusters_; |
| 46 RtcEventLog* const event_log_; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace webrtc | 49 } // namespace webrtc |
| 48 | 50 |
| 49 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ | 51 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| OLD | NEW |