| Index: media/cast/sender/vp8_encoder.cc
|
| diff --git a/media/cast/sender/vp8_encoder.cc b/media/cast/sender/vp8_encoder.cc
|
| index f6bad07231248d2afff4dc29893dc4375ddaa0c4..39c8971e0de999faa9054b410193e8101206cbb0 100644
|
| --- a/media/cast/sender/vp8_encoder.cc
|
| +++ b/media/cast/sender/vp8_encoder.cc
|
| @@ -63,12 +63,12 @@ bool HasSufficientFeedback(
|
|
|
| } // namespace
|
|
|
| -Vp8Encoder::Vp8Encoder(const VideoSenderConfig& video_config)
|
| +Vp8Encoder::Vp8Encoder(const FrameSenderConfig& video_config)
|
| : cast_config_(video_config),
|
| target_encoder_utilization_(
|
| - video_config.number_of_encode_threads > 2
|
| + video_config.video_codec_params.number_of_encode_threads > 2
|
| ? kHiTargetEncoderUtilization
|
| - : (video_config.number_of_encode_threads > 1
|
| + : (video_config.video_codec_params.number_of_encode_threads > 1
|
| ? kMidTargetEncoderUtilization
|
| : kLoTargetEncoderUtilization)),
|
| key_frame_requested_(true),
|
| @@ -79,8 +79,10 @@ Vp8Encoder::Vp8Encoder(const VideoSenderConfig& video_config)
|
| base::TimeDelta::FromMicroseconds(kEncodingSpeedAccHalfLife)),
|
| encoding_speed_(kHighestEncodingSpeed) {
|
| config_.g_timebase.den = 0; // Not initialized.
|
| - DCHECK_LE(cast_config_.min_qp, cast_config_.max_cpu_saver_qp);
|
| - DCHECK_LE(cast_config_.max_cpu_saver_qp, cast_config_.max_qp);
|
| + DCHECK_LE(cast_config_.video_codec_params.min_qp,
|
| + cast_config_.video_codec_params.max_cpu_saver_qp);
|
| + DCHECK_LE(cast_config_.video_codec_params.max_cpu_saver_qp,
|
| + cast_config_.video_codec_params.max_qp);
|
|
|
| thread_checker_.DetachFromThread();
|
| }
|
| @@ -110,7 +112,7 @@ void Vp8Encoder::ConfigureForNewFrameSize(const gfx::Size& frame_size) {
|
| << frame_size.ToString();
|
| config_.g_w = frame_size.width();
|
| config_.g_h = frame_size.height();
|
| - config_.rc_min_quantizer = cast_config_.min_qp;
|
| + config_.rc_min_quantizer = cast_config_.video_codec_params.min_qp;
|
| if (vpx_codec_enc_config_set(&encoder_, &config_) == VPX_CODEC_OK)
|
| return;
|
| DVLOG(1) << "libvpx rejected the attempt to use a smaller frame size in "
|
| @@ -130,7 +132,7 @@ void Vp8Encoder::ConfigureForNewFrameSize(const gfx::Size& frame_size) {
|
| CHECK_EQ(vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &config_, 0),
|
| VPX_CODEC_OK);
|
|
|
| - config_.g_threads = cast_config_.number_of_encode_threads;
|
| + config_.g_threads = cast_config_.video_codec_params.number_of_encode_threads;
|
| config_.g_w = frame_size.width();
|
| config_.g_h = frame_size.height();
|
| // Set the timebase to match that of base::TimeDelta.
|
| @@ -147,8 +149,8 @@ void Vp8Encoder::ConfigureForNewFrameSize(const gfx::Size& frame_size) {
|
| config_.rc_resize_allowed = 0; // TODO(miu): Why not? Investigate this.
|
| config_.rc_end_usage = VPX_CBR;
|
| config_.rc_target_bitrate = bitrate_kbit_;
|
| - config_.rc_min_quantizer = cast_config_.min_qp;
|
| - config_.rc_max_quantizer = cast_config_.max_qp;
|
| + config_.rc_min_quantizer = cast_config_.video_codec_params.min_qp;
|
| + config_.rc_max_quantizer = cast_config_.video_codec_params.max_qp;
|
| // TODO(miu): Revisit these now that the encoder is being successfully
|
| // micro-managed.
|
| config_.rc_undershoot_pct = 100;
|
| @@ -351,7 +353,7 @@ void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame,
|
| double actual_encoding_speed =
|
| encoding_speed_ +
|
| kEquivalentEncodingSpeedStepPerQpStep *
|
| - std::max(0, quantizer - cast_config_.min_qp);
|
| + std::max(0, quantizer - cast_config_.video_codec_params.min_qp);
|
| double adjusted_encoding_speed = actual_encoding_speed *
|
| encoded_frame->encoder_utilization /
|
| target_encoder_utilization_;
|
| @@ -370,12 +372,13 @@ void Vp8Encoder::Encode(const scoped_refptr<media::VideoFrame>& video_frame,
|
| next_encoding_speed = kHighestEncodingSpeed;
|
| next_min_qp =
|
| static_cast<int>(remainder / kEquivalentEncodingSpeedStepPerQpStep +
|
| - cast_config_.min_qp + 0.5);
|
| - next_min_qp = std::min(next_min_qp, cast_config_.max_cpu_saver_qp);
|
| + cast_config_.video_codec_params.min_qp + 0.5);
|
| + next_min_qp = std::min(next_min_qp,
|
| + cast_config_.video_codec_params.max_cpu_saver_qp);
|
| } else {
|
| next_encoding_speed =
|
| std::max<double>(kLowestEncodingSpeed, next_encoding_speed) + 0.5;
|
| - next_min_qp = cast_config_.min_qp;
|
| + next_min_qp = cast_config_.video_codec_params.min_qp;
|
| }
|
| if (encoding_speed_ != static_cast<int>(next_encoding_speed)) {
|
| encoding_speed_ = static_cast<int>(next_encoding_speed);
|
|
|