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 4223efb8a33515a92ad7c310858afe29bc01c53d..37845688821feca9251e027f9c9975dfb5c94198 100644 |
--- a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc |
+++ b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc |
@@ -241,9 +241,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); |
@@ -283,7 +280,6 @@ int32_t H264EncoderImpl::SetRates(uint32_t bitrate, uint32_t framerate) { |
} |
target_bps_ = bitrate * 1000; |
max_frame_rate_ = static_cast<float>(framerate); |
- quality_scaler_.ReportFramerate(framerate); |
SBitrateInfo target_bitrate; |
memset(&target_bitrate, 0, sizeof(SBitrateInfo)); |
@@ -313,20 +309,6 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, |
return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
} |
- quality_scaler_.OnEncodeFrame(input_frame.width(), input_frame.height()); |
- rtc::scoped_refptr<const VideoFrameBuffer> frame_buffer = |
- quality_scaler_.GetScaledBuffer(input_frame.video_frame_buffer()); |
- if (frame_buffer->width() != width_ || frame_buffer->height() != height_) { |
- LOG(LS_INFO) << "Encoder reinitialized from " << width_ << "x" << height_ |
- << " to " << frame_buffer->width() << "x" |
- << frame_buffer->height(); |
- width_ = frame_buffer->width(); |
- 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. |
@@ -344,7 +326,8 @@ int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, |
// (If every frame is a key frame we get lag/delays.) |
openh264_encoder_->ForceIntraFrame(true); |
} |
- |
+ rtc::scoped_refptr<const VideoFrameBuffer> frame_buffer = |
+ input_frame.video_frame_buffer(); |
// EncodeFrame input. |
SSourcePicture picture; |
memset(&picture, 0, sizeof(SSourcePicture)); |
@@ -398,11 +381,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; |
} |
@@ -534,8 +513,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 |