Commit f4670dab authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2svda: initialize plane count and format variables together

The format and plane count variables are closely related, yet they were
initialized in different parts of the code. Make sure they are
initialized together to make the code more readable.

BUG=None
TEST=Video playback working on Kevin with VD disabled.

Change-Id: I07e8e7e7e833ab818f9ac7d8e8a750805a923a19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1982505
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728474}
parent 2c728abc
......@@ -493,10 +493,13 @@ bool V4L2SliceVideoDecodeAccelerator::SetupFormats() {
memset(&fmtdesc, 0, sizeof(fmtdesc));
fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
output_format_fourcc_ = base::nullopt;
output_planes_count_ = 0;
while (device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
auto fourcc = Fourcc::FromV4L2PixFmt(fmtdesc.pixelformat);
if (fourcc && device_->CanCreateEGLImageFrom(*fourcc)) {
output_format_fourcc_ = fourcc;
output_planes_count_ = V4L2Device::GetNumPlanesOfV4L2PixFmt(
output_format_fourcc_->ToV4L2PixFmt());
break;
}
++fmtdesc.index;
......@@ -520,6 +523,9 @@ bool V4L2SliceVideoDecodeAccelerator::SetupFormats() {
VLOGF(1) << "Can't find a usable input format from image processor";
return false;
}
output_planes_count_ = V4L2Device::GetNumPlanesOfV4L2PixFmt(
output_format_fourcc_->ToV4L2PixFmt());
gl_image_format_fourcc_ = v4l2_vda_helpers::FindImageProcessorOutputFormat(
image_processor_device_.get());
if (!gl_image_format_fourcc_) {
......@@ -528,14 +534,10 @@ bool V4L2SliceVideoDecodeAccelerator::SetupFormats() {
}
gl_image_planes_count_ = V4L2Device::GetNumPlanesOfV4L2PixFmt(
gl_image_format_fourcc_->ToV4L2PixFmt());
output_planes_count_ = V4L2Device::GetNumPlanesOfV4L2PixFmt(
output_format_fourcc_->ToV4L2PixFmt());
gl_image_device_ = image_processor_device_;
} else {
gl_image_format_fourcc_ = output_format_fourcc_;
output_planes_count_ = gl_image_planes_count_ =
V4L2Device::GetNumPlanesOfV4L2PixFmt(
output_format_fourcc_->ToV4L2PixFmt());
gl_image_planes_count_ = output_planes_count_;
gl_image_device_ = device_;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment