| Index: webrtc/test/frame_utils.cc
|
| diff --git a/webrtc/test/frame_utils.cc b/webrtc/test/frame_utils.cc
|
| index 0fad3adec85d017890c45e9560ccff02f9431ca8..b332b8fb918d8ff041e7090fae6b705631994d08 100644
|
| --- a/webrtc/test/frame_utils.cc
|
| +++ b/webrtc/test/frame_utils.cc
|
| @@ -72,5 +72,22 @@ bool FrameBufsEqual(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& f1,
|
| half_width, half_height);
|
| }
|
|
|
| +rtc::scoped_refptr<I420Buffer> ReadI420Buffer(int width, int height, FILE *f) {
|
| + int half_width = (width + 1) / 2;
|
| + rtc::scoped_refptr<I420Buffer> buffer(
|
| + // Explicit stride, no padding between rows.
|
| + I420Buffer::Create(width, height, width, half_width, half_width));
|
| + size_t size_y = static_cast<size_t>(width) * height;
|
| + size_t size_uv = static_cast<size_t>(half_width) * ((height + 1) / 2);
|
| +
|
| + if (fread(buffer->MutableDataY(), 1, size_y, f) < size_y)
|
| + return nullptr;
|
| + if (fread(buffer->MutableDataU(), 1, size_uv, f) < size_uv)
|
| + return nullptr;
|
| + if (fread(buffer->MutableDataV(), 1, size_uv, f) < size_uv)
|
| + return nullptr;
|
| + return buffer;
|
| +}
|
| +
|
| } // namespace test
|
| } // namespace webrtc
|
|
|