Commit 5d5aae53 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

RELAND: media/gpu/BUILD.gn: restrict image_processor, video_frame_mapper to CrOs, Chromecast

Original CL got reverted due to breaking ChromiumOS ASAN and
Linux ChromiumOS MSan builders:

[48790/51498] LINK ./content_shell
FAILED: content_shell
../../third_party/llvm-build/Release+Asserts/bin/clang++ -Wl,--fatal-warnings -fPIC -Wl,-z,noexecsta...(too long)
ld.lld: error: undefined symbol: media::ChromeosVideoDecoderFactory::GetSupportedConfigs()
>>> referenced by gpu_mojo_media_client.cc:162 (../../media/mojo/services/gpu_mojo_media_client.cc:162)
>>>               services/gpu_mojo_media_client.o:(media::GpuMojoMediaClient::GetSupportedVideoDecoderConfigs()) in archive obj/media/mojo/services/libmedia_mojo_services.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Cq-Include-Trybots:luci-chromium-try:linux_chromium_chromeos_asan_rel_ng;luci-chromium-try:linux_chromium_chromeos_msan_rel_ng


Original CL description ----------------------------------------------

This CL restricts //media/gpu:image_processor and :video_frame_mapper
to ChromeOS and ChromeCast, since they are only implemented for these
platforms.  Same for image_processor_test.

video_frame_file_writer.cc sandwiched some uses of |video_frame_mapper_|
in an OS_LINUX and left others unprotected, which confused OS_WIN
builds. This CL changes those to if defined(OS_CHROMEOS), since I
don't think this file is meant to be compiled nor run on OS_LINUX.

Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787467
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#698566}
Bug: 1006266
Change-Id: I6c9982015829863694e9f48815105f371548f9a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816799Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698655}
parent d2efb8a3
...@@ -65,8 +65,6 @@ component("gpu") { ...@@ -65,8 +65,6 @@ component("gpu") {
":buildflags", ":buildflags",
":command_buffer_helper", ":command_buffer_helper",
":common", ":common",
":image_processor",
":video_frame_mapper",
"//base", "//base",
"//gpu", "//gpu",
"//media", "//media",
...@@ -83,12 +81,14 @@ component("gpu") { ...@@ -83,12 +81,14 @@ component("gpu") {
libs = [] libs = []
ldflags = [] ldflags = []
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) { if (use_v4l2_codec || use_vaapi) {
public_deps += [ "//media/gpu/linux:common" ] public_deps += [
} ":image_processor",
":video_frame_mapper",
if (is_chromeos) { "//media/gpu/chromeos",
public_deps += [ "//media/gpu/chromeos" ] "//media/gpu/linux:common",
]
} }
if (is_mac) { if (is_mac) {
...@@ -260,6 +260,8 @@ source_set("common") { ...@@ -260,6 +260,8 @@ source_set("common") {
"vp9_reference_frame_vector.cc", "vp9_reference_frame_vector.cc",
"vp9_reference_frame_vector.h", "vp9_reference_frame_vector.h",
] ]
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) { if (use_v4l2_codec || use_vaapi) {
sources += [ sources += [
"decode_surface_handler.h", "decode_surface_handler.h",
...@@ -303,79 +305,82 @@ source_set("command_buffer_helper") { ...@@ -303,79 +305,82 @@ source_set("command_buffer_helper") {
] ]
} }
source_set("image_processor") { # TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
defines = [ "MEDIA_GPU_IMPLEMENTATION" ] if (use_v4l2_codec || use_vaapi) {
sources = [ source_set("image_processor") {
"image_processor_factory.cc", defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
"libyuv_image_processor.cc", sources = [
"libyuv_image_processor.h", "image_processor_factory.cc",
] "libyuv_image_processor.cc",
"libyuv_image_processor.h",
]
public_deps = [ public_deps = [
":image_processor_common", ":image_processor_common",
] ]
deps = [ deps = [
":video_frame_mapper", ":video_frame_mapper",
"//third_party/libyuv", "//third_party/libyuv",
"//ui/gl", "//ui/gl",
] ]
if (use_v4l2_codec) { if (use_v4l2_codec) {
deps += [ "//media/gpu/v4l2" ] deps += [ "//media/gpu/v4l2" ]
}
} }
}
source_set("image_processor_common") { source_set("image_processor_common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ] defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [ sources = [
"image_processor.cc", "image_processor.cc",
"image_processor.h", "image_processor.h",
"image_processor_factory.h", "image_processor_factory.h",
] ]
public_deps = [ public_deps = [
":buildflags", ":buildflags",
":common", ":common",
"//base", "//base",
"//media", "//media",
"//ui/gfx/geometry", "//ui/gfx/geometry",
] ]
} }
source_set("video_frame_mapper") { source_set("video_frame_mapper") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ] defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [ sources = [
"video_frame_mapper_factory.cc", "video_frame_mapper_factory.cc",
] ]
public_deps = [ public_deps = [
":video_frame_mapper_common", ":video_frame_mapper_common",
] ]
deps = [] deps = []
# generic_dmabuf_video_frame_mapper # generic_dmabuf_video_frame_mapper
if (use_v4l2_codec || use_vaapi) { if (use_v4l2_codec || use_vaapi) {
deps += [ "//media/gpu/linux:video_frame_mapper" ] deps += [ "//media/gpu/linux:video_frame_mapper" ]
} }
# vaapi_dmabuf_video_frame_mapper # vaapi_dmabuf_video_frame_mapper
if (use_vaapi) { if (use_vaapi) {
deps += [ "//media/gpu/vaapi" ] deps += [ "//media/gpu/vaapi" ]
}
} }
}
source_set("video_frame_mapper_common") { source_set("video_frame_mapper_common") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ] defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
sources = [ sources = [
"video_frame_mapper.h", "video_frame_mapper.h",
"video_frame_mapper_factory.h", "video_frame_mapper_factory.h",
] ]
public_deps = [ public_deps = [
":buildflags", ":buildflags",
"//base", "//base",
"//media", "//media",
] ]
}
} }
# TODO(watk): Run this on bots. http://crbug.com/461437 # TODO(watk): Run this on bots. http://crbug.com/461437
...@@ -567,6 +572,8 @@ source_set("unit_tests") { ...@@ -567,6 +572,8 @@ source_set("unit_tests") {
if (use_v4l2_codec) { if (use_v4l2_codec) {
deps += [ "//media/gpu/v4l2:unit_test" ] deps += [ "//media/gpu/v4l2:unit_test" ]
} }
# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
if (use_v4l2_codec || use_vaapi) { if (use_v4l2_codec || use_vaapi) {
sources += [ "vp8_decoder_unittest.cc" ] sources += [ "vp8_decoder_unittest.cc" ]
} }
...@@ -584,57 +591,60 @@ source_set("unit_tests") { ...@@ -584,57 +591,60 @@ source_set("unit_tests") {
} }
} }
test("video_decode_accelerator_tests") { # TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
sources = [ if (use_v4l2_codec || use_vaapi) {
"video_decode_accelerator_tests.cc", test("video_decode_accelerator_tests") {
] sources = [
data = [ "video_decode_accelerator_tests.cc",
"//media/test/data/", ]
] data = [
deps = [ "//media/test/data/",
":buildflags", ]
"test:frame_file_writer", deps = [
"test:frame_validator", ":buildflags",
"test:helpers", "test:frame_file_writer",
"test:video_player", "test:frame_validator",
"test:video_player_test_environment", "test:helpers",
"test:video_player_thumbnail_renderer", "test:video_player",
"//media:test_support", "test:video_player_test_environment",
"//testing/gtest", "test:video_player_thumbnail_renderer",
] "//media:test_support",
} "//testing/gtest",
]
}
test("video_decode_accelerator_perf_tests") { test("video_decode_accelerator_perf_tests") {
sources = [ sources = [
"video_decode_accelerator_perf_tests.cc", "video_decode_accelerator_perf_tests.cc",
] ]
data = [ data = [
"//media/test/data/", "//media/test/data/",
] ]
deps = [ deps = [
":buildflags", ":buildflags",
"test:video_player", "test:video_player",
"test:video_player_test_environment", "test:video_player_test_environment",
"//media:test_support", "//media:test_support",
"//testing/gtest", "//testing/gtest",
] ]
} }
test("image_processor_test") { test("image_processor_test") {
sources = [ sources = [
"image_processor_test.cc", "image_processor_test.cc",
] ]
deps = [ deps = [
":buildflags", ":buildflags",
":gpu", ":gpu",
"test:frame_file_writer", "test:frame_file_writer",
"test:frame_validator", "test:frame_validator",
"test:helpers", "test:helpers",
"test:image_processor", "test:image_processor",
"test:render_helpers", "test:render_helpers",
"//base/test:test_support", "//base/test:test_support",
"//media:test_support", "//media:test_support",
"//mojo/core/embedder", "//mojo/core/embedder",
"//testing/gtest", "//testing/gtest",
] ]
}
} }
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
import("//media/gpu/args.gni") import("//media/gpu/args.gni")
assert(is_chromeos) # TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
assert(use_v4l2_codec || use_vaapi)
source_set("chromeos") { source_set("chromeos") {
defines = [ "MEDIA_GPU_IMPLEMENTATION" ] defines = [ "MEDIA_GPU_IMPLEMENTATION" ]
......
...@@ -109,6 +109,7 @@ void VideoFrameFileWriter::ProcessVideoFrameTask( ...@@ -109,6 +109,7 @@ void VideoFrameFileWriter::ProcessVideoFrameTask(
base::SStringPrintf(&filename, FILE_PATH_LITERAL("frame_%04zu_%dx%d"), base::SStringPrintf(&filename, FILE_PATH_LITERAL("frame_%04zu_%dx%d"),
frame_index, visible_size.width(), visible_size.height()); frame_index, visible_size.width(), visible_size.height());
#if defined(OS_CHROMEOS)
// Create VideoFrameMapper if not yet created. The decoder's output pixel // Create VideoFrameMapper if not yet created. The decoder's output pixel
// format is not known yet when creating the VideoFrameWriter. We can only // format is not known yet when creating the VideoFrameWriter. We can only
// create the VideoFrameMapper upon receiving the first video frame. // create the VideoFrameMapper upon receiving the first video frame.
...@@ -117,6 +118,7 @@ void VideoFrameFileWriter::ProcessVideoFrameTask( ...@@ -117,6 +118,7 @@ void VideoFrameFileWriter::ProcessVideoFrameTask(
VideoFrameMapperFactory::CreateMapper(video_frame->format()); VideoFrameMapperFactory::CreateMapper(video_frame->format());
LOG_ASSERT(video_frame_mapper_) << "Failed to create VideoFrameMapper"; LOG_ASSERT(video_frame_mapper_) << "Failed to create VideoFrameMapper";
} }
#endif
switch (output_format_) { switch (output_format_) {
case OutputFormat::kPNG: case OutputFormat::kPNG:
...@@ -139,7 +141,7 @@ void VideoFrameFileWriter::WriteVideoFramePNG( ...@@ -139,7 +141,7 @@ void VideoFrameFileWriter::WriteVideoFramePNG(
DCHECK(video_frame_mapper_); DCHECK(video_frame_mapper_);
auto mapped_frame = video_frame; auto mapped_frame = video_frame;
#if defined(OS_LINUX) #if defined(OS_CHROMEOS)
if (video_frame->storage_type() == VideoFrame::STORAGE_DMABUFS) if (video_frame->storage_type() == VideoFrame::STORAGE_DMABUFS)
mapped_frame = video_frame_mapper_->Map(std::move(video_frame)); mapped_frame = video_frame_mapper_->Map(std::move(video_frame));
#endif #endif
...@@ -181,7 +183,7 @@ void VideoFrameFileWriter::WriteVideoFrameYUV( ...@@ -181,7 +183,7 @@ void VideoFrameFileWriter::WriteVideoFrameYUV(
DCHECK(video_frame_mapper_); DCHECK(video_frame_mapper_);
auto mapped_frame = video_frame; auto mapped_frame = video_frame;
#if defined(OS_LINUX) #if defined(OS_CHROMEOS)
if (video_frame->storage_type() == VideoFrame::STORAGE_DMABUFS) if (video_frame->storage_type() == VideoFrame::STORAGE_DMABUFS)
mapped_frame = video_frame_mapper_->Map(std::move(video_frame)); mapped_frame = video_frame_mapper_->Map(std::move(video_frame));
#endif #endif
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "media/gpu/windows/dxva_video_decode_accelerator_win.h" #include "media/gpu/windows/dxva_video_decode_accelerator_win.h"
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if BUILDFLAG(USE_VAAPI) #if BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_wrapper.h" #include "media/gpu/vaapi/vaapi_wrapper.h"
#endif // BUILDFLAG(USE_VAAPI) #endif // BUILDFLAG(USE_VAAPI)
......
...@@ -155,7 +155,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() { ...@@ -155,7 +155,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
supported_config_map[VideoDecoderImplementation::kAlternate] = supported_config_map[VideoDecoderImplementation::kAlternate] =
*d3d11_supported_configs_; *d3d11_supported_configs_;
#elif defined(OS_CHROMEOS) #elif defined(USE_CHROMEOS_MEDIA_ACCELERATION)
if (base::FeatureList::IsEnabled(kChromeosVideoDecoder)) { if (base::FeatureList::IsEnabled(kChromeosVideoDecoder)) {
if (!cros_supported_configs_) { if (!cros_supported_configs_) {
cros_supported_configs_ = cros_supported_configs_ =
...@@ -165,7 +165,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() { ...@@ -165,7 +165,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
*cros_supported_configs_; *cros_supported_configs_;
return supported_config_map; return supported_config_map;
} }
#endif // defined(OS_WIN) #endif
auto& default_configs = auto& default_configs =
supported_config_map[VideoDecoderImplementation::kDefault]; supported_config_map[VideoDecoderImplementation::kDefault];
......
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