OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 for (std::list<Probe>::const_iterator it = probes_.begin(); | 105 for (std::list<Probe>::const_iterator it = probes_.begin(); |
106 it != probes_.end(); | 106 it != probes_.end(); |
107 ++it) { | 107 ++it) { |
108 if (prev_send_time >= 0) { | 108 if (prev_send_time >= 0) { |
109 int send_delta_ms = it->send_time_ms - prev_send_time; | 109 int send_delta_ms = it->send_time_ms - prev_send_time; |
110 int recv_delta_ms = it->recv_time_ms - prev_recv_time; | 110 int recv_delta_ms = it->recv_time_ms - prev_recv_time; |
111 if (send_delta_ms >= 1 && recv_delta_ms >= 1) { | 111 if (send_delta_ms >= 1 && recv_delta_ms >= 1) { |
112 ++current.num_above_min_delta; | 112 ++current.num_above_min_delta; |
113 } | 113 } |
114 if (!IsWithinClusterBounds(send_delta_ms, current)) { | 114 if (!IsWithinClusterBounds(send_delta_ms, current)) { |
115 if (current.count >= kMinClusterSize) | 115 if (current.count >= kMinClusterSize && |
| 116 current.send_mean_ms > 0.0f && |
| 117 current.recv_mean_ms > 0.0f) { |
116 AddCluster(clusters, ¤t); | 118 AddCluster(clusters, ¤t); |
| 119 } |
117 current = Cluster(); | 120 current = Cluster(); |
118 } | 121 } |
119 current.send_mean_ms += send_delta_ms; | 122 current.send_mean_ms += send_delta_ms; |
120 current.recv_mean_ms += recv_delta_ms; | 123 current.recv_mean_ms += recv_delta_ms; |
121 current.mean_size += it->payload_size; | 124 current.mean_size += it->payload_size; |
122 ++current.count; | 125 ++current.count; |
123 } | 126 } |
124 prev_send_time = it->send_time_ms; | 127 prev_send_time = it->send_time_ms; |
125 prev_recv_time = it->recv_time_ms; | 128 prev_recv_time = it->recv_time_ms; |
126 } | 129 } |
127 if (current.count >= kMinClusterSize) | 130 if (current.count >= kMinClusterSize && |
| 131 current.send_mean_ms > 0.0f && |
| 132 current.recv_mean_ms > 0.0f) { |
128 AddCluster(clusters, ¤t); | 133 AddCluster(clusters, ¤t); |
| 134 } |
129 } | 135 } |
130 | 136 |
131 std::list<Cluster>::const_iterator | 137 std::list<Cluster>::const_iterator |
132 RemoteBitrateEstimatorAbsSendTime::FindBestProbe( | 138 RemoteBitrateEstimatorAbsSendTime::FindBestProbe( |
133 const std::list<Cluster>& clusters) const { | 139 const std::list<Cluster>& clusters) const { |
134 int highest_probe_bitrate_bps = 0; | 140 int highest_probe_bitrate_bps = 0; |
135 std::list<Cluster>::const_iterator best_it = clusters.end(); | 141 std::list<Cluster>::const_iterator best_it = clusters.end(); |
136 for (std::list<Cluster>::const_iterator it = clusters.begin(); | 142 for (std::list<Cluster>::const_iterator it = clusters.begin(); |
137 it != clusters.end(); | 143 it != clusters.end(); |
138 ++it) { | 144 ++it) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 return true; | 408 return true; |
403 } | 409 } |
404 | 410 |
405 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) { | 411 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) { |
406 // Called from both the configuration thread and the network thread. Shouldn't | 412 // Called from both the configuration thread and the network thread. Shouldn't |
407 // be called from the network thread in the future. | 413 // be called from the network thread in the future. |
408 rtc::CritScope lock(&crit_); | 414 rtc::CritScope lock(&crit_); |
409 remote_rate_.SetMinBitrate(min_bitrate_bps); | 415 remote_rate_.SetMinBitrate(min_bitrate_bps); |
410 } | 416 } |
411 } // namespace webrtc | 417 } // namespace webrtc |
OLD | NEW |