| 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_PROBE_BITRATE_ESTIMATOR_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| 13 |
| 14 #include <map> |
| 15 #include <limits> |
| 16 |
| 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 18 |
| 19 namespace webrtc { |
| 20 |
| 21 struct ProbingResult { |
| 22 static constexpr int kNoEstimate = -1; |
| 23 |
| 24 ProbingResult(); |
| 25 ProbingResult(int bps, int64_t timestamp); |
| 26 |
| 27 int bps; |
| 28 int64_t timestamp; |
| 29 }; |
| 30 |
| 31 class ProbeBitrateEstimator { |
| 32 public: |
| 33 ProbeBitrateEstimator(); |
| 34 |
| 35 // Should be called for every packet we receive feedback about. If the |
| 36 // packet was used for probing it will validate/calculate the resulting |
| 37 // bitrate and return the result. |
| 38 ProbingResult PacketFeedback(const PacketInfo& packet_info); |
| 39 |
| 40 private: |
| 41 struct AggregatedCluster { |
| 42 int num_probes = 0; |
| 43 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); |
| 44 int64_t last_send_ms = 0; |
| 45 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); |
| 46 int64_t last_receive_ms = 0; |
| 47 size_t size = 0; |
| 48 }; |
| 49 |
| 50 std::map<int, AggregatedCluster> clusters_; |
| 51 int last_valid_cluster_id_; |
| 52 }; |
| 53 |
| 54 } // namespace webrtc |
| 55 |
| 56 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ |
| OLD | NEW |