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

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

Issue 897483002: Refactored pixel format resize operations in media/video/capture into a function called VideoCaptu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed function to a public member. Added tests. Created 5 years, 11 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
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 f35ea57504c98675fb2c2f7eb21b1871d1a57f82..3416cb73704b7d69f02cfed7ee9e25ea56989c11 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -427,29 +427,43 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData(
break;
case media::PIXEL_FORMAT_I420:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
mcasas 2015/02/03 20:48:46 Instead of reimplementing ImageAllocationSize() fo
+ (size_t) frame_format.frame_size.GetArea() * 3 / 2);
origin_colorspace = libyuv::FOURCC_I420;
break;
case media::PIXEL_FORMAT_YV12:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 3 / 2);
origin_colorspace = libyuv::FOURCC_YV12;
break;
case media::PIXEL_FORMAT_NV12:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 3 / 2);
origin_colorspace = libyuv::FOURCC_NV12;
break;
case media::PIXEL_FORMAT_NV21:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 3 / 2);
origin_colorspace = libyuv::FOURCC_NV21;
break;
case media::PIXEL_FORMAT_YUY2:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 2);
origin_colorspace = libyuv::FOURCC_YUY2;
break;
case media::PIXEL_FORMAT_UYVY:
DCHECK(!chopped_width && !chopped_height);
+ DCHECK_EQ(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 2);
origin_colorspace = libyuv::FOURCC_UYVY;
break;
case media::PIXEL_FORMAT_RGB24:
+ DCHECK_GE(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 3);
origin_colorspace = libyuv::FOURCC_24BG;
#if defined(OS_WIN)
// TODO(wjia): Currently, for RGB24 on WIN, capture device always
@@ -463,6 +477,8 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData(
origin_colorspace = libyuv::FOURCC_ARGB;
break;
case media::PIXEL_FORMAT_MJPEG:
+ DCHECK_LE(frame_format.ImageAllocationSize(),
+ (size_t) frame_format.frame_size.GetArea() * 3);
origin_colorspace = libyuv::FOURCC_MJPG;
break;
default:
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device.cc » ('j') | media/video/capture/file_video_capture_device.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698