Update I420Buffer to new VideoFrameBuffer interface

This is a follow-up cleanup for CL https://codereview.webrtc.org/2847383002/.

BUG=webrtc:7632
TBR=stefan

Review-Url: https://codereview.webrtc.org/2906053002
Cr-Commit-Position: refs/heads/master@{#18388}
This commit is contained in:
magjed
2017-06-01 10:02:26 -07:00
committed by Commit Bot
parent c757293f15
commit 3f075498a3
20 changed files with 143 additions and 122 deletions

View File

@ -160,8 +160,7 @@ void AVFoundationVideoCapturer::CaptureSampleBuffer(
// Applying rotation is only supported for legacy reasons and performance is
// not critical here.
if (apply_rotation() && rotation != kVideoRotation_0) {
buffer = I420Buffer::Rotate(*buffer->NativeToI420Buffer(),
rotation);
buffer = I420Buffer::Rotate(*buffer->ToI420(), rotation);
if (rotation == kVideoRotation_90 || rotation == kVideoRotation_270) {
std::swap(captured_width, captured_height);
}

View File

@ -53,7 +53,8 @@ void ObjcVideoTrackSource::OnCapturedFrame(RTCVideoFrame* frame) {
// Adapted I420 frame.
// TODO(magjed): Optimize this I420 path.
rtc::scoped_refptr<I420Buffer> i420_buffer = I420Buffer::Create(adapted_width, adapted_height);
i420_buffer->CropAndScaleFrom(*frame.videoBuffer, crop_x, crop_y, crop_width, crop_height);
i420_buffer->CropAndScaleFrom(
*frame.videoBuffer->ToI420(), crop_x, crop_y, crop_width, crop_height);
buffer = i420_buffer;
}
@ -61,7 +62,7 @@ void ObjcVideoTrackSource::OnCapturedFrame(RTCVideoFrame* frame) {
// not critical here.
webrtc::VideoRotation rotation = static_cast<webrtc::VideoRotation>(frame.rotation);
if (apply_rotation() && rotation != kVideoRotation_0) {
buffer = I420Buffer::Rotate(*buffer->NativeToI420Buffer(), rotation);
buffer = I420Buffer::Rotate(*buffer->ToI420(), rotation);
rotation = kVideoRotation_0;
}