Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: webrtc/video/receive_statistics_proxy.cc

Issue 2649133005: Add QP sum stats for received streams. (Closed)
Patch Set: Fix error. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/video/receive_statistics_proxy.cc
diff --git a/webrtc/video/receive_statistics_proxy.cc b/webrtc/video/receive_statistics_proxy.cc
index 68050ba6a8a440dcc3eb31a4edf22127d99949c0..90535a332c17c8a486bb0fec221c7e91115490db 100644
--- a/webrtc/video/receive_statistics_proxy.cc
+++ b/webrtc/video/receive_statistics_proxy.cc
@@ -395,11 +395,26 @@ void ReceiveStatisticsProxy::DataCountersUpdated(
}
}
-void ReceiveStatisticsProxy::OnDecodedFrame() {
+void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp) {
uint64_t now = clock_->TimeInMilliseconds();
rtc::CritScope lock(&crit_);
++stats_.frames_decoded;
+ if (qp) {
+ if (!stats_.qp_sum) {
+ if (stats_.frames_decoded != 1) {
+ LOG(LS_WARNING)
+ << "Frames decoded was not 1 when first qp value was received.";
+ stats_.frames_decoded = 1;
+ }
+ stats_.qp_sum = rtc::Optional<uint64_t>(0);
+ }
+ *stats_.qp_sum += *qp;
+ } else if (stats_.qp_sum) {
+ LOG(LS_WARNING)
+ << "QP sum was already set and no QP was given for a frame.";
+ stats_.qp_sum = rtc::Optional<uint64_t>();
+ }
decode_fps_estimator_.Update(1, now);
stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(0);
}

Powered by Google App Engine
This is Rietveld 408576698