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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } else { | 388 } else { |
389 auto it = rtx_stats_.find(ssrc); | 389 auto it = rtx_stats_.find(ssrc); |
390 if (it != rtx_stats_.end()) { | 390 if (it != rtx_stats_.end()) { |
391 it->second = counters; | 391 it->second = counters; |
392 } else { | 392 } else { |
393 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc; | 393 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc; |
394 } | 394 } |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 void ReceiveStatisticsProxy::OnDecodedFrame() { | 398 void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp) { |
399 uint64_t now = clock_->TimeInMilliseconds(); | 399 uint64_t now = clock_->TimeInMilliseconds(); |
400 | 400 |
401 rtc::CritScope lock(&crit_); | 401 rtc::CritScope lock(&crit_); |
402 ++stats_.frames_decoded; | 402 ++stats_.frames_decoded; |
| 403 if (qp) { |
| 404 if (!stats_.qp_sum) { |
| 405 if (stats_.frames_decoded != 1) { |
| 406 LOG(LS_WARNING) |
| 407 << "Frames decoded was not 1 when first qp value was received."; |
| 408 stats_.frames_decoded = 1; |
| 409 } |
| 410 stats_.qp_sum = rtc::Optional<uint64_t>(0); |
| 411 } |
| 412 *stats_.qp_sum += *qp; |
| 413 } else if (stats_.qp_sum) { |
| 414 LOG(LS_WARNING) |
| 415 << "QP sum was already set and no QP was given for a frame."; |
| 416 stats_.qp_sum = rtc::Optional<uint64_t>(); |
| 417 } |
403 decode_fps_estimator_.Update(1, now); | 418 decode_fps_estimator_.Update(1, now); |
404 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0); | 419 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0); |
405 } | 420 } |
406 | 421 |
407 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { | 422 void ReceiveStatisticsProxy::OnRenderedFrame(const VideoFrame& frame) { |
408 int width = frame.width(); | 423 int width = frame.width(); |
409 int height = frame.height(); | 424 int height = frame.height(); |
410 RTC_DCHECK_GT(width, 0); | 425 RTC_DCHECK_GT(width, 0); |
411 RTC_DCHECK_GT(height, 0); | 426 RTC_DCHECK_GT(height, 0); |
412 uint64_t now = clock_->TimeInMilliseconds(); | 427 uint64_t now = clock_->TimeInMilliseconds(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 return -1; | 498 return -1; |
484 return static_cast<int>(sum / num_samples); | 499 return static_cast<int>(sum / num_samples); |
485 } | 500 } |
486 | 501 |
487 void ReceiveStatisticsProxy::SampleCounter::Reset() { | 502 void ReceiveStatisticsProxy::SampleCounter::Reset() { |
488 num_samples = 0; | 503 num_samples = 0; |
489 sum = 0; | 504 sum = 0; |
490 } | 505 } |
491 | 506 |
492 } // namespace webrtc | 507 } // namespace webrtc |
OLD | NEW |