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

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

Issue 2347023002: BitrateProber: Support higher probing bitrates (Closed)
Patch Set: Rebased Created 4 years, 2 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 18 matching lines...) Expand all
29 // Returns true if the prober is in a probing session, i.e., it currently 29 // Returns true if the prober is in a probing session, i.e., it currently
30 // wants packets to be sent out according to the time returned by 30 // wants packets to be sent out according to the time returned by
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_packets| number 39 // Create a cluster used to probe for |bitrate_bps| with |num_probes| number
40 // of packets. 40 // of probes.
41 void CreateProbeCluster(int bitrate_bps, int num_packets); 41 void CreateProbeCluster(int bitrate_bps, int num_probes);
42 42
43 // Returns the number of milliseconds until the next packet 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 number of bytes that the prober recommends for the next probe 50 // Returns the minimum number of bytes that the prober recommends for
51 // packet. 51 // the next probe.
52 size_t RecommendedPacketSize() const; 52 size_t RecommendedMinProbeSize() const;
53 53
54 // Called to report to the prober that a packet has been sent, which helps the 54 // Called to report to the prober that a probe has been sent. In case of
55 // prober know when to move to the next packet in a probe. 55 // multiple packets per probe, this call would be made at the end of sending
56 void PacketSent(int64_t now_ms, size_t packet_size); 56 // the last packet in probe. |probe_size| is the total size of all packets
57 // in probe.
58 void ProbeSent(int64_t now_ms, size_t probe_size);
57 59
58 private: 60 private:
59 enum class ProbingState { 61 enum class ProbingState {
60 // Probing will not be triggered in this state at all times. 62 // Probing will not be triggered in this state at all times.
61 kDisabled, 63 kDisabled,
62 // Probing is enabled and ready to trigger on the first packet arrival. 64 // Probing is enabled and ready to trigger on the first packet arrival.
63 kInactive, 65 kInactive,
64 // Probe cluster is filled with the set of data rates to be probed and 66 // Probe cluster is filled with the set of data rates to be probed and
65 // probes are being sent. 67 // probes are being sent.
66 kActive, 68 kActive,
67 // Probing is enabled, but currently suspended until an explicit trigger 69 // Probing is enabled, but currently suspended until an explicit trigger
68 // to start probing again. 70 // to start probing again.
69 kSuspended, 71 kSuspended,
70 }; 72 };
71 73
74 // A probe cluster consists of a set of probes. Each probe in turn can be
75 // divided into a number of packets to accomodate the MTU on the network.
72 struct ProbeCluster { 76 struct ProbeCluster {
73 int max_probe_packets = 0; 77 int max_probes = 0;
74 int sent_probe_packets = 0; 78 int sent_probes = 0;
75 int probe_bitrate_bps = 0; 79 int probe_bitrate_bps = 0;
76 int id = -1; 80 int id = -1;
77 }; 81 };
78 82
79 // Resets the state of the prober and clears any cluster/timing data tracked. 83 // Resets the state of the prober and clears any cluster/timing data tracked.
80 void ResetState(); 84 void ResetState();
81 85
82 ProbingState probing_state_; 86 ProbingState probing_state_;
83 // Probe bitrate per packet. These are used to compute the delta relative to 87 // Probe bitrate per packet. These are used to compute the delta relative to
84 // the previous probe packet based on the size and time when that packet was 88 // the previous probe packet based on the size and time when that packet was
85 // sent. 89 // sent.
86 std::queue<ProbeCluster> clusters_; 90 std::queue<ProbeCluster> clusters_;
87 size_t packet_size_last_sent_; 91 // A probe can include one or more packets.
92 size_t probe_size_last_sent_;
88 // The last time a probe was sent. 93 // The last time a probe was sent.
89 int64_t time_last_probe_sent_ms_; 94 int64_t time_last_probe_sent_ms_;
90 int next_cluster_id_; 95 int next_cluster_id_;
91 }; 96 };
92 } // namespace webrtc 97 } // namespace webrtc
93 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 98 #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