| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 RTC_DCHECK(!timestamps_us_.empty()); | 128 RTC_DCHECK(!timestamps_us_.empty()); |
| 129 return static_cast<double>(std::accumulate(timestamps_us_.begin(), | 129 return static_cast<double>(std::accumulate(timestamps_us_.begin(), |
| 130 timestamps_us_.end(), 0)) / | 130 timestamps_us_.end(), 0)) / |
| 131 timestamps_us_.size(); | 131 timestamps_us_.size(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 double GetDurationStandardDeviation() const { | 134 double GetDurationStandardDeviation() const { |
| 135 RTC_DCHECK(!timestamps_us_.empty()); | 135 RTC_DCHECK(!timestamps_us_.empty()); |
| 136 double average_duration = GetDurationAverage(); | 136 double average_duration = GetDurationAverage(); |
| 137 | 137 |
| 138 int64_t variance = | 138 double variance = std::accumulate( |
| 139 std::accumulate(timestamps_us_.begin(), timestamps_us_.end(), 0, | 139 timestamps_us_.begin(), timestamps_us_.end(), 0.0, |
| 140 [average_duration](const int64_t& a, const int64_t& b) { | 140 [average_duration](const double& a, const int64_t& b) { |
| 141 return a + (b - average_duration); | 141 return a + (b - average_duration) * (b - average_duration); |
| 142 }); | 142 }); |
| 143 | 143 |
| 144 return sqrt(variance / timestamps_us_.size()); | 144 return sqrt(variance / timestamps_us_.size()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 webrtc::Clock* clock_; | 148 webrtc::Clock* clock_; |
| 149 rtc::Optional<int64_t> start_timestamp_us_; | 149 rtc::Optional<int64_t> start_timestamp_us_; |
| 150 std::vector<int64_t> timestamps_us_; | 150 std::vector<int64_t> timestamps_us_; |
| 151 }; | 151 }; |
| 152 | 152 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 RunTogetherWithApm("LevelControlAndDefaultMobileApm", 48000, 48000, | 346 RunTogetherWithApm("LevelControlAndDefaultMobileApm", 48000, 48000, |
| 347 capture_input_sample_rate_hz, | 347 capture_input_sample_rate_hz, |
| 348 capture_output_sample_rate_hz, num_channels, true, | 348 capture_output_sample_rate_hz, num_channels, true, |
| 349 true); | 349 true); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace webrtc | 355 } // namespace webrtc |
| OLD | NEW |