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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 907113002: Reland:Refactored pixel format resize operations in media/video/capture into a function called Vide… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made the check WIN specific. Created 5 years, 10 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
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_controller.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index 8ff97bdf767d93c8821ef401ec33b229dfc31348..fa032c67ecdb0385f29c3dbb08f6430eb632a555 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -469,6 +469,17 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData(
NOTREACHED();
}
+ // The input |length| can be greater than the required buffer size because of
+ // paddings and/or alignments, but it cannot be less. However, on some
+ // platforms, such as Win with C920 webcams, |length| is set as 0, and we need
+ // to take that into account.
+#if defined(OS_WIN)
+ DCHECK(length == 0 ||
+ static_cast<size_t>(length) >= frame_format.ImageAllocationSize());
perkj_chrome 2015/02/10 08:01:00 please fix the problem at its source instead. ie,
+#else
+ DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize());
+#endif
+
if (libyuv::ConvertToI420(data,
length,
yplane,
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698