OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ | 11 #ifndef WEBRTC_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ |
12 #define WEBRTC_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ | 12 #define WEBRTC_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 | 15 |
16 #include "webrtc/base/optional.h" | 16 #include "webrtc/base/optional.h" |
17 #include "webrtc/modules/include/module_common_types.h" | 17 #include "webrtc/modules/include/module_common_types.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 namespace rtcp { | 21 namespace rtcp { |
22 class TransportFeedback; | 22 class TransportFeedback; |
23 } | 23 } |
24 | 24 |
25 struct PacketFeedback; | |
26 | |
25 class TransportFeedbackPacketLossTracker final { | 27 class TransportFeedbackPacketLossTracker final { |
26 public: | 28 public: |
27 // * We count up to |max_window_size_ms| from the sent | 29 // * We count up to |max_window_size_ms| from the sent |
28 // time of the latest acked packet for the calculation of the metrics. | 30 // time of the latest acked packet for the calculation of the metrics. |
29 // * PLR (packet-loss-rate) is reliably computable once the statuses of | 31 // * PLR (packet-loss-rate) is reliably computable once the statuses of |
30 // |plr_min_num_acked_packets| packets are known. | 32 // |plr_min_num_acked_packets| packets are known. |
31 // * RPLR (recoverable-packet-loss-rate) is reliably computable once the | 33 // * RPLR (recoverable-packet-loss-rate) is reliably computable once the |
32 // statuses of |rplr_min_num_acked_pairs| pairs are known. | 34 // statuses of |rplr_min_num_acked_pairs| pairs are known. |
33 TransportFeedbackPacketLossTracker(int64_t max_window_size_ms, | 35 TransportFeedbackPacketLossTracker(int64_t max_window_size_ms, |
34 size_t plr_min_num_acked_packets, | 36 size_t plr_min_num_acked_packets, |
35 size_t rplr_min_num_acked_pairs); | 37 size_t rplr_min_num_acked_pairs); |
36 | 38 |
37 void OnPacketAdded(uint16_t seq_num, int64_t send_time_ms); | 39 void OnPacketAdded(uint16_t seq_num, int64_t send_time_ms); |
38 | 40 |
39 void OnReceivedTransportFeedback(const rtcp::TransportFeedback& feedback); | 41 void OnPacketFeedbacks(const std::vector<PacketFeedback>& packet_feedbacks); |
the sun
2017/03/21 09:53:41
Drop the plural "s"
| |
40 | 42 |
41 // Returns the packet loss rate, if the window has enough packet statuses to | 43 // Returns the packet loss rate, if the window has enough packet statuses to |
42 // reliably compute it. Otherwise, returns empty. | 44 // reliably compute it. Otherwise, returns empty. |
43 rtc::Optional<float> GetPacketLossRate() const; | 45 rtc::Optional<float> GetPacketLossRate() const; |
44 | 46 |
45 // Returns the first-order-FEC recoverable packet loss rate, if the window has | 47 // Returns the first-order-FEC recoverable packet loss rate, if the window has |
46 // enough status pairs to reliably compute it. Otherwise, returns empty. | 48 // enough status pairs to reliably compute it. Otherwise, returns empty. |
47 rtc::Optional<float> GetRecoverablePacketLossRate() const; | 49 rtc::Optional<float> GetRecoverablePacketLossRate() const; |
48 | 50 |
49 // Verifies that the internal states are correct. Only used for tests. | 51 // Verifies that the internal states are correct. Only used for tests. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 // of all pairs of consecutive acked packets. | 131 // of all pairs of consecutive acked packets. |
130 const size_t min_num_acked_pairs_; | 132 const size_t min_num_acked_pairs_; |
131 size_t num_acked_pairs_; | 133 size_t num_acked_pairs_; |
132 size_t num_recoverable_losses_; | 134 size_t num_recoverable_losses_; |
133 } rplr_state_; | 135 } rplr_state_; |
134 }; | 136 }; |
135 | 137 |
136 } // namespace webrtc | 138 } // namespace webrtc |
137 | 139 |
138 #endif // WEBRTC_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ | 140 #endif // WEBRTC_VOICE_ENGINE_TRANSPORT_FEEDBACK_PACKET_LOSS_TRACKER_H_ |
OLD | NEW |