Bug 1030324: Remove VP8 encoder resize work around. r=rjesup
authorPaul Kerr [:pkerr] <pkerr@mozilla.com>
Tue, 08 Sep 2015 11:02:40 -0700
changeset 294438 4912093a0f338a19f219aa993745d9132e64f107
parent 294437 d72a38217499251b595b865214da0885ebffe2b6
child 294439 aa8cbb652d86253c379eb5628f72e44c5d6919e2
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrjesup
bugs1030324
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1030324: Remove VP8 encoder resize work around. r=rjesup The VP8 encoder was re-initialized completely when the frame size changed instead of calling the vpx_enc_config_set() method. The work around is not longer needed.
media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
--- a/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -350,19 +350,16 @@ int VP8EncoderImpl::Encode(const I420Vid
 
   // Check for change in frame size.
   if (frame.width() != codec_.width ||
       frame.height() != codec_.height) {
     int ret = UpdateCodecFrameSize(frame);
     if (ret < 0) {
       return ret;
     }
-#ifndef LIBVPX_ENCODER_CONFIG_ON_RESIZE //work around for bug 1030324
-    frame_type = kKeyFrame;
-#endif
   }
   // Image in vpx_image_t format.
   // Input frame is const. VP8's raw frame is not defined as const.
   raw_->planes[VPX_PLANE_Y] = const_cast<uint8_t*>(frame.buffer(kYPlane));
   raw_->planes[VPX_PLANE_U] = const_cast<uint8_t*>(frame.buffer(kUPlane));
   raw_->planes[VPX_PLANE_V] = const_cast<uint8_t*>(frame.buffer(kVPlane));
   // TODO(mikhal): Stride should be set in initialization.
   raw_->stride[VPX_PLANE_Y] = frame.stride(kYPlane);
@@ -420,35 +417,17 @@ int VP8EncoderImpl::UpdateCodecFrameSize
   raw_->stride[VPX_PLANE_U] = input_image.stride(kUPlane);
   raw_->stride[VPX_PLANE_V] = input_image.stride(kVPlane);
   vpx_img_set_rect(raw_, 0, 0, codec_.width, codec_.height);
 
   // Update encoder context for new frame size.
   // Change of frame size will automatically trigger a key frame.
   config_->g_w = codec_.width;
   config_->g_h = codec_.height;
-#ifndef LIBVPX_ENCODER_CONFIG_ON_RESIZE
-  //work around for bug 1030324
-  // doing only a configuration change causes
-  // horizontal streaking and distortion in the output.
-  vpx_codec_flags_t flags = VPX_CODEC_USE_OUTPUT_PARTITION;
-
-  // Re-initing will leak memory so we have to destroy the old context first.
-  if (vpx_codec_destroy(encoder_)) {
-    return WEBRTC_VIDEO_CODEC_MEMORY;
-  }
-
-  // For full paranoia satisfaction we also do a full reset of |encoder_|.
-  delete encoder_;
-  encoder_ = new vpx_codec_ctx_t;
-
-  if (vpx_codec_enc_init(encoder_, vpx_codec_vp8_cx(), config_, flags)) {
-#else
   if (vpx_codec_enc_config_set(encoder_, config_)) {
-#endif
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
 void VP8EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
                                        const vpx_codec_cx_pkt& pkt,
                                        uint32_t timestamp) {