OLD | NEW |
---|---|
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/typedefs.h" | 17 #include "webrtc/typedefs.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 class ProbeClusterCreatedObserver { | |
22 public: | |
23 virtual ~ProbeClusterCreatedObserver() {} | |
24 // Called whenever a probing cluster is created by the BitrateProber. | |
25 // |cluster_id| = the id of the cluster. | |
nisse-webrtc
2017/01/11 10:47:40
I think I understand the purpose of this now. The
philipel
2017/01/11 12:08:04
Actually, the cluster id is not sent over the wire
nisse-webrtc
2017/01/11 12:33:39
In that case, I think information about the probe
nisse-webrtc
2017/01/11 12:33:39
The class still needs a comment explaining its pur
philipel
2017/01/12 10:39:29
I think it makes more sense to store this informat
| |
26 // |min_bytes| = the minimum number of bytes that will be used. | |
27 // |min_probes| = the minimum number of probing packets that will be used. | |
28 virtual void OnProbingClusterCreated(int cluster_id, | |
29 int min_bytes, | |
30 int min_probes) = 0; | |
nisse-webrtc
2017/01/11 10:47:40
I think min_packets is a better name than min_prob
philipel
2017/01/11 12:08:04
We have used "probes" to refer to packets being pa
| |
31 }; | |
32 | |
21 // Note that this class isn't thread-safe by itself and therefore relies | 33 // Note that this class isn't thread-safe by itself and therefore relies |
22 // on being protected by the caller. | 34 // on being protected by the caller. |
23 class BitrateProber { | 35 class BitrateProber { |
24 public: | 36 public: |
25 BitrateProber(); | 37 BitrateProber(); |
26 | 38 |
39 explicit BitrateProber(ProbeClusterCreatedObserver* cluster_created_observer); | |
40 | |
27 void SetEnabled(bool enable); | 41 void SetEnabled(bool enable); |
28 | 42 |
29 // Returns true if the prober is in a probing session, i.e., it currently | 43 // 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 | 44 // wants packets to be sent out according to the time returned by |
31 // TimeUntilNextProbe(). | 45 // TimeUntilNextProbe(). |
32 bool IsProbing() const; | 46 bool IsProbing() const; |
33 | 47 |
34 // Initializes a new probing session if the prober is allowed to probe. Does | 48 // 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 | 49 // not initialize the prober unless the packet size is large enough to probe |
36 // with. | 50 // with. |
(...skipping 56 matching lines...) Loading... | |
93 | 107 |
94 // Probe bitrate per packet. These are used to compute the delta relative to | 108 // Probe bitrate per packet. These are used to compute the delta relative to |
95 // the previous probe packet based on the size and time when that packet was | 109 // the previous probe packet based on the size and time when that packet was |
96 // sent. | 110 // sent. |
97 std::queue<ProbeCluster> clusters_; | 111 std::queue<ProbeCluster> clusters_; |
98 | 112 |
99 // Time the next probe should be sent when in kActive state. | 113 // Time the next probe should be sent when in kActive state. |
100 int64_t next_probe_time_ms_; | 114 int64_t next_probe_time_ms_; |
101 | 115 |
102 int next_cluster_id_; | 116 int next_cluster_id_; |
117 | |
118 ProbeClusterCreatedObserver* cluster_created_observer_; | |
103 }; | 119 }; |
104 | 120 |
105 } // namespace webrtc | 121 } // namespace webrtc |
106 | 122 |
107 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ | 123 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ |
OLD | NEW |