Index: webrtc/modules/video_processing/spatial_resampler.cc |
diff --git a/webrtc/modules/video_processing/spatial_resampler.cc b/webrtc/modules/video_processing/spatial_resampler.cc |
index cdbe0efac14cf285daeb20b1aa8edb2cfb3b7192..62c3d380e9bf085d3c64d0e068d38a8d1dbe4583 100644 |
--- a/webrtc/modules/video_processing/spatial_resampler.cc |
+++ b/webrtc/modules/video_processing/spatial_resampler.cc |
@@ -13,10 +13,7 @@ |
namespace webrtc { |
VPMSimpleSpatialResampler::VPMSimpleSpatialResampler() |
- : resampling_mode_(kFastRescaling), |
- target_width_(0), |
- target_height_(0), |
- scaler_() {} |
+ : resampling_mode_(kFastRescaling), target_width_(0), target_height_(0) {} |
VPMSimpleSpatialResampler::~VPMSimpleSpatialResampler() {} |
@@ -56,26 +53,17 @@ int32_t VPMSimpleSpatialResampler::ResampleFrame(const VideoFrame& inFrame, |
return VPM_OK; |
} |
- // Setting scaler |
- // TODO(mikhal/marpan): Should we allow for setting the filter mode in |
- // _scale.Set() with |resampling_mode_|? |
- int ret_val = 0; |
- ret_val = scaler_.Set(inFrame.width(), inFrame.height(), target_width_, |
- target_height_, kI420, kI420, kScaleBox); |
- if (ret_val < 0) |
- return ret_val; |
+ rtc::scoped_refptr<I420Buffer> scaled(buffer_pool_.CreateBuffer |
+ (target_width_, target_height_)); |
- ret_val = scaler_.Scale(inFrame, outFrame); |
+ I420Buffer::CenterCropAndScale(scaled, inFrame.video_frame_buffer()); |
+ outFrame->set_video_frame_buffer(scaled); |
// Setting time parameters to the output frame. |
- // Timestamp will be reset in Scale call above, so we should set it after. |
outFrame->set_timestamp(inFrame.timestamp()); |
outFrame->set_render_time_ms(inFrame.render_time_ms()); |
- if (ret_val == 0) |
- return VPM_OK; |
- else |
- return VPM_SCALE_ERROR; |
+ return VPM_OK; |
} |
int32_t VPMSimpleSpatialResampler::TargetHeight() { |