Chromium Code Reviews| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 << kValidRatio << ")]"; | 105 << kValidRatio << ")]"; |
| 106 return -1; | 106 return -1; |
| 107 } | 107 } |
| 108 LOG(LS_INFO) << "Probing successful" | 108 LOG(LS_INFO) << "Probing successful" |
| 109 << " [cluster id: " << packet_info.probe_cluster_id | 109 << " [cluster id: " << packet_info.probe_cluster_id |
| 110 << "] [send: " << send_size << " bytes / " << send_interval_ms | 110 << "] [send: " << send_size << " bytes / " << send_interval_ms |
| 111 << " ms = " << send_bps / 1000 << " kb/s]" | 111 << " ms = " << send_bps / 1000 << " kb/s]" |
| 112 << " [receive: " << receive_size << " bytes / " | 112 << " [receive: " << receive_size << " bytes / " |
| 113 << receive_interval_ms << " ms = " << receive_bps / 1000 | 113 << receive_interval_ms << " ms = " << receive_bps / 1000 |
| 114 << " kb/s]"; | 114 << " kb/s]"; |
| 115 return std::min(send_bps, receive_bps); | 115 |
| 116 estimated_bitrate_bps_ = rtc::Optional<int>(std::min(send_bps, receive_bps)); | |
| 117 return *estimated_bitrate_bps_; | |
| 118 } | |
| 119 | |
| 120 rtc::Optional<int> ProbeBitrateEstimator::FetchLastEstimatedBitrateBps() { | |
|
stefan-webrtc
2017/03/28 08:38:28
FetchAndReset...
michaelt
2017/03/28 09:59:13
Done.
| |
| 121 rtc::Optional<int> estimated_bitrate_bps = estimated_bitrate_bps_; | |
| 122 estimated_bitrate_bps_.reset(); | |
| 123 return estimated_bitrate_bps; | |
| 116 } | 124 } |
| 117 | 125 |
| 118 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { | 126 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { |
| 119 for (auto it = clusters_.begin(); it != clusters_.end();) { | 127 for (auto it = clusters_.begin(); it != clusters_.end();) { |
| 120 if (it->second.last_receive_ms < timestamp_ms) { | 128 if (it->second.last_receive_ms < timestamp_ms) { |
| 121 it = clusters_.erase(it); | 129 it = clusters_.erase(it); |
| 122 } else { | 130 } else { |
| 123 ++it; | 131 ++it; |
| 124 } | 132 } |
| 125 } | 133 } |
| 126 } | 134 } |
| 127 } // namespace webrtc | 135 } // namespace webrtc |
| OLD | NEW |