| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 RemoveOldReports(now, &reports_); | 117 RemoveOldReports(now, &reports_); |
| 118 max_rtt_ms_ = GetMaxRttMs(&reports_); | 118 max_rtt_ms_ = GetMaxRttMs(&reports_); |
| 119 UpdateAvgRttMs(&reports_, &avg_rtt_ms_); | 119 UpdateAvgRttMs(&reports_, &avg_rtt_ms_); |
| 120 | 120 |
| 121 // If there is a valid rtt, update all observers with the max rtt. | 121 // If there is a valid rtt, update all observers with the max rtt. |
| 122 // TODO(asapersson): Consider changing this to report the average rtt. | 122 // TODO(asapersson): Consider changing this to report the average rtt. |
| 123 if (max_rtt_ms_ > 0) { | 123 if (max_rtt_ms_ > 0) { |
| 124 for (std::list<CallStatsObserver*>::iterator it = observers_.begin(); | 124 for (std::list<CallStatsObserver*>::iterator it = observers_.begin(); |
| 125 it != observers_.end(); ++it) { | 125 it != observers_.end(); ++it) { |
| 126 (*it)->OnRttUpdate(max_rtt_ms_); | 126 (*it)->OnRttUpdate(avg_rtt_ms_, max_rtt_ms_); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 return 0; | 129 return 0; |
| 130 } | 130 } |
| 131 | 131 |
| 132 int64_t CallStats::avg_rtt_ms() const { | 132 int64_t CallStats::avg_rtt_ms() const { |
| 133 CriticalSectionScoped cs(crit_.get()); | 133 CriticalSectionScoped cs(crit_.get()); |
| 134 return avg_rtt_ms_; | 134 return avg_rtt_ms_; |
| 135 } | 135 } |
| 136 | 136 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 void CallStats::OnRttUpdate(int64_t rtt) { | 162 void CallStats::OnRttUpdate(int64_t rtt) { |
| 163 CriticalSectionScoped cs(crit_.get()); | 163 CriticalSectionScoped cs(crit_.get()); |
| 164 reports_.push_back(RttTime(rtt, TickTime::MillisecondTimestamp())); | 164 reports_.push_back(RttTime(rtt, TickTime::MillisecondTimestamp())); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace webrtc | 167 } // namespace webrtc |
| OLD | NEW |