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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 rtc::CritScope lock(&crit_); | 162 rtc::CritScope lock(&crit_); |
163 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 163 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
164 if (stats == nullptr) | 164 if (stats == nullptr) |
165 return; | 165 return; |
166 | 166 |
167 stats->width = encoded_image._encodedWidth; | 167 stats->width = encoded_image._encodedWidth; |
168 stats->height = encoded_image._encodedHeight; | 168 stats->height = encoded_image._encodedHeight; |
169 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 169 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
170 | 170 |
171 if (encoded_image._frameType != kSkipFrame) | 171 key_frame_counter_.Add(encoded_image._frameType == kKeyFrame); |
172 key_frame_counter_.Add(encoded_image._frameType == kKeyFrame); | |
173 | 172 |
174 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 173 // TODO(asapersson): This is incorrect if simulcast layers are encoded on |
175 // different threads and there is no guarantee that one frame of all layers | 174 // different threads and there is no guarantee that one frame of all layers |
176 // are encoded before the next start. | 175 // are encoded before the next start. |
177 if (last_sent_frame_timestamp_ > 0 && | 176 if (last_sent_frame_timestamp_ > 0 && |
178 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 177 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
179 sent_frame_rate_tracker_.AddSamples(1); | 178 sent_frame_rate_tracker_.AddSamples(1); |
180 sent_width_counter_.Add(max_sent_width_per_timestamp_); | 179 sent_width_counter_.Add(max_sent_width_per_timestamp_); |
181 sent_height_counter_.Add(max_sent_height_per_timestamp_); | 180 sent_height_counter_.Add(max_sent_height_per_timestamp_); |
182 max_sent_width_per_timestamp_ = 0; | 181 max_sent_width_per_timestamp_ = 0; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 298 } |
300 | 299 |
301 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 300 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
302 int min_required_samples, float multiplier) const { | 301 int min_required_samples, float multiplier) const { |
303 if (num_samples < min_required_samples || num_samples == 0) | 302 if (num_samples < min_required_samples || num_samples == 0) |
304 return -1; | 303 return -1; |
305 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 304 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
306 } | 305 } |
307 | 306 |
308 } // namespace webrtc | 307 } // namespace webrtc |
OLD | NEW |