New issue
Advanced search Search tips

Issue 914700 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

media/gpu/v4l2 Use VideoFrameLayout to allocate frame

Project Member Reported by deanliao@chromium.org, Dec 13

Issue description

Currently, v4l2 code use video frame format and size to allocate frame. However, it is not always correct. See the hack in V4L2Device::CodedSizeFromV4L2Format() https://cs.chromium.org/chromium/src/media/gpu/v4l2/v4l2_device.cc?type=cs&q=CodedSizeFromV4L2Format&sq=package:chromium&g=0&l=1169

Since we have VideoFrameLayout which has buffer_size property, we shall use it to allocate video frame.

After this is done, we can remove V4L2Device::CodedSizeFromV4L2Format().
 
Labels: -Pri-3 Pri-2
Currently, VEA (Video Encode Accelerator) gives Client::RequireBitstreamBuffers input video frame's coded_size to allocate input buffer [1]. However, after the CL: "media/gpu: Use VideoFrameLayout for format on input buffer" [2], input VideoFrameLayout's coded_size is assigned by negotiated v4l2_format's (pix_mp.width, pix_mp.height) (see [3] V4L2Device::V4L2FormatToVideoFrameLayout). The device driver's response may not inlcude per v4l2_plane's padding, which is given by pix_mp.plane_fmt[i].sizeimage. Because of this, using input's VideoFrameLayout's coded_size to RequireBitstreamBuffers() causes insufficient input buffer allocation bug [4]. 

Tentative solution of  crbug.com/918088  is to give RequireBitstreamBuffers the input size calculated by V4L2Device::CodedSizeFromV4L2Format(format). But the right solution is to make Client::RequireBitstreamBuffers [1] using input's VideoFrameLayout to allocate input buffer instead of just using gfx::Size.
 
[1] https://cs.chromium.org/chromium/src/media/video/video_encode_accelerator.h?sq=package:chromium&g=0&l=172
[2] https://crrev.com/c/1361743
[3] https://cs.chromium.org/chromium/src/media/gpu/v4l2/v4l2_device.cc?type=cs&q=V4L2FormatToVideoFrameLayout&sq=package:chromium&g=0&l=1249
[4]  https://crbug.com/918088 

Sign in to add a comment