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

Side by Side Diff: webrtc/modules/congestion_controller/probe_bitrate_estimator.cc

Issue 2728553007: Use pacing info in ProbeBitrateEstimator to validate probe results. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" 11 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "webrtc/base/checks.h" 15 #include "webrtc/base/checks.h"
16 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
17 17
18 namespace { 18 namespace {
19 // The minumum number of probes we need for a valid cluster. 19 // The minumum number of probes we need for a valid cluster.
Sergey Ulanov 2017/03/08 22:12:20 Update this comment (e.g. "Portion of successful p
philipel 2017/03/09 11:47:41 Done.
20 constexpr int kMinNumProbesValidCluster = 4; 20 constexpr float kMinReceivedProbesRatio = 4.0 / 5.0;
Sergey Ulanov 2017/03/08 22:12:20 0.8?
philipel 2017/03/09 11:47:41 Changed to int instead.
21
22 // The minumum number of bytes we need for a valid cluster.
Sergey Ulanov 2017/03/08 22:12:20 rephrase this comment as well please. It's a ratio
philipel 2017/03/09 11:47:41 Done.
23 constexpr float kMinReceivedBytesRatio = 4.0 / 5.0;
21 24
22 // The maximum (receive rate)/(send rate) ratio for a valid estimate. 25 // The maximum (receive rate)/(send rate) ratio for a valid estimate.
23 constexpr float kValidRatio = 2.0f; 26 constexpr float kValidRatio = 2.0f;
24 27
25 // The maximum time period over which the cluster history is retained. 28 // The maximum time period over which the cluster history is retained.
26 // This is also the maximum time period beyond which a probing burst is not 29 // This is also the maximum time period beyond which a probing burst is not
27 // expected to last. 30 // expected to last.
28 constexpr int kMaxClusterHistoryMs = 1000; 31 constexpr int kMaxClusterHistoryMs = 1000;
29 32
30 // The maximum time interval between first and the last probe on a cluster 33 // The maximum time interval between first and the last probe on a cluster
(...skipping 25 matching lines...) Expand all
56 if (packet_info.arrival_time_ms < cluster->first_receive_ms) { 59 if (packet_info.arrival_time_ms < cluster->first_receive_ms) {
57 cluster->first_receive_ms = packet_info.arrival_time_ms; 60 cluster->first_receive_ms = packet_info.arrival_time_ms;
58 cluster->size_first_receive = payload_size_bits; 61 cluster->size_first_receive = payload_size_bits;
59 } 62 }
60 if (packet_info.arrival_time_ms > cluster->last_receive_ms) { 63 if (packet_info.arrival_time_ms > cluster->last_receive_ms) {
61 cluster->last_receive_ms = packet_info.arrival_time_ms; 64 cluster->last_receive_ms = packet_info.arrival_time_ms;
62 } 65 }
63 cluster->size_total += payload_size_bits; 66 cluster->size_total += payload_size_bits;
64 cluster->num_probes += 1; 67 cluster->num_probes += 1;
65 68
66 if (cluster->num_probes < kMinNumProbesValidCluster) 69 RTC_DCHECK_GT(packet_info.pacing_info.probe_cluster_min_probes, 0);
70 RTC_DCHECK_GT(packet_info.pacing_info.probe_cluster_min_bytes, 0);
71
72 int min_probes =
73 static_cast<int>(packet_info.pacing_info.probe_cluster_min_probes *
terelius 2017/03/08 15:55:11 This might not be rounded correctly. kMinReceivedP
Sergey Ulanov 2017/03/08 22:12:20 maybe use integer percentage value (4/5 = 80%)? Th
philipel 2017/03/09 11:47:41 True, switched to int as Sergey suggested.
philipel 2017/03/09 11:47:41 Good idea, implemented!
74 kMinReceivedProbesRatio);
75 int min_bytes = static_cast<int>(
terelius 2017/03/08 15:55:11 This might not be rounded correctly. kMinReceivedB
76 packet_info.pacing_info.probe_cluster_min_bytes * kMinReceivedBytesRatio);
77 if (cluster->num_probes < min_probes || cluster->size_total < min_bytes * 8)
67 return -1; 78 return -1;
68 79
69 float send_interval_ms = cluster->last_send_ms - cluster->first_send_ms; 80 float send_interval_ms = cluster->last_send_ms - cluster->first_send_ms;
70 float receive_interval_ms = 81 float receive_interval_ms =
71 cluster->last_receive_ms - cluster->first_receive_ms; 82 cluster->last_receive_ms - cluster->first_receive_ms;
72 83
73 if (send_interval_ms <= 0 || send_interval_ms > kMaxProbeIntervalMs || 84 if (send_interval_ms <= 0 || send_interval_ms > kMaxProbeIntervalMs ||
74 receive_interval_ms <= 0 || receive_interval_ms > kMaxProbeIntervalMs) { 85 receive_interval_ms <= 0 || receive_interval_ms > kMaxProbeIntervalMs) {
75 LOG(LS_INFO) << "Probing unsuccessful, invalid send/receive interval" 86 LOG(LS_INFO) << "Probing unsuccessful, invalid send/receive interval"
76 << " [cluster id: " << cluster_id 87 << " [cluster id: " << cluster_id
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { 130 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) {
120 for (auto it = clusters_.begin(); it != clusters_.end();) { 131 for (auto it = clusters_.begin(); it != clusters_.end();) {
121 if (it->second.last_receive_ms < timestamp_ms) { 132 if (it->second.last_receive_ms < timestamp_ms) {
122 it = clusters_.erase(it); 133 it = clusters_.erase(it);
123 } else { 134 } else {
124 ++it; 135 ++it;
125 } 136 }
126 } 137 }
127 } 138 }
128 } // namespace webrtc 139 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698