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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 1325153009: Add histogram for percentage of sent frames that are limited in resolution due to quality. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add stats for number of times a frame is down scaled Created 5 years, 3 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/modules/video_coding/codecs/vp8/vp8_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
index 3b6df7550fcc3fa7deb127c8f0172f9d6703ef67..d73c23356e2e85b1c1ace6f2f2ceaea5a04d2f61 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -148,7 +148,8 @@ VP8EncoderImpl::VP8EncoderImpl()
down_scale_bitrate_(0),
tl0_frame_dropper_(),
tl1_frame_dropper_(kTl1MaxTimeToDropFrames),
- key_frame_request_(kMaxSimulcastStreams, false) {
+ key_frame_request_(kMaxSimulcastStreams, false),
+ quality_scaler_enabled_(false) {
uint32_t seed = static_cast<uint32_t>(TickTime::MillisecondTimestamp());
srand(seed);
@@ -583,6 +584,12 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
false);
quality_scaler_.ReportFramerate(codec_.maxFramerate);
+ // Only apply scaling to improve for single-layer streams. The scaling metrics
+ // use frame drops as a signal and is only applicable when we drop frames.
+ quality_scaler_enabled_ = encoders_.size() == 1 &&
+ configurations_[0].rc_dropframe_thresh > 0 &&
+ codec_.codecSpecific.VP8.automaticResizeOn;
+
return InitAndSetControlSettings();
}
@@ -704,17 +711,12 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame,
if (encoded_complete_callback_ == NULL)
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
- // Only apply scaling to improve for single-layer streams. The scaling metrics
- // use frame drops as a signal and is only applicable when we drop frames.
- const bool use_quality_scaler = encoders_.size() == 1 &&
- configurations_[0].rc_dropframe_thresh > 0 &&
- codec_.codecSpecific.VP8.automaticResizeOn;
- if (use_quality_scaler)
+ if (quality_scaler_enabled_)
quality_scaler_.OnEncodeFrame(frame);
const VideoFrame& input_image =
- use_quality_scaler ? quality_scaler_.GetScaledFrame(frame) : frame;
+ quality_scaler_enabled_ ? quality_scaler_.GetScaledFrame(frame) : frame;
- if (use_quality_scaler && (input_image.width() != codec_.width ||
+ if (quality_scaler_enabled_ && (input_image.width() != codec_.width ||
input_image.height() != codec_.height)) {
int ret = UpdateCodecFrameSize(input_image);
if (ret < 0)
@@ -1008,6 +1010,13 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
codec_.simulcastStream[stream_idx].height;
encoded_images_[encoder_idx]._encodedWidth =
codec_.simulcastStream[stream_idx].width;
+ encoded_images_[encoder_idx].adapt_reason_.quality_available =
stefan-webrtc 2015/09/23 15:08:07 quality_scaling_available?
åsapersson 2015/09/24 08:16:17 In other cl, adapt_reason.bw_available, keep to be
stefan-webrtc 2015/09/28 13:44:29 I guess it works since itäs part of adapt_reason_
+ quality_scaler_enabled_;
+ if (quality_scaler_enabled_) {
+ encoded_images_[encoder_idx]
+ .adapt_reason_.quality_resolution_downscales =
+ quality_scaler_.downscale_shift();
+ }
encoded_complete_callback_->Encoded(encoded_images_[encoder_idx],
&codec_specific, &frag_info);
} else if (codec_.mode == kScreensharing) {

Powered by Google App Engine
This is Rietveld 408576698