From e4da759b9a3c52babece10938689c649c3f16835 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 28 Sep 2020 20:02:00 +0800 Subject: [PATCH 08/18] 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 e4e05249b..c2b3ce87f 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 abbf2e574..c623f5380 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)); @@ -329,6 +335,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( gl::GLImageNativePixmap::Create(size, buffer_format, std::move(pixmap)); DCHECK(image); return image; +#endif } EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, -- 2.20.1