Reland 967793002 Linux Video Capture: Add V4L2VideoCaptureDelegate{Single,Multi}Plane
FileVCD did not specify a Capture Api Type in Linux platforms, hence the check failed down the road. Original description: ----------------------------------------- This CL adds support for V4L2 MPLANE Capture Api. Only supported format is YUV420M triplanar. A new method is added to VideoCaptureDeviceClient, namely OnIncomingCapturedYuvData(...), which forces adding MOCKing here and there, and its own implementation. V4L2 MMAP API works via user mmap()ing a number of buffer allocated by V4L2 capture device. If those buffers are not correctly munmap()ed, bad things (c) happen. In light of this, the manual buffer lifetime management is changed to automatic one. Construction (mmap()ing) of those called BufferTracker is planarity specific (i.e. there's one such ctor in each of BufferTracker{S,M}Plane), while the dtor is generic and the same. ToT class diagram: +------------------------------------+ | VideoCaptureDeviceLinux | | +----------------------+| | <<ref>> -->| V4L2CaptureDelegate || | cnt | (struct Buffer) || | +----------------------+| +------------------------------------+ This CL class scheme: +--------------------------+ | VideoCaptureDeviceLinux | | | | <<ref_cnt>> ---+ | +----------------|---------+ +----------------v-----------+ v4l2_capture_delegate.{cc,h} | +-----------------------+ | | |V4L2CaptureDelegate | | | | (class BufferTracker)| | | +-----------------------+ | +-------^------------------^-+ | | +----|-------+ +--------|--+ v4l2_capture_delegate_multi_plane.{cc,h} | SPlane | | MPlane | | (BTSplane) | | (BTMPlane)| | | +-----------+ +------------+ v4l2_capture_delegate_single_plane.{cc,h} - VCDevice works on the premise that its calls into VCDevice::Client::OnIncomingWhatever() are synchronous. That assumption is respected here. - A bit of cleanup is done in OnIncomingCaptureData(), in what regards rotation/crop/odd sizes. A unit test is subsequently added. - VideoCaptureDeviceFactory labels the devices as Single or Multi Planar. That labeling capture_api_type() needs to ripple through a bunch of files, causing some otherwise uninteresting changes in the patchsets. BUG=441836 TEST= Compile and insmod vivid.ko into a kernel, with options for supporting MPLANE api (multiplanar=2) then capture using patched Chromium. Current vivid does _not_ support any common Mplane format, needs a patch: https://github.com/miguelao/linux/tree/adding_yu12_yv12_nv12_nv21___mplane_formats___with_mods_for_kernel_3_13 that needs to be compiled against ubuntu sources 3.13 etc. For even better coverage, use a normal WebCam and navigate to http://goo.gl/fUcIiP, then open both the MPlane camera mentioned in the previous paragraph and the "normal" webcam (this is,partially, how I try it). TBR= posciak@chromium.org, perkj@chromium.org, magjed@chromium.org, dalecurtis@chromium.org Review URL: https://codereview.chromium.org/1026073002 Cr-Commit-Position: refs/heads/master@{#321856}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment