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

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

Issue 2628563003: Propagate packet pacing information to SenTimeHistory (Closed)
Patch Set: Rebase 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 | « webrtc/modules/include/module_common_types.h ('k') | 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
11 #ifndef WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 11 #ifndef WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
12 #define WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 12 #define WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
13 13
14 #include <queue> 14 #include <queue>
15 15
16 #include "webrtc/base/basictypes.h" 16 #include "webrtc/base/basictypes.h"
17 #include "webrtc/modules/include/module_common_types.h"
17 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 21
21 // Note that this class isn't thread-safe by itself and therefore relies 22 // Note that this class isn't thread-safe by itself and therefore relies
22 // on being protected by the caller. 23 // on being protected by the caller.
23 class BitrateProber { 24 class BitrateProber {
24 public: 25 public:
25 BitrateProber(); 26 BitrateProber();
26 27
(...skipping 10 matching lines...) Expand all
37 void OnIncomingPacket(size_t packet_size); 38 void OnIncomingPacket(size_t packet_size);
38 39
39 // Create a cluster used to probe for |bitrate_bps| with |num_probes| number 40 // Create a cluster used to probe for |bitrate_bps| with |num_probes| number
40 // of probes. 41 // of probes.
41 void CreateProbeCluster(int bitrate_bps, int64_t now_ms); 42 void CreateProbeCluster(int bitrate_bps, int64_t now_ms);
42 43
43 // Returns the number of milliseconds until the next probe should be sent to 44 // Returns the number of milliseconds until the next probe should be sent to
44 // get accurate probing. 45 // get accurate probing.
45 int TimeUntilNextProbe(int64_t now_ms); 46 int TimeUntilNextProbe(int64_t now_ms);
46 47
47 // Which cluster that is currently being used for probing. 48 // Information about the current probing cluster.
48 int CurrentClusterId() const; 49 PacedPacketInfo CurrentCluster() const;
49 50
50 // Returns the minimum number of bytes that the prober recommends for 51 // Returns the minimum number of bytes that the prober recommends for
51 // the next probe. 52 // the next probe.
52 size_t RecommendedMinProbeSize() const; 53 size_t RecommendedMinProbeSize() const;
53 54
54 // Called to report to the prober that a probe has been sent. In case of 55 // Called to report to the prober that a probe has been sent. In case of
55 // multiple packets per probe, this call would be made at the end of sending 56 // multiple packets per probe, this call would be made at the end of sending
56 // the last packet in probe. |probe_size| is the total size of all packets 57 // the last packet in probe. |probe_size| is the total size of all packets
57 // in probe. 58 // in probe.
58 void ProbeSent(int64_t now_ms, size_t probe_size); 59 void ProbeSent(int64_t now_ms, size_t probe_size);
59 60
60 private: 61 private:
61 enum class ProbingState { 62 enum class ProbingState {
62 // Probing will not be triggered in this state at all times. 63 // Probing will not be triggered in this state at all times.
63 kDisabled, 64 kDisabled,
64 // Probing is enabled and ready to trigger on the first packet arrival. 65 // Probing is enabled and ready to trigger on the first packet arrival.
65 kInactive, 66 kInactive,
66 // Probe cluster is filled with the set of data rates to be probed and 67 // Probe cluster is filled with the set of data rates to be probed and
67 // probes are being sent. 68 // probes are being sent.
68 kActive, 69 kActive,
69 // Probing is enabled, but currently suspended until an explicit trigger 70 // Probing is enabled, but currently suspended until an explicit trigger
70 // to start probing again. 71 // to start probing again.
71 kSuspended, 72 kSuspended,
72 }; 73 };
73 74
74 // A probe cluster consists of a set of probes. Each probe in turn can be 75 // 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. 76 // divided into a number of packets to accommodate the MTU on the network.
76 struct ProbeCluster { 77 struct ProbeCluster {
77 int min_probes = 0; 78 PacedPacketInfo pace_info;
78 int min_bytes = 0;
79 int bitrate_bps = 0;
80 int id = -1;
81 79
82 int sent_probes = 0; 80 int sent_probes = 0;
83 int sent_bytes = 0; 81 int sent_bytes = 0;
84 int64_t time_created_ms = -1; 82 int64_t time_created_ms = -1;
85 int64_t time_started_ms = -1; 83 int64_t time_started_ms = -1;
86
87 int retries = 0; 84 int retries = 0;
88 }; 85 };
89 86
90 // Resets the state of the prober and clears any cluster/timing data tracked. 87 // Resets the state of the prober and clears any cluster/timing data tracked.
91 void ResetState(int64_t now_ms); 88 void ResetState(int64_t now_ms);
92 89
93 int64_t GetNextProbeTime(const ProbeCluster& cluster); 90 int64_t GetNextProbeTime(const ProbeCluster& cluster);
94 91
95 ProbingState probing_state_; 92 ProbingState probing_state_;
96 93
97 // Probe bitrate per packet. These are used to compute the delta relative to 94 // Probe bitrate per packet. These are used to compute the delta relative to
98 // the previous probe packet based on the size and time when that packet was 95 // the previous probe packet based on the size and time when that packet was
99 // sent. 96 // sent.
100 std::queue<ProbeCluster> clusters_; 97 std::queue<ProbeCluster> clusters_;
101 98
102 // Time the next probe should be sent when in kActive state. 99 // Time the next probe should be sent when in kActive state.
103 int64_t next_probe_time_ms_; 100 int64_t next_probe_time_ms_;
104 101
105 int next_cluster_id_; 102 int next_cluster_id_;
106 }; 103 };
107 104
108 } // namespace webrtc 105 } // namespace webrtc
109 106
110 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 107 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/include/module_common_types.h ('k') | webrtc/modules/pacing/bitrate_prober.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698