From c62bfc00296146beab52e3c1a9f67d1341908698 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 28 Sep 2020 20:02:00 +0800 Subject: [PATCH 08/17] media: gpu: v4l2: Fix compile error when ozone not enabled Signed-off-by: Jeffy Chen --- media/gpu/v4l2/BUILD.gn | 5 ++++- media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn index 996be6e48..b2a0004ec 100644 --- a/media/gpu/v4l2/BUILD.gn +++ b/media/gpu/v4l2/BUILD.gn @@ -116,9 +116,12 @@ source_set("v4l2") { "//media/parsers", "//third_party/libyuv", "//ui/gfx/geometry", - "//ui/ozone", ] + if (use_ozone) { + deps += [ "//ui/ozone" ] + } + if (is_chromeos_ash) { sources += [ "v4l2_jpeg_encode_accelerator.cc", diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc index 6485fc4fe..f1f1dd6c9 100644 --- a/media/gpu/v4l2/generic_v4l2_device.cc +++ b/media/gpu/v4l2/generic_v4l2_device.cc @@ -33,8 +33,11 @@ #include "ui/gl/egl_util.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_image_native_pixmap.h" + +#if defined(USE_OZONE) #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/surface_factory_ozone.h" +#endif // Auto-generated for dlopen libv4l2 libraries #include "media/gpu/v4l2/v4l2_stubs.h" @@ -295,6 +298,9 @@ scoped_refptr GenericV4L2Device::CreateGLImage( const gfx::Size& size, const Fourcc fourcc, gfx::NativePixmapHandle handle) const { +#if !defined(USE_OZONE) + return nullptr; +#else DVLOGF(3); DCHECK(CanCreateEGLImageFrom(fourcc)); @@ -330,6 +336,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( bool ret = image->Initialize(std::move(pixmap)); DCHECK(ret); return image; +#endif } EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, -- 2.20.1