Use I420Buffer rather than VideoFrameBuffer when writing pixels.

Prepares for deleting VideoFrameBuffer::MutableDataY{,U,V}. objc
changes extracted from cl https://codereview.webrtc.org/2278883002/.

BUG=webrtc:5921

Review-Url: https://codereview.webrtc.org/2346453002
Cr-Commit-Position: refs/heads/master@{#14236}
This commit is contained in:
nisse 2016-09-15 07:20:40 -07:00 committed by Commit bot
parent 8faf9e047e
commit edebf45712

View File

@ -740,17 +740,20 @@ void AVFoundationVideoCapturer::CaptureSampleBuffer(
} else {
// Applying rotation is only supported for legacy reasons and performance
// is not critical here.
buffer = (rotation == webrtc::kVideoRotation_180)
? I420Buffer::Create(adapted_width, adapted_height)
: I420Buffer::Create(adapted_height, adapted_width);
libyuv::I420Rotate(scaled_buffer->DataY(), scaled_buffer->StrideY(),
scaled_buffer->DataU(), scaled_buffer->StrideU(),
scaled_buffer->DataV(), scaled_buffer->StrideV(),
buffer->MutableDataY(), buffer->StrideY(),
buffer->MutableDataU(), buffer->StrideU(),
buffer->MutableDataV(), buffer->StrideV(),
crop_width, crop_height,
static_cast<libyuv::RotationMode>(rotation));
rtc::scoped_refptr<webrtc::I420Buffer> rotated_buffer(
(rotation == webrtc::kVideoRotation_180)
? I420Buffer::Create(adapted_width, adapted_height)
: I420Buffer::Create(adapted_height, adapted_width));
libyuv::I420Rotate(
scaled_buffer->DataY(), scaled_buffer->StrideY(),
scaled_buffer->DataU(), scaled_buffer->StrideU(),
scaled_buffer->DataV(), scaled_buffer->StrideV(),
rotated_buffer->MutableDataY(), rotated_buffer->StrideY(),
rotated_buffer->MutableDataU(), rotated_buffer->StrideU(),
rotated_buffer->MutableDataV(), rotated_buffer->StrideV(),
crop_width, crop_height,
static_cast<libyuv::RotationMode>(rotation));
buffer = rotated_buffer;
}
}