Chromium Code Reviews| 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_PROBING_CALCULATOR_H_ | |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBING_CALCULATOR_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 class ProbingResultCallback { | |
| 22 public: | |
| 23 virtual void ProbingResult(int bps, int64_t timestamp) = 0; | |
| 24 virtual ~ProbingResultCallback() {} | |
| 25 }; | |
| 26 | |
| 27 class ProbingCalculator { | |
| 28 public: | |
| 29 explicit ProbingCalculator(ProbingResultCallback* result_callback); | |
| 30 | |
| 31 // Should be called for every packet we receive feedback about. If the | |
| 32 // packet was used for probing it will validate/calculate the resulting | |
| 33 // bitrate and call the |result_callback| with the new estimate. | |
| 34 void PacketFeedback(const PacketInfo& packet_info); | |
| 35 | |
| 36 private: | |
| 37 struct AggregatedCluster { | |
| 38 int num_probes = 0; | |
| 39 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); | |
| 40 int64_t last_send_ms = 0; | |
| 41 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); | |
| 42 int64_t last_receive_ms = 0; | |
| 43 float size = 0; | |
|
brandtr
2016/07/08 09:39:21
Why not cast to a float where needed for the compu
philipel
2016/07/08 10:49:17
I guess that's cleaner, done.
| |
| 44 }; | |
| 45 | |
| 46 std::map<int, AggregatedCluster> clusters_; | |
| 47 ProbingResultCallback* result_callback_; | |
| 48 int last_valid_cluster_id_; | |
| 49 }; | |
| 50 | |
| 51 } // namespace webrtc | |
| 52 | |
| 53 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBING_CALCULATOR_H_ | |
| OLD | NEW |