| Index: webrtc/common_video/video_frame_buffer.cc
|
| diff --git a/webrtc/common_video/video_frame_buffer.cc b/webrtc/common_video/video_frame_buffer.cc
|
| index 492bc495876a6a21b080252686991c89a2f5840b..e3c114c99b7175e6184b33fb480fd0f61d481497 100644
|
| --- a/webrtc/common_video/video_frame_buffer.cc
|
| +++ b/webrtc/common_video/video_frame_buffer.cc
|
| @@ -18,6 +18,14 @@ static const int kBufferAlignment = 64;
|
|
|
| namespace webrtc {
|
|
|
| +namespace {
|
| +
|
| +int I420DataSize(int height, int stride_y, int stride_u, int stride_v) {
|
| + return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| uint8_t* VideoFrameBuffer::MutableData(PlaneType type) {
|
| RTC_NOTREACHED();
|
| return nullptr;
|
| @@ -40,7 +48,7 @@ I420Buffer::I420Buffer(int width,
|
| stride_u_(stride_u),
|
| stride_v_(stride_v),
|
| data_(static_cast<uint8_t*>(AlignedMalloc(
|
| - stride_y * height + (stride_u + stride_v) * ((height + 1) / 2),
|
| + I420DataSize(height, stride_y, stride_u, stride_v),
|
| kBufferAlignment))) {
|
| RTC_DCHECK_GT(width, 0);
|
| RTC_DCHECK_GT(height, 0);
|
| @@ -81,6 +89,10 @@ uint8_t* I420Buffer::MutableData(PlaneType type) {
|
| static_cast<const VideoFrameBuffer*>(this)->data(type));
|
| }
|
|
|
| +int I420Buffer::DataSize() const {
|
| + return I420DataSize(height_, stride_y_, stride_u_, stride_v_);
|
| +}
|
| +
|
| int I420Buffer::stride(PlaneType type) const {
|
| switch (type) {
|
| case kYPlane:
|
|
|