| 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 5c0aa1bd4507206de1cf3277c3f282438d3dc623..f7f1ff21e089834f3ff2cf2901f6f2d799cd6abe 100644
|
| --- a/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
|
| +++ b/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc
|
| @@ -227,9 +227,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);
|
| @@ -269,7 +266,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));
|
| @@ -299,20 +295,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.
|
| @@ -330,7 +312,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));
|
| @@ -383,11 +366,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;
|
| }
|
| @@ -488,8 +467,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
|
|
|