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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1278383002: Remove avg encode time from CpuOveruseMetric struct and use value from OnEncodedFrame instead. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 8dd91d90f49ac298925ddffe95a2d1eaa0d1fc60..57d38a523b664a0ffcd4d074f80a0f8dd09df422 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -15,13 +15,14 @@
#include <map>
#include "webrtc/base/checks.h"
-
#include "webrtc/base/logging.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
namespace {
+const float kEncodeTimeWeigthFactor = 0.5f;
+
// Used by histograms. Values of entries should not be changed.
enum HistogramCodecType {
kVideoUnknown = 0,
@@ -72,6 +73,7 @@ SendStatisticsProxy::SendStatisticsProxy(
config_(config),
content_type_(content_type),
last_sent_frame_timestamp_(0),
+ encode_time_(kEncodeTimeWeigthFactor),
uma_container_(new UmaSamplesContainer(GetUmaPrefix(content_type_))) {
UpdateCodecTypeHistogram(config_.encoder_settings.payload_name);
}
@@ -168,8 +170,6 @@ void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) {
void SendStatisticsProxy::CpuOveruseMetricsUpdated(
const CpuOveruseMetrics& metrics) {
rtc::CritScope lock(&crit_);
- // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms.
- stats_.avg_encode_time_ms = metrics.avg_encode_time_ms;
stats_.encode_usage_percent = metrics.encode_usage_percent;
}
@@ -308,6 +308,8 @@ void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) {
rtc::CritScope lock(&crit_);
uma_container_->encode_time_counter_.Add(encode_time_ms);
+ encode_time_.Apply(1.0f, encode_time_ms);
+ stats_.avg_encode_time_ms = round(encode_time_.filtered());
}
void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(

Powered by Google App Engine
This is Rietveld 408576698