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..940e2ff3488f40e3b8c5d6b321d61b581cb8690d 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( |
+ new rtc::RefCountedObject<I420Buffer>(target_width_, target_height_)); |
pbos-webrtc
2016/05/31 14:14:02
This doesn't reuse buffers anymore. Might apply to
nisse-webrtc
2016/06/01 09:15:18
Good catch. Added a pool.
|
- 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() { |