| OLD | NEW |
| 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 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 << " [cluster id: " << cluster_id << "] [send: " << send_size | 132 << " [cluster id: " << cluster_id << "] [send: " << send_size |
| 133 << " bytes / " << send_interval_ms << " ms = " << send_bps / 1000 | 133 << " bytes / " << send_interval_ms << " ms = " << send_bps / 1000 |
| 134 << " kb/s]" | 134 << " kb/s]" |
| 135 << " [receive: " << receive_size << " bytes / " | 135 << " [receive: " << receive_size << " bytes / " |
| 136 << receive_interval_ms << " ms = " << receive_bps / 1000 | 136 << receive_interval_ms << " ms = " << receive_bps / 1000 |
| 137 << " kb/s]"; | 137 << " kb/s]"; |
| 138 | 138 |
| 139 float res = std::min(send_bps, receive_bps); | 139 float res = std::min(send_bps, receive_bps); |
| 140 if (event_log_) | 140 if (event_log_) |
| 141 event_log_->LogProbeResultSuccess(cluster_id, res); | 141 event_log_->LogProbeResultSuccess(cluster_id, res); |
| 142 estimated_bitrate_bps_ = rtc::Optional<int>(std::min(send_bps, res)); | 142 estimated_bitrate_bps_ = rtc::Optional<int>(res); |
| 143 return *estimated_bitrate_bps_; | 143 return *estimated_bitrate_bps_; |
| 144 } | 144 } |
| 145 | 145 |
| 146 rtc::Optional<int> | 146 rtc::Optional<int> |
| 147 ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrateBps() { | 147 ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrateBps() { |
| 148 rtc::Optional<int> estimated_bitrate_bps = estimated_bitrate_bps_; | 148 rtc::Optional<int> estimated_bitrate_bps = estimated_bitrate_bps_; |
| 149 estimated_bitrate_bps_.reset(); | 149 estimated_bitrate_bps_.reset(); |
| 150 return estimated_bitrate_bps; | 150 return estimated_bitrate_bps; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { | 153 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { |
| 154 for (auto it = clusters_.begin(); it != clusters_.end();) { | 154 for (auto it = clusters_.begin(); it != clusters_.end();) { |
| 155 if (it->second.last_receive_ms < timestamp_ms) { | 155 if (it->second.last_receive_ms < timestamp_ms) { |
| 156 it = clusters_.erase(it); | 156 it = clusters_.erase(it); |
| 157 } else { | 157 } else { |
| 158 ++it; | 158 ++it; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 } // namespace webrtc | 162 } // namespace webrtc |
| OLD | NEW |