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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 | 48 |
49 // Returns the number of bytes that the prober recommends for the next probe | 49 // Returns the number of bytes that the prober recommends for the next probe |
50 // packet. | 50 // packet. |
51 size_t RecommendedPacketSize() const; | 51 size_t RecommendedPacketSize() const; |
52 | 52 |
53 // Called to report to the prober that a packet has been sent, which helps the | 53 // Called to report to the prober that a packet has been sent, which helps the |
54 // prober know when to move to the next packet in a probe. | 54 // prober know when to move to the next packet in a probe. |
55 void PacketSent(int64_t now_ms, size_t packet_size); | 55 void PacketSent(int64_t now_ms, size_t packet_size); |
56 | 56 |
57 private: | 57 private: |
58 enum ProbingState { kDisabled, kAllowedToProbe, kProbing, kWait }; | 58 // Resets the state of the prober and clears any cluster/timing data tracked. |
59 void ResetState(); | |
stefan-webrtc
2016/08/02 11:59:27
Put methods after enums/classes
Irfan
2016/08/02 16:44:30
Done.
| |
60 enum class ProbingState { | |
61 // Probing will not be triggered in this state at all times. | |
62 kDisabled, | |
63 // Probing is enabled and ready to trigger on the first packet arrival. | |
64 kInactive, | |
65 // Probe cluster is filled with the set of data rates to be probed and | |
66 // probes are being sent. | |
67 kActive, | |
68 // Probing is enabled, but currently suspended until an explicit trigger | |
69 // to start probing again. | |
70 kSuspended, | |
71 }; | |
59 | 72 |
60 struct ProbeCluster { | 73 struct ProbeCluster { |
61 int max_probe_packets = 0; | 74 int max_probe_packets = 0; |
62 int sent_probe_packets = 0; | 75 int sent_probe_packets = 0; |
63 int probe_bitrate_bps = 0; | 76 int probe_bitrate_bps = 0; |
64 int id = -1; | 77 int id = -1; |
65 }; | 78 }; |
66 | 79 |
67 ProbingState probing_state_; | 80 ProbingState probing_state_; |
68 // Probe bitrate per packet. These are used to compute the delta relative to | 81 // Probe bitrate per packet. These are used to compute the delta relative to |
69 // the previous probe packet based on the size and time when that packet was | 82 // the previous probe packet based on the size and time when that packet was |
70 // sent. | 83 // sent. |
71 std::queue<ProbeCluster> clusters_; | 84 std::queue<ProbeCluster> clusters_; |
72 size_t packet_size_last_send_; | 85 size_t packet_size_last_sent_; |
73 int64_t time_last_send_ms_; | 86 // The last time a probe was sent. |
87 int64_t time_last_probe_sent_ms_; | |
74 int next_cluster_id_; | 88 int next_cluster_id_; |
75 }; | 89 }; |
76 } // namespace webrtc | 90 } // namespace webrtc |
77 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ | 91 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ |
OLD | NEW |