Index: remoting/codec/video_encoder_vpx.cc |
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc |
index ea84859034ec0a332af145387a44f25d36e442eb..858d7f41a04b84eb373ecd0f00e2a79bdcda3a3d 100644 |
--- a/remoting/codec/video_encoder_vpx.cc |
+++ b/remoting/codec/video_encoder_vpx.cc |
@@ -186,7 +186,7 @@ void CreateImage(bool use_i444, |
image->fmt = VPX_IMG_FMT_I444; |
image->x_chroma_shift = 0; |
image->y_chroma_shift = 0; |
- } else { // I420 |
+ } else { // I420 |
image->fmt = VPX_IMG_FMT_YV12; |
image->x_chroma_shift = 1; |
image->y_chroma_shift = 1; |
@@ -228,7 +228,7 @@ void CreateImage(bool use_i444, |
*out_image_buffer = std::move(image_buffer); |
} |
-} // namespace |
+} // namespace |
// static |
scoped_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP8() { |
@@ -260,7 +260,7 @@ void VideoEncoderVpx::SetLosslessColor(bool want_lossless) { |
lossless_color_ = want_lossless; |
// TODO(wez): Switch to ConfigureCodec() path once libvpx supports it. |
// See https://code.google.com/p/webm/issues/detail?id=913. |
- //if (codec_) |
+ // if (codec_) |
// Configure(webrtc::DesktopSize(codec_->config.enc->g_w, |
// codec_->config.enc->g_h)); |
codec_.reset(); |
@@ -268,7 +268,8 @@ void VideoEncoderVpx::SetLosslessColor(bool want_lossless) { |
} |
scoped_ptr<VideoPacket> VideoEncoderVpx::Encode( |
- const webrtc::DesktopFrame& frame) { |
+ const webrtc::DesktopFrame& frame, |
+ uint32_t flags) { |
DCHECK_LE(32, frame.size().width()); |
DCHECK_LE(32, frame.size().height()); |
@@ -299,6 +300,9 @@ scoped_ptr<VideoPacket> VideoEncoderVpx::Encode( |
LOG(ERROR) << "Unable to apply active map"; |
} |
+ if (flags & kRequestKeyFrame) |
+ vpx_codec_control(codec_.get(), VP8E_SET_FRAME_FLAGS, VPX_EFLAG_FORCE_KF); |
+ |
// Do the actual encoding. |
int timestamp = (clock_->NowTicks() - timestamp_base_).InMilliseconds(); |
vpx_codec_err_t ret = vpx_codec_encode( |
@@ -339,6 +343,7 @@ scoped_ptr<VideoPacket> VideoEncoderVpx::Encode( |
case VPX_CODEC_CX_FRAME_PKT: |
got_data = true; |
packet->set_data(vpx_packet->data.frame.buf, vpx_packet->data.frame.sz); |
+ packet->set_key_frame(vpx_packet->data.frame.flags & VPX_FRAME_IS_KEY); |
break; |
default: |
break; |