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

Side by Side Diff: webrtc/modules/pacing/bitrate_prober.h

Issue 2681733004: Fix bug in BitrateProber where an old probe added at a high bitrate will stay active indefinit… (Closed)
Patch Set: Add unittest. Created 3 years, 10 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
« no previous file with comments | « no previous file | webrtc/modules/pacing/bitrate_prober.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 20 matching lines...) Expand all
31 // TimeUntilNextProbe(). 31 // TimeUntilNextProbe().
32 bool IsProbing() const; 32 bool IsProbing() const;
33 33
34 // Initializes a new probing session if the prober is allowed to probe. Does 34 // Initializes a new probing session if the prober is allowed to probe. Does
35 // not initialize the prober unless the packet size is large enough to probe 35 // not initialize the prober unless the packet size is large enough to probe
36 // with. 36 // with.
37 void OnIncomingPacket(size_t packet_size); 37 void OnIncomingPacket(size_t packet_size);
38 38
39 // Create a cluster used to probe for |bitrate_bps| with |num_probes| number 39 // Create a cluster used to probe for |bitrate_bps| with |num_probes| number
40 // of probes. 40 // of probes.
41 void CreateProbeCluster(int bitrate_bps); 41 void CreateProbeCluster(int bitrate_bps, int64_t now_ms);
42 42
43 // Returns the number of milliseconds until the next probe should be sent to 43 // Returns the number of milliseconds until the next probe should be sent to
44 // get accurate probing. 44 // get accurate probing.
45 int TimeUntilNextProbe(int64_t now_ms); 45 int TimeUntilNextProbe(int64_t now_ms);
46 46
47 // Which cluster that is currently being used for probing. 47 // Which cluster that is currently being used for probing.
48 int CurrentClusterId() const; 48 int CurrentClusterId() const;
49 49
50 // Returns the minimum number of bytes that the prober recommends for 50 // Returns the minimum number of bytes that the prober recommends for
51 // the next probe. 51 // the next probe.
(...skipping 22 matching lines...) Expand all
74 // A probe cluster consists of a set of probes. Each probe in turn can be 74 // A probe cluster consists of a set of probes. Each probe in turn can be
75 // divided into a number of packets to accommodate the MTU on the network. 75 // divided into a number of packets to accommodate the MTU on the network.
76 struct ProbeCluster { 76 struct ProbeCluster {
77 int min_probes = 0; 77 int min_probes = 0;
78 int min_bytes = 0; 78 int min_bytes = 0;
79 int bitrate_bps = 0; 79 int bitrate_bps = 0;
80 int id = -1; 80 int id = -1;
81 81
82 int sent_probes = 0; 82 int sent_probes = 0;
83 int sent_bytes = 0; 83 int sent_bytes = 0;
84 int64_t time_created_ms = -1;
84 int64_t time_started_ms = -1; 85 int64_t time_started_ms = -1;
85 86
86 int retries = 0; 87 int retries = 0;
87 }; 88 };
88 89
89 // Resets the state of the prober and clears any cluster/timing data tracked. 90 // Resets the state of the prober and clears any cluster/timing data tracked.
90 void ResetState(); 91 void ResetState(int64_t now_ms);
91 92
92 int64_t GetNextProbeTime(const ProbeCluster& cluster); 93 int64_t GetNextProbeTime(const ProbeCluster& cluster);
93 94
94 ProbingState probing_state_; 95 ProbingState probing_state_;
95 96
96 // Probe bitrate per packet. These are used to compute the delta relative to 97 // Probe bitrate per packet. These are used to compute the delta relative to
97 // the previous probe packet based on the size and time when that packet was 98 // the previous probe packet based on the size and time when that packet was
98 // sent. 99 // sent.
99 std::queue<ProbeCluster> clusters_; 100 std::queue<ProbeCluster> clusters_;
100 101
101 // Time the next probe should be sent when in kActive state. 102 // Time the next probe should be sent when in kActive state.
102 int64_t next_probe_time_ms_; 103 int64_t next_probe_time_ms_;
103 104
104 int next_cluster_id_; 105 int next_cluster_id_;
105 }; 106 };
106 107
107 } // namespace webrtc 108 } // namespace webrtc
108 109
109 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 110 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/pacing/bitrate_prober.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698