Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(927)

Side by Side Diff: webrtc/modules/congestion_controller/probe_bitrate_estimator.h

Issue 2239143002: ProbingEstimator: Erase history based on time threshold (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Reduced cluster history to 1s Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20
21 struct ProbingResult {
22 static constexpr int kNoEstimate = -1;
23
24 ProbingResult();
25 ProbingResult(int bps, int64_t timestamp);
26 bool valid() const;
27
28 int bps;
29 int64_t timestamp;
30 };
31
32 class ProbeBitrateEstimator { 21 class ProbeBitrateEstimator {
33 public: 22 public:
34 ProbeBitrateEstimator(); 23 ProbeBitrateEstimator();
35 24
36 // Should be called for every packet we receive feedback about. If the 25 // Should be called for every probe packet we receive feedback about.
37 // packet was used for probing it will validate/calculate the resulting 26 // Estimates highest bitrate across all probe clusters received.
38 // bitrate and return the result. 27 // |min_probe_clusters| specifies minimum number of probe clusters to
39 ProbingResult PacketFeedback(const PacketInfo& packet_info); 28 // have a valid BW value.
29 int HandleProbeAndEstimateBitrate(const PacketInfo& packet_info,
danilchap 2016/08/19 11:46:30 this function returns -1 when bitrate doesn't chan
Irfan 2016/08/22 18:11:17 Given that I have removed the highest across clust
30 int min_probe_clusters);
40 31
41 private: 32 private:
42 struct AggregatedCluster { 33 struct AggregatedCluster {
43 int num_probes = 0; 34 int num_probes = 0;
44 int64_t first_send_ms = std::numeric_limits<int64_t>::max(); 35 int64_t first_send_ms = std::numeric_limits<int64_t>::max();
45 int64_t last_send_ms = 0; 36 int64_t last_send_ms = 0;
46 int64_t first_receive_ms = std::numeric_limits<int64_t>::max(); 37 int64_t first_receive_ms = std::numeric_limits<int64_t>::max();
47 int64_t last_receive_ms = 0; 38 int64_t last_receive_ms = 0;
48 size_t size = 0; 39 size_t size = 0;
40 int bps = 0;
49 }; 41 };
50 42
43 // Erases old cluster data that was seen before |timestamp_ms|.
44 void EraseOldClusters(int64_t timestamp_ms);
45
46 int HighestBitrateOnClusters();
47
51 std::map<int, AggregatedCluster> clusters_; 48 std::map<int, AggregatedCluster> clusters_;
52 int last_valid_cluster_id_; 49 int valid_clusters_ = 0;
53 }; 50 };
54 51
55 } // namespace webrtc 52 } // namespace webrtc
56 53
57 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_ 54 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_BITRATE_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698