Index: media/video/capture/fake_video_capture_device.cc |
diff --git a/media/video/capture/fake_video_capture_device.cc b/media/video/capture/fake_video_capture_device.cc |
index a356e2b1247f6a0592783c5c6254be20a9148855..08a00a8fc7dda7f2cf00a73c44074a62ab5e9afb 100644 |
--- a/media/video/capture/fake_video_capture_device.cc |
+++ b/media/video/capture/fake_video_capture_device.cc |
@@ -92,8 +92,9 @@ void FakeVideoCaptureDevice::Allocate( |
} |
capture_format_.stride = capture_format_.width; |
- size_t fake_frame_size = |
- capture_format_.width * capture_format_.height * 3 / 2; |
+ const size_t fake_frame_size = VideoFrame::AllocationSize( |
+ VideoFrame::I420, |
+ gfx::Size(capture_format_.width, capture_format_.height)); |
fake_frame_.reset(new uint8[fake_frame_size]); |
state_ = kAllocated; |
@@ -108,8 +109,9 @@ void FakeVideoCaptureDevice::Reallocate() { |
DVLOG(3) << "Reallocating FakeVideoCaptureDevice, new capture resolution (" |
<< capture_format_.width << "x" << capture_format_.height << ")"; |
- size_t fake_frame_size = |
- capture_format_.width * capture_format_.height * 3 / 2; |
+ const size_t fake_frame_size = VideoFrame::AllocationSize( |
+ VideoFrame::I420, |
+ gfx::Size(capture_format_.width, capture_format_.height)); |
fake_frame_.reset(new uint8[fake_frame_size]); |
observer_->OnFrameInfoChanged(capture_format_); |
@@ -152,7 +154,9 @@ void FakeVideoCaptureDevice::OnCaptureTask() { |
return; |
} |
- int frame_size = capture_format_.width * capture_format_.height * 3 / 2; |
+ const size_t frame_size = VideoFrame::AllocationSize( |
+ VideoFrame::I420, |
+ gfx::Size(capture_format_.width, capture_format_.height)); |
memset(fake_frame_.get(), 0, frame_size); |
SkBitmap bitmap; |