• wuchengli@chromium.org's avatar
    Fix DCHECKs in V4l2VideoDevice. · ea3bc300
    wuchengli@chromium.org authored
    - sizeimage DCHECK:
    The video device can adjust the buffer size to be bigger
    than we need as long as the data can fit. Theoretically
    sizeimage should be bigger than PlaneAllocationSize. But
    Exynos driver has a 256 byte padding for sizeimage. It is
    rounded up when calculating coded_size. So sizeimage can
    be smaller than PlaneAllocationSize. For example, say
    format.fmt.pix_mp.width and height are 1920x1088.
    format.fmt.pix_mp.plane_fmt[0].sizeimage is 2089216
    (1920*1088+256). |sizeimage| is rounded up and |coded_size|
    becomes 1920x1089. So format.fmt.pix_mp.plane_fmt[i].sizeimage
    (2089216) is less than PlaneAllocationSize (1920*1090=2092800).
    
    Also, we should not round down because the coded size is passed
    VideoEncodeAccelerator::Client::RequireBitstreamBuffers.
    The client will allocate buffers according to the coded size.
    
    - bytesperline DCHECK:
    bytesperline of different planes should be checked against
    media::VideoFrame::row_bytes, not the width of coded size.
    
    BUG=387701
    TEST=Run Hangout in debug builds.
    
    Review URL: https://codereview.chromium.org/406893002
    
    Cr-Commit-Position: refs/heads/master@{#291374}
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291374 0039d316-1c4b-4281-b951-d872f2087c98
    ea3bc300
video_frame.cc 26.6 KB