Index: webrtc/video/vie_encoder.cc |
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc |
index de6b9a8a636ed91f912f5f50a802d9a15fadc2be..c51402abd18835dbb90b944fed8ed0db252f71c0 100644 |
--- a/webrtc/video/vie_encoder.cc |
+++ b/webrtc/video/vie_encoder.cc |
@@ -15,6 +15,7 @@ |
#include <utility> |
#include "webrtc/modules/video_coding/include/video_codec_initializer.h" |
+#include "webrtc/base/arraysize.h" |
#include "webrtc/base/checks.h" |
#include "webrtc/base/logging.h" |
#include "webrtc/base/trace_event.h" |
@@ -262,6 +263,7 @@ ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
has_received_rpsi_(false), |
picture_id_rpsi_(0), |
clock_(Clock::GetRealTimeClock()), |
+ scale_counter_(kScaleReasonSize, 0), |
last_frame_width_(0), |
last_frame_height_(0), |
last_captured_timestamp_(0), |
@@ -590,9 +592,8 @@ EncodedImageCallback::Result ViEEncoder::OnEncodedImage( |
// Encoded is called on whatever thread the real encoder implementation run |
// on. In the case of hardware encoders, there might be several encoders |
// running in parallel on different threads. |
- if (stats_proxy_) { |
+ if (stats_proxy_) |
stats_proxy_->OnSendEncodedImage(encoded_image, codec_specific_info); |
- } |
EncodedImageCallback::Result result = |
sink_->OnEncodedImage(encoded_image, codec_specific_info, fragmentation); |
@@ -701,7 +702,8 @@ void ViEEncoder::ScaleDown(ScaleReason reason) { |
return; |
switch (reason) { |
case kQuality: |
- stats_proxy_->OnQualityRestrictedResolutionChanged(true); |
+ stats_proxy_->OnQualityRestrictedResolutionChanged( |
+ scale_counter_[reason] + 1); |
break; |
case kCpu: |
if (scale_counter_[reason] >= kMaxCpuDowngrades) |
@@ -733,7 +735,7 @@ void ViEEncoder::ScaleUp(ScaleReason reason) { |
switch (reason) { |
case kQuality: |
stats_proxy_->OnQualityRestrictedResolutionChanged( |
- scale_counter_[reason] > 1); |
+ scale_counter_[reason]); |
åsapersson
2016/12/14 09:25:13
-1? Maybe add a test.
kthelgason
2016/12/15 10:33:54
Wow, good catch, thanks!
|
break; |
case kCpu: |
// Update stats accordingly. |