Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: media/video/capture/fake_video_capture_device.cc

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: cff149b4 WIP Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/base/video_frame.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« media/base/video_frame.cc ('K') | « media/base/video_frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698