Index: webrtc/api/androidvideocapturer.cc |
diff --git a/webrtc/api/androidvideocapturer.cc b/webrtc/api/androidvideocapturer.cc |
index ee5ef665d97c37247929f170def89192679220d7..70a0a960ca82665d60a1735ff208d6e53b6bdeb1 100644 |
--- a/webrtc/api/androidvideocapturer.cc |
+++ b/webrtc/api/androidvideocapturer.cc |
@@ -64,6 +64,42 @@ class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { |
return &captured_frame_; |
} |
+ std::unique_ptr<cricket::VideoFrame> CreateCroppedAndScaledFrame( |
+ const cricket::CapturedFrame* input_frame, |
+ int crop_x, |
+ int crop_y, |
+ int crop_width, |
+ int crop_height, |
+ int dst_width, |
+ int dst_height) const override { |
+ // Check that input_frame is actually our frame. |
+ RTC_CHECK(input_frame == &captured_frame_); |
+ // TODO(nisse): Must handle texture frames too. |
perkj_webrtc
2016/05/16 06:48:46
I think you have to do this now. CreateAliasedFram
|
+ RTC_CHECK(buffer_->native_handle() == nullptr); |
+ |
+ rtc::scoped_refptr<VideoFrameBuffer> scaled_buffer; |
+ if (dst_width == crop_width && dst_height == crop_height) { |
+ if (dst_width == buffer_->width() && dst_height == buffer_->height()) { |
+ scaled_buffer = buffer_; |
+ } else { |
+ scaled_buffer = WrappedI420Buffer::ShallowCrop( |
+ buffer_, crop_x, crop_y, dst_width, dst_height); |
+ } |
+ } |
+ else { |
+ scaled_buffer = I420Buffer::CropAndScale( |
+ buffer_, crop_x, crop_y, crop_width, crop_height, |
+ dst_width, dst_height); |
+ } |
+ std::unique_ptr<cricket::VideoFrame> frame( |
+ new cricket::WebRtcVideoFrame(scaled_buffer, |
+ input_frame->time_stamp, |
+ input_frame->rotation)); |
+ return apply_rotation_ ? std::unique_ptr<cricket::VideoFrame>( |
+ frame->GetCopyWithRotationApplied()->Copy()) |
perkj_webrtc
2016/05/16 06:48:46
nit: Should there be a TODO here to fix GetCopyWit
|
+ : std::move(frame); |
+ } |
+ |
cricket::VideoFrame* CreateAliasedFrame( |
const cricket::CapturedFrame* captured_frame, |
int dst_width, |