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

Unified Diff: webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: Stats now properly reflect scaling status Created 4 years, 2 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/h264/h264_encoder_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index 3dfa0b559d1228725ae8820bbb0f2aecd551b410..1b24d4f8716e609fc55d248d42fb54bc144dab42 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -213,9 +213,6 @@ int32_t H264EncoderImpl::InitEncode(const VideoCodec* codec_settings,
return WEBRTC_VIDEO_CODEC_ERROR;
}
// TODO(pbos): Base init params on these values before submitting.
- quality_scaler_.Init(codec_settings_.codecType, codec_settings_.startBitrate,
- codec_settings_.width, codec_settings_.height,
- codec_settings_.maxFramerate);
int video_format = EVideoFormatType::videoFormatI420;
openh264_encoder_->SetOption(ENCODER_OPTION_DATAFORMAT,
&video_format);
@@ -255,7 +252,6 @@ int32_t H264EncoderImpl::SetRates(uint32_t bitrate, uint32_t framerate) {
}
codec_settings_.targetBitrate = bitrate;
codec_settings_.maxFramerate = framerate;
- quality_scaler_.ReportFramerate(framerate);
SBitrateInfo target_bitrate;
memset(&target_bitrate, 0, sizeof(SBitrateInfo));
@@ -287,21 +283,6 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame,
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
- quality_scaler_.OnEncodeFrame(input_frame.width(), input_frame.height());
magjed_webrtc 2016/10/26 14:28:36 I would like to document the condition that the in
kthelgason 2016/10/26 19:02:49 I agree, good call. Done.
- rtc::scoped_refptr<const VideoFrameBuffer> frame_buffer =
- quality_scaler_.GetScaledBuffer(input_frame.video_frame_buffer());
- if (frame_buffer->width() != codec_settings_.width ||
- frame_buffer->height() != codec_settings_.height) {
- LOG(LS_INFO) << "Encoder reinitialized from " << codec_settings_.width
- << "x" << codec_settings_.height << " to "
- << frame_buffer->width() << "x" << frame_buffer->height();
- codec_settings_.width = frame_buffer->width();
- codec_settings_.height = frame_buffer->height();
- SEncParamExt encoder_params = CreateEncoderParams();
- openh264_encoder_->SetOption(ENCODER_OPTION_SVC_ENCODE_PARAM_EXT,
- &encoder_params);
- }
-
bool force_key_frame = false;
if (frame_types != nullptr) {
// We only support a single stream.
@@ -372,11 +353,7 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame,
// Parse and report QP.
h264_bitstream_parser_.ParseBitstream(encoded_image_._buffer,
encoded_image_._length);
- int qp = -1;
- if (h264_bitstream_parser_.GetLastSliceQp(&qp))
- quality_scaler_.ReportQP(qp);
- } else {
- quality_scaler_.ReportDroppedFrame();
+ h264_bitstream_parser_.GetLastSliceQp(&encoded_image_.qp_)
}
return WEBRTC_VIDEO_CODEC_OK;
}
@@ -471,8 +448,8 @@ int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) {
return WEBRTC_VIDEO_CODEC_OK;
}
-void H264EncoderImpl::OnDroppedFrame() {
- quality_scaler_.ReportDroppedFrame();
+QualityScaler::Settings H264EncoderImpl::GetQPThresholds() const {
+ return QualityScaler::Settings(true);
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698