Chromium Code Reviews| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 int64_t rtt_ms) { | 102 int64_t rtt_ms) { |
| 103 rtc::CritScope lock(&crit_); | 103 rtc::CritScope lock(&crit_); |
| 104 stats_.decode_ms = decode_ms; | 104 stats_.decode_ms = decode_ms; |
| 105 stats_.max_decode_ms = max_decode_ms; | 105 stats_.max_decode_ms = max_decode_ms; |
| 106 stats_.current_delay_ms = current_delay_ms; | 106 stats_.current_delay_ms = current_delay_ms; |
| 107 stats_.target_delay_ms = target_delay_ms; | 107 stats_.target_delay_ms = target_delay_ms; |
| 108 stats_.jitter_buffer_ms = jitter_buffer_ms; | 108 stats_.jitter_buffer_ms = jitter_buffer_ms; |
| 109 stats_.min_playout_delay_ms = min_playout_delay_ms; | 109 stats_.min_playout_delay_ms = min_playout_delay_ms; |
| 110 stats_.render_delay_ms = render_delay_ms; | 110 stats_.render_delay_ms = render_delay_ms; |
| 111 decode_time_counter_.Add(decode_ms); | 111 decode_time_counter_.Add(decode_ms); |
| 112 // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time + | |
| 113 // render delay). | |
| 114 delay_counter_.Add(target_delay_ms + rtt_ms / 2); | |
| 115 } | 112 } |
| 116 | 113 |
| 117 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( | 114 void ReceiveStatisticsProxy::RtcpPacketTypesCounterUpdated( |
| 118 uint32_t ssrc, | 115 uint32_t ssrc, |
| 119 const RtcpPacketTypeCounter& packet_counter) { | 116 const RtcpPacketTypeCounter& packet_counter) { |
| 120 rtc::CritScope lock(&crit_); | 117 rtc::CritScope lock(&crit_); |
| 121 if (stats_.ssrc != ssrc) | 118 if (stats_.ssrc != ssrc) |
| 122 return; | 119 return; |
| 123 stats_.rtcp_packet_type_counts = packet_counter; | 120 stats_.rtcp_packet_type_counts = packet_counter; |
| 124 } | 121 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 154 } | 151 } |
| 155 | 152 |
| 156 void ReceiveStatisticsProxy::OnDecodedFrame() { | 153 void ReceiveStatisticsProxy::OnDecodedFrame() { |
| 157 uint64_t now = clock_->TimeInMilliseconds(); | 154 uint64_t now = clock_->TimeInMilliseconds(); |
| 158 | 155 |
| 159 rtc::CritScope lock(&crit_); | 156 rtc::CritScope lock(&crit_); |
| 160 decode_fps_estimator_.Update(1, now); | 157 decode_fps_estimator_.Update(1, now); |
| 161 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); | 158 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); |
| 162 } | 159 } |
| 163 | 160 |
| 164 void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) { | 161 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { |
| 162 int width = frame.width(); | |
| 163 int height = frame.height(); | |
| 165 RTC_DCHECK_GT(width, 0); | 164 RTC_DCHECK_GT(width, 0); |
| 166 RTC_DCHECK_GT(height, 0); | 165 RTC_DCHECK_GT(height, 0); |
| 167 uint64_t now = clock_->TimeInMilliseconds(); | 166 uint64_t now = clock_->TimeInMilliseconds(); |
| 168 | 167 |
| 169 rtc::CritScope lock(&crit_); | 168 rtc::CritScope lock(&crit_); |
| 170 renders_fps_estimator_.Update(1, now); | 169 renders_fps_estimator_.Update(1, now); |
| 171 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); | 170 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); |
| 172 render_width_counter_.Add(width); | 171 render_width_counter_.Add(width); |
| 173 render_height_counter_.Add(height); | 172 render_height_counter_.Add(height); |
| 174 render_fps_tracker_.AddSamples(1); | 173 render_fps_tracker_.AddSamples(1); |
| 175 render_pixel_tracker_.AddSamples(sqrt(width * height)); | 174 render_pixel_tracker_.AddSamples(sqrt(width * height)); |
| 175 | |
| 176 if (frame.ntp_time_ms() > 0) { | |
| 177 delay_counter_.Add(clock_->CurrentNtpInMilliseconds() - | |
| 178 frame.ntp_time_ms()); | |
|
stefan-webrtc
2016/02/22 16:18:21
Maybe we should make sure this is positive before
åsapersson
2016/03/01 12:01:43
RemoteNtpTimeEstimator::Estimate returns -1 on err
stefan-webrtc
2016/03/01 12:38:20
I'm not sure that's enough as there are no guarant
åsapersson
2016/03/01 13:46:42
Ok. Added a check that the delay is positive befor
| |
| 179 } | |
| 176 } | 180 } |
| 177 | 181 |
| 178 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, | 182 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, |
| 179 uint32_t frameRate) { | 183 uint32_t frameRate) { |
| 180 } | 184 } |
| 181 | 185 |
| 182 void ReceiveStatisticsProxy::OnFrameCountsUpdated( | 186 void ReceiveStatisticsProxy::OnFrameCountsUpdated( |
| 183 const FrameCounts& frame_counts) { | 187 const FrameCounts& frame_counts) { |
| 184 rtc::CritScope lock(&crit_); | 188 rtc::CritScope lock(&crit_); |
| 185 stats_.frame_counts = frame_counts; | 189 stats_.frame_counts = frame_counts; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 206 ++num_samples; | 210 ++num_samples; |
| 207 } | 211 } |
| 208 | 212 |
| 209 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 213 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 210 if (num_samples < min_required_samples || num_samples == 0) | 214 if (num_samples < min_required_samples || num_samples == 0) |
| 211 return -1; | 215 return -1; |
| 212 return sum / num_samples; | 216 return sum / num_samples; |
| 213 } | 217 } |
| 214 | 218 |
| 215 } // namespace webrtc | 219 } // namespace webrtc |
| OLD | NEW |