0

Remove Lacros leftovers from media/, part 1

Lacros is gone. Remove IS_CHROMEOS_LACROS and is_chromeos_lacros code
and replace IS_CHROMEOS_ASH and is_chromeos_ash with IS_CHROMEOS and
is_chromeos. Also remove then-obsolete imports of chromeos_buildflags.h
and chromeos/ui_mode.gni.

Bug: b:354842935
Change-Id: I0ad96a8b0f3ba8672cf846726fdf6fd8c59da873
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6217882
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1415344}
This commit is contained in:
Georg Neis
2025-02-03 18:53:55 -08:00
committed by Chromium LUCI CQ
parent a6aeeddc44
commit 1e05ab5d3b
100 changed files with 351 additions and 546 deletions
media
BUILD.gn
audio
base
capture
cdm
filters
gpu
media_options.gni
midi
mojo
video
webrtc

@ -348,7 +348,6 @@ component("shared_memory_support") {
}
deps = [
"//base",
"//build:chromeos_buildflags",
"//media:media_buildflags",
"//ui/gfx/geometry",
]

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/linux/pkg_config.gni")
import("//media/media_options.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
@ -143,7 +142,6 @@ source_set("audio") {
"//base",
"//build:android_buildflags",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//media/base",
"//third_party/flac",
"//third_party/opus:opus",
@ -394,7 +392,6 @@ static_library("test_support") {
deps = [
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
# Do not add any other //media deps except this; it will automatically pull
# a dep on //media which is required to ensure test_support targets all use
@ -439,7 +436,6 @@ source_set("unit_tests") {
deps = [
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//media:test_support",
"//testing/gmock",
"//testing/gtest",
@ -478,7 +474,7 @@ source_set("unit_tests") {
weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0
}
if (is_chromeos_ash || is_castos || is_cast_android) {
if (is_chromeos || is_castos || is_cast_android) {
sources += [
"flac_audio_handler_unittest.cc",
"test_data.h",

@ -23,7 +23,6 @@
#include "base/task/single_thread_task_runner.h"
#include "base/test/test_message_loop.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_device_info_accessor_for_tests.h"
#include "media/audio/audio_device_name.h"
@ -596,7 +595,7 @@ TEST_F(AudioManagerTest, CheckMinMaxAudioBufferSizeCallbacks) {
#if BUILDFLAG(IS_MAC)
CreateAudioManagerForTesting<AudioManagerMac>();
#elif BUILDFLAG(USE_CRAS) && BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(USE_CRAS) && BUILDFLAG(IS_CHROMEOS)
CreateAudioManagerForTesting<AudioManagerCras>();
#endif

@ -404,11 +404,7 @@ bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) {
}
enum CRAS_CLIENT_TYPE AudioManagerCras::GetClientType() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
return CRAS_CLIENT_TYPE_CHROME;
#else
return CRAS_CLIENT_TYPE_LACROS;
#endif
}
} // namespace media

@ -7,7 +7,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/audio/fake_audio_manager.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"

@ -16,7 +16,7 @@
#include "base/environment.h"
#include "base/logging.h"
#include "base/nix/xdg_util.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/pulse/pulse_input.h"
#include "media/audio/pulse/pulse_loopback_manager.h"
@ -196,7 +196,7 @@ std::string AudioManagerPulse::GetDefaultOutputDeviceID() {
std::string AudioManagerPulse::GetAssociatedOutputDeviceID(
const std::string& input_device_id) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return AudioManagerBase::GetAssociatedOutputDeviceID(input_device_id);
#else
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());

@ -396,7 +396,6 @@ source_set("base") {
deps = [
"//base",
"//base/allocator:buildflags",
"//build:chromeos_buildflags",
"//components/system_media_controls/linux/buildflags",
"//gpu/command_buffer/client:client",
"//gpu/command_buffer/client:interface_base",
@ -429,7 +428,7 @@ source_set("base") {
]
}
if (is_chromeos_ash) {
if (is_chromeos) {
deps += [ "//ash/constants" ]
}
@ -564,7 +563,6 @@ static_library("test_support") {
deps = [
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//testing/gmock",
"//third_party/libyuv",
"//ui/gfx:test_support",
@ -666,7 +664,6 @@ source_set("unit_tests") {
configs += [ "//media:media_config" ]
deps = [
"//base/test:test_support",
"//build:chromeos_buildflags",
"//components/viz/common",
"//gpu/command_buffer/common",
"//media:test_support",

@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/limits.h"
#include "media/media_buildflags.h"
@ -70,7 +69,7 @@ int LCM(int a, int b) {
// static
bool AudioLatency::IsResamplingPassthroughSupported(Type type) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return true;
#elif BUILDFLAG(IS_FUCHSIA)
return true;

@ -13,7 +13,6 @@
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "build/chromeos_buildflags.h"
#include "components/system_media_controls/linux/buildflags/buildflags.h"
#include "gpu/config/gpu_finch_features.h"
#include "media/media_buildflags.h"
@ -659,7 +658,7 @@ BASE_FEATURE(kMediaRemotingWithoutFullscreen,
BASE_FEATURE(kGlobalMediaControlsPictureInPicture,
"GlobalMediaControlsPictureInPicture",
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS)
BUILDFLAG(IS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
@ -762,9 +761,6 @@ BASE_FEATURE(kGlobalVaapiLock,
base::FEATURE_DISABLED_BY_DEFAULT);
#if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
// TODO(b/214589754): revisit the need for the BUILDFLAG(IS_CHROMEOS) guard (as
// opposed to BUILDFLAG(IS_CHROMEOS_ASH)) when the final design for HW
// encoding is implemented for lacros-chrome.
// Enable H264 temporal layer encoding with HW encoder on ChromeOS.
BASE_FEATURE(kVaapiH264TemporalLayerHWEncoding,
"VaapiH264TemporalLayerEncoding",
@ -987,7 +983,7 @@ const base::FeatureParam<bool>
// Enables handling of hardware media keys for controlling media.
BASE_FEATURE(kHardwareMediaKeyHandling,
"HardwareMediaKeyHandling",
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
BUILDFLAG(USE_MPRIS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
@ -1317,7 +1313,7 @@ BASE_FEATURE(kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled,
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Expose the out-of-process video decoding feature from ash-chrome to
// lacros-chrome through the crosapi.
BASE_FEATURE(kExposeOutOfProcessVideoDecodingToLacros,
@ -1328,7 +1324,7 @@ BASE_FEATURE(kExposeOutOfProcessVideoDecodingToLacros,
BASE_FEATURE(kBackgroundListening,
"BackgroundListening",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
// Spawn utility processes to perform hardware decode acceleration on behalf of
@ -1518,7 +1514,7 @@ const base::FeatureParam<int> kAudioDuckingAttenuation{&kAudioDucking,
// has audio focus enabled.
BASE_FEATURE(kAudioFocusDuckFlash,
"AudioFocusDuckFlash",
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
@ -1740,7 +1736,7 @@ bool IsVideoCaptureAcceleratedJpegDecodingEnabled() {
switches::kUseFakeMjpegDecodeAccelerator)) {
return true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return true;
#else
return false;

@ -12,7 +12,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_export.h"
#include "media/gpu/buildflags.h"
#include "media/media_buildflags.h"
@ -480,10 +479,10 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(
kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
MEDIA_EXPORT BASE_DECLARE_FEATURE(kExposeOutOfProcessVideoDecodingToLacros);
MEDIA_EXPORT BASE_DECLARE_FEATURE(kBackgroundListening);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
// Note: please use GetOutOfProcessVideoDecodingMode() to determine if OOP-VD is

@ -17,7 +17,6 @@
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/audio_decoder.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/audio_encoder.h"
@ -678,9 +677,9 @@ class MockCdmContext : public CdmContext {
MOCK_METHOD0(GetMediaFoundationCdmProxy,
scoped_refptr<MediaFoundationCdmProxy>());
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
MOCK_METHOD0(GetChromeOsCdmContext, chromeos::ChromeOsCdmContext*());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
std::optional<base::UnguessableToken> GetCdmId() const override;
void set_cdm_id(const base::UnguessableToken& cdm_id);

@ -10,7 +10,6 @@
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
@ -236,21 +235,11 @@ bool IsDecoderHevcProfileSupported(const VideoType& type) {
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
#if BUILDFLAG(PLATFORM_HAS_OPTIONAL_HEVC_DECODE_SUPPORT)
#if BUILDFLAG(IS_CHROMEOS_LACROS)
// TODO(b/171813538): For Lacros, the supplemental profile cache will be
// asking lacros-gpu, but we will be doing decoding in ash-gpu. Until the
// codec detection is plumbed through to ash-gpu we can do this extra check
// for HEVC support.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLacrosEnablePlatformHevc)) {
return true;
}
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (!base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport)) {
return false;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
return GetSupplementalDecoderVideoProfileCache()->IsProfileSupported(
type.profile);
#else

@ -5,7 +5,6 @@
#include "media/base/supported_types.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/mojo/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -187,8 +186,8 @@ TEST(SupportedTypesTest, IsDecoderSupportedVideoType_VP9Profiles) {
// VP9 Profile2 are supported on x86, ChromeOS on ARM and Mac/Win on ARM64.
// See third_party/libvpx/BUILD.gn.
#if defined(ARCH_CPU_X86_FAMILY) || \
(defined(ARCH_CPU_ARM_FAMILY) && BUILDFLAG(IS_CHROMEOS_ASH)) || \
#if defined(ARCH_CPU_X86_FAMILY) || \
(defined(ARCH_CPU_ARM_FAMILY) && BUILDFLAG(IS_CHROMEOS)) || \
(defined(ARCH_CPU_ARM64) && (BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)))
EXPECT_TRUE(IsDecoderSupportedVideoType(
{VideoCodec::kVP9, VP9PROFILE_PROFILE2, kUnspecifiedLevel, kColorSpace}));
@ -378,8 +377,8 @@ TEST(SupportedTypesTest, IsEncoderSupportedVideoType_VP9Profiles) {
// VP9 Profile2 are supported on x86, ChromeOS on ARM and Mac/Win on ARM64.
// See third_party/libvpx/BUILD.gn.
#if defined(ARCH_CPU_X86_FAMILY) || \
(defined(ARCH_CPU_ARM_FAMILY) && BUILDFLAG(IS_CHROMEOS_ASH)) || \
#if defined(ARCH_CPU_X86_FAMILY) || \
(defined(ARCH_CPU_ARM_FAMILY) && BUILDFLAG(IS_CHROMEOS)) || \
(defined(ARCH_CPU_ARM64) && (BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)))
EXPECT_TRUE(
IsEncoderSupportedVideoType({VideoCodec::kVP9, VP9PROFILE_PROFILE2}));

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/media_options.gni")
@ -102,7 +101,6 @@ source_set("capture_device_specific") {
deps = [
"//base",
"//base:i18n",
"//build:chromeos_buildflags",
"//gpu/command_buffer/client",
"//gpu/ipc/common:common",
"//media",
@ -156,7 +154,6 @@ component("capture_lib") {
deps = [
"//base",
"//base:i18n",
"//build:chromeos_buildflags",
"//media",
"//media/capture/mojom:image_capture",
"//media/capture/mojom:image_capture_types",
@ -274,7 +271,7 @@ component("capture_lib") {
]
}
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [
"video/chromeos/camera_3a_controller.cc",
"video/chromeos/camera_3a_controller.h",
@ -425,7 +422,6 @@ source_set("test_support") {
deps = [
":capture_lib",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//gpu/command_buffer/client",
"//gpu/command_buffer/common:common",
"//media:test_support",
@ -435,7 +431,7 @@ source_set("test_support") {
"//ui/gfx:test_support",
]
if (is_linux || is_chromeos_lacros) {
if (is_linux) {
sources += [
"video/linux/fake_device_provider.cc",
"video/linux/fake_device_provider.h",
@ -444,7 +440,7 @@ source_set("test_support") {
]
}
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [
"video/chromeos/mock_camera_module.cc",
"video/chromeos/mock_camera_module.h",
@ -489,7 +485,6 @@ test("capture_unittests") {
":capture",
":test_support",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//components/viz/test:test_support",
"//gpu:test_support",
"//gpu/command_buffer/client",
@ -510,7 +505,7 @@ test("capture_unittests") {
deps += [ "//components/viz/test:test_support" ]
}
if (is_linux || is_chromeos_lacros) {
if (is_linux) {
sources += [
"video/linux/v4l2_capture_delegate_unittest.cc",
"video/linux/video_capture_device_factory_v4l2_unittest.cc",
@ -590,11 +585,11 @@ test("capture_unittests") {
}
# TODO(crbug.com/40115082): use is_linux.
if (is_chromeos_ash) {
if (is_chromeos) {
deps += [ "//media/gpu/test:local_gpu_memory_buffer_manager" ]
}
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [
"video/chromeos/camera_3a_controller_unittest.cc",
"video/chromeos/camera_device_delegate_unittest.cc",

@ -8,14 +8,13 @@
#include "base/system/sys_info.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/file_video_capture_device_factory.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_LINUX)
#include "media/capture/video/linux/video_capture_device_factory_linux.h"
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
#include "media/capture/video/chromeos/public/cros_features.h"
#include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
#include "media/capture/video/linux/video_capture_device_factory_linux.h"
@ -56,9 +55,9 @@ CreateFakeVideoCaptureDeviceFactory() {
std::unique_ptr<VideoCaptureDeviceFactory>
CreatePlatformSpecificVideoCaptureDeviceFactory(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_LINUX)
return std::make_unique<VideoCaptureDeviceFactoryLinux>(ui_task_runner);
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
if (base::SysInfo::IsRunningOnChromeOS())
return std::make_unique<VideoCaptureDeviceFactoryChromeOS>(ui_task_runner);
return std::make_unique<VideoCaptureDeviceFactoryLinux>(ui_task_runner);

@ -8,7 +8,6 @@
#include <memory>
#include "base/task/single_thread_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "media/capture/capture_export.h"
#include "media/capture/video/video_capture_device_factory.h"

@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "media/capture/video/mock_gpu_memory_buffer_manager.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/video/fake_gpu_memory_buffer.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "media/capture/video/chromeos/request_manager.h"
#endif
@ -27,7 +27,7 @@ MockGpuMemoryBufferManager::CreateFakeGpuMemoryBuffer(
gpu::SurfaceHandle surface_handle,
base::WaitableEvent* shutdown_event) {
auto gmb = std::make_unique<FakeGpuMemoryBuffer>(size, format);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// For faking a valid JPEG blob buffer.
if (base::checked_cast<size_t>(size.width()) >= sizeof(Camera3JpegBlob)) {
Camera3JpegBlob* header = reinterpret_cast<Camera3JpegBlob*>(

@ -5,7 +5,6 @@
#include "media/capture/video/video_capture_buffer_pool_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/capture/capture_switches.h"
#include "services/video_effects/public/cpp/buildflags.h"
@ -24,7 +23,7 @@ int DeviceVideoCaptureMaxBufferPoolSize() {
// Also, this must be greater than the frame delay of VideoToolbox encoder
// for AVC High Profile.
max_buffer_count = 15;
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
// On Chrome OS with MIPI cameras running on HAL v3, there can be four
// concurrent streams of camera pipeline depth ~6. We allow at most 36 buffers
// here to take into account the delay caused by the consumer (e.g. display or

@ -7,10 +7,9 @@
#include <memory>
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/capture/video/shared_memory_buffer_tracker.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.h"
#elif BUILDFLAG(IS_APPLE)
#include "media/capture/video/apple/gpu_memory_buffer_tracker_apple.h"
@ -38,7 +37,7 @@ VideoCaptureBufferTrackerFactoryImpl::CreateTracker(
VideoCaptureBufferType buffer_type) {
switch (buffer_type) {
case VideoCaptureBufferType::kGpuMemoryBuffer:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return std::make_unique<GpuMemoryBufferTrackerCros>();
#elif BUILDFLAG(IS_APPLE)
return std::make_unique<GpuMemoryBufferTrackerApple>();

@ -26,7 +26,6 @@
#include "base/trace_event/trace_event.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/base/video_frame.h"
#include "media/base/video_frame_metadata.h"
@ -44,9 +43,9 @@
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/libyuv/include/libyuv.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "media/capture/video/chromeos/video_capture_jpeg_decoder.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ENABLE_VIDEO_EFFECTS)
#include "media/base/media_switches.h"
@ -316,7 +315,7 @@ VideoEffectsContext::TakeReadonlyVideoEffectsManager() {
return std::move(readonly_video_effects_manager_);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VideoCaptureDeviceClient::VideoCaptureDeviceClient(
std::unique_ptr<VideoFrameReceiver> receiver,
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
@ -356,7 +355,7 @@ VideoCaptureDeviceClient::VideoCaptureDeviceClient(
}
#endif // BUILDFLAG(ENABLE_VIDEO_EFFECTS)
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {
DFAKE_SCOPED_RECURSIVE_LOCK(call_from_producer_);
@ -502,7 +501,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
OnLog("Pixel format: " + VideoPixelFormatToString(format.pixel_format));
last_captured_pixel_format_ = format.pixel_format;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (format.pixel_format == PIXEL_FORMAT_MJPEG &&
optional_jpeg_decoder_factory_callback_) {
external_jpeg_decoder_ =
@ -510,7 +509,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
CHECK(external_jpeg_decoder_);
external_jpeg_decoder_->Initialize();
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
if (!format.IsValid()) {
@ -614,7 +613,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
const gfx::ColorSpace color_space = OverrideColorSpaceForLibYuvConversion(
data_color_space, format.pixel_format);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (external_jpeg_decoder_) {
const VideoCaptureJpegDecoder::STATUS status =
external_jpeg_decoder_->GetStatus();
@ -630,7 +629,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData(
return;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// libyuv::ConvertToI420 uses Rec601 to convert RGB to YUV.
if (libyuv::ConvertToI420(

@ -17,7 +17,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/threading/thread_collision_warner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/capture/capture_export.h"
#include "media/capture/mojom/video_effects_manager.mojom.h"
#include "media/capture/video/video_capture_device.h"
@ -99,7 +98,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceClient :
#endif
public VideoCaptureDevice::Client {
public:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VideoCaptureDeviceClient(
std::unique_ptr<VideoFrameReceiver> receiver,
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
@ -109,7 +108,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceClient :
std::unique_ptr<VideoFrameReceiver> receiver,
scoped_refptr<VideoCaptureBufferPool> buffer_pool,
std::optional<VideoEffectsContext> video_effects_context);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
VideoCaptureDeviceClient(const VideoCaptureDeviceClient&) = delete;
VideoCaptureDeviceClient& operator=(const VideoCaptureDeviceClient&) = delete;
@ -222,11 +221,11 @@ class CAPTURE_EXPORT VideoCaptureDeviceClient :
const std::unique_ptr<VideoFrameReceiver> receiver_;
std::vector<int> buffer_ids_known_by_receiver_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VideoCaptureJpegDecoderFactoryCB optional_jpeg_decoder_factory_callback_;
std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_;
base::OnceClosure on_started_using_gpu_cb_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// The pool of shared-memory buffers used for capturing.
const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;

@ -17,7 +17,6 @@
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "components/viz/test/test_context_provider.h"
#include "media/base/limits.h"
@ -38,9 +37,9 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "media/capture/video/chromeos/video_capture_jpeg_decoder.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
using ::testing::_;
using ::testing::AtLeast;
@ -62,11 +61,11 @@ namespace {
constexpr auto si_usage = gpu::SHARED_IMAGE_USAGE_CPU_WRITE_ONLY |
gpu::SHARED_IMAGE_USAGE_DISPLAY_READ;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<VideoCaptureJpegDecoder> ReturnNullPtrAsJpecDecoder() {
return nullptr;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
class FakeVideoEffectsManagerImpl
: public media::mojom::ReadonlyVideoEffectsManager {
@ -194,7 +193,7 @@ class VideoCaptureDeviceClientTest : public ::testing::Test {
receiver_ = controller.get();
test_sii_ = base::MakeRefCounted<gpu::TestSharedImageInterface>();
test_sii_->UseTestGMBInSharedImageCreationWithBufferUsage();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
device_client_ = std::make_unique<VideoCaptureDeviceClient>(
std::move(controller), buffer_pool,
base::BindRepeating(&ReturnNullPtrAsJpecDecoder));
@ -219,7 +218,7 @@ class VideoCaptureDeviceClientTest : public ::testing::Test {
std::move(controller), buffer_pool,
media::VideoEffectsContext(std::move(processor_remote),
std::move(readonly_effects_manager_remote)));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
};

@ -8,7 +8,6 @@
#include "base/command_line.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/file_video_capture_device_factory.h"

@ -9,7 +9,6 @@
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "media/capture/video/video_capture_device.h"
#include "media/capture/video/video_capture_device_info.h"

@ -28,7 +28,6 @@
#include "base/test/test_timeouts.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/video_frame.h"
#include "media/capture/video/create_video_capture_device_factory.h"
#include "media/capture/video/mock_video_capture_device_client.h"
@ -54,7 +53,7 @@
#include "media/capture/video/android/video_capture_device_factory_android.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/mojo_service_manager/connection.h"
#include "media/capture/video/chromeos/camera_buffer_factory.h"
#include "media/capture/video/chromeos/public/cros_features.h"
@ -109,7 +108,7 @@
#define MAYBE_UsingRealWebcam_CaptureWithSize UsingRealWebcam_CaptureWithSize
#define MAYBE_UsingRealWebcam_CheckPhotoCallbackRelease \
UsingRealWebcam_CheckPhotoCallbackRelease
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
#define MAYBE_UsingRealWebcam_AllocateBadSize \
DISABLED_UsingRealWebcam_AllocateBadSize
#define MAYBE_UsingRealWebcam_CaptureMjpeg UsingRealWebcam_CaptureMjpeg
@ -118,19 +117,6 @@
DISABLED_UsingRealWebcam_GetPhotoState
#define MAYBE_UsingRealWebcam_CaptureWithSize \
DISABLED_UsingRealWebcam_CaptureWithSize
#define MAYBE_UsingRealWebcam_CheckPhotoCallbackRelease \
UsingRealWebcam_CheckPhotoCallbackRelease
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
// UsingRealWebcam_AllocateBadSize will hang when a real camera is attached and
// if more than one test is trying to use the camera (even across processes). Do
// NOT renable this test without fixing the many bugs associated with it:
// http://crbug.com/94134 http://crbug.com/137260 http://crbug.com/417824
#define MAYBE_UsingRealWebcam_AllocateBadSize \
DISABLED_UsingRealWebcam_AllocateBadSize
#define MAYBE_UsingRealWebcam_CaptureMjpeg UsingRealWebcam_CaptureMjpeg
#define MAYBE_UsingRealWebcam_TakePhoto UsingRealWebcam_TakePhoto
#define MAYBE_UsingRealWebcam_GetPhotoState UsingRealWebcam_GetPhotoState
#define MAYBE_UsingRealWebcam_CaptureWithSize UsingRealWebcam_CaptureWithSize
#define MAYBE_UsingRealWebcam_CheckPhotoCallbackRelease \
UsingRealWebcam_CheckPhotoCallbackRelease
#else
@ -285,7 +271,7 @@ class VideoCaptureDeviceTest
base::SingleThreadTaskRunner::GetCurrentDefault()),
video_capture_client_(CreateDeviceClient()),
image_capture_client_(new MockImageCaptureClient()) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
local_gpu_memory_buffer_manager_ =
std::make_unique<LocalGpuMemoryBufferManager>();
VideoCaptureDeviceFactoryChromeOS::SetGpuBufferManager(
@ -310,7 +296,7 @@ class VideoCaptureDeviceTest
}
void TearDown() override {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VideoCaptureDeviceFactoryChromeOS::SetGpuBufferManager(nullptr);
#endif
task_environment_.RunUntilIdle();
@ -321,7 +307,7 @@ class VideoCaptureDeviceTest
return std::get<1>(GetParam()) == WIN_MEDIA_FOUNDATION &&
VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation();
}
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
void WaitForCameraServiceReady() {
if (media::ShouldUseCrosCameraService()) {
VideoCaptureDeviceFactoryChromeOS* vcd_factory_chromeos =
@ -472,7 +458,7 @@ class VideoCaptureDeviceTest
std::unique_ptr<MockVideoCaptureDeviceClient> video_capture_client_;
const scoped_refptr<MockImageCaptureClient> image_capture_client_;
VideoCaptureFormat last_format_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<LocalGpuMemoryBufferManager> local_gpu_memory_buffer_manager_;
#endif
std::unique_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_;
@ -540,9 +526,9 @@ WRAPPED_TEST_P(VideoCaptureDeviceTest, MAYBE_UsingRealWebcam_CaptureWithSize) {
base::Unretained(this)));
}
void VideoCaptureDeviceTest::RunCaptureWithSizeTestCase() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
WaitForCameraServiceReady();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const auto device_info = FindUsableDevice();
ASSERT_TRUE(device_info);
@ -680,13 +666,13 @@ WRAPPED_TEST_P(VideoCaptureDeviceTest, MAYBE_UsingRealWebcam_CaptureMjpeg) {
base::Unretained(this)));
}
void VideoCaptureDeviceTest::RunCaptureMjpegTestCase() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (media::ShouldUseCrosCameraService()) {
VLOG(1)
<< "Skipped on Chrome OS device where HAL v3 camera service is used";
return;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
auto device_info = GetFirstDeviceSupportingPixelFormat(PIXEL_FORMAT_MJPEG);
ASSERT_TRUE(device_info);
@ -743,9 +729,9 @@ WRAPPED_TEST_P(VideoCaptureDeviceTest, MAYBE_UsingRealWebcam_TakePhoto) {
base::Unretained(this)));
}
void VideoCaptureDeviceTest::RunTakePhotoTestCase() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
WaitForCameraServiceReady();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const auto device_info = FindUsableDevice();
ASSERT_TRUE(device_info);
@ -790,9 +776,9 @@ WRAPPED_TEST_P(VideoCaptureDeviceTest, MAYBE_UsingRealWebcam_GetPhotoState) {
base::Unretained(this)));
}
void VideoCaptureDeviceTest::RunGetPhotoStateTestCase() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
WaitForCameraServiceReady();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const auto device_info = FindUsableDevice();
ASSERT_TRUE(device_info);

@ -44,7 +44,6 @@ source_set("win") {
deps = [
"//base",
"//base:i18n",
"//build:chromeos_buildflags",
"//media",
"//media/base/win:color_space_util_win",
"//media/capture/mojom:image_capture",
@ -84,7 +83,6 @@ source_set("win_unittests") {
deps = [
"//base/test:test_support",
"//build:chromeos_buildflags",
"//gpu/command_buffer/client",
"//media:test_support",
"//media/capture:capture",

@ -208,7 +208,6 @@ source_set("unit_tests") {
deps = [
"//base/test:test_support",
"//build:chromeos_buildflags",
"//crypto",
"//media:test_support",
"//testing/gmock",

@ -11,7 +11,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//media/media_options.gni")
# This file defines output paths for the CDM adapters and CDMs.

@ -71,7 +71,6 @@ source_set("filters") {
deps = [
"//base",
"//build:chromeos_buildflags",
"//cc/base", # For MathUtil.
"//media:media_buildflags",
"//media/base",
@ -321,7 +320,6 @@ source_set("unit_tests") {
deps = [
"//base/test:test_support",
"//build:chromeos_buildflags",
"//media:test_support",
"//testing/gmock",
"//testing/gtest",

@ -17,7 +17,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/audio_decoder.h"
#include "media/base/cdm_context.h"
#include "media/base/demuxer_stream.h"

@ -33,7 +33,6 @@
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/decrypt_config.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_switches.h"

@ -16,7 +16,6 @@
#include "base/check.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "media/base/container_names.h"
#include "media/base/media_switches.h"
#include "media/base/mock_filters.h"

@ -14,7 +14,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/base/media_track.h"
#include "media/base/media_tracks.h"

@ -3,7 +3,6 @@
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/logging.gni")
import("//build/config/ui.gni")
@ -390,7 +389,6 @@ source_set("common") {
deps = [
":buildflags",
"//base",
"//build:chromeos_buildflags",
"//media",
"//ui/gfx:buffer_types",
"//ui/gfx:memory_buffer",
@ -642,10 +640,7 @@ source_set("unit_tests") {
if (use_av1_hw_decoder && media_use_ffmpeg) {
sources += [ "av1_decoder_unittest.cc" ]
deps += [
"//build:chromeos_buildflags",
"//third_party/ffmpeg",
]
deps += [ "//third_party/ffmpeg" ]
}
if (is_win) {

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/ozone.gni")
declare_args() {
@ -11,23 +10,20 @@ declare_args() {
# Indicates if Video4Linux2 codec is used. This is used for all CrOS
# platforms which have v4l2 hardware encoder / decoder.
use_v4l2_codec =
is_chromeos_lacros && (target_cpu == "arm" || target_cpu == "arm64")
use_v4l2_codec = false
# Indicates if VA-API-based hardware acceleration is to be used. This
# is typically the case on x86-based ChromeOS devices.
# VA-API should also be compiled by default on x11/wayland linux devices
# using x86/x64.
use_vaapi = (is_chromeos_lacros ||
(is_linux && !is_castos &&
(ozone_platform_x11 || ozone_platform_wayland))) &&
use_vaapi = is_linux && !is_castos &&
(ozone_platform_x11 || ozone_platform_wayland) &&
(target_cpu == "x86" || target_cpu == "x64")
# Indicates if ChromeOS protected media support exists. This is used
# to enable the CDM daemon in Chrome OS as well as support for
# encrypted content with HW video decoders. This is always enabled for Lacros
# because it detects support at runtime.
use_chromeos_protected_media = is_chromeos_lacros
# encrypted content with HW video decoders.
use_chromeos_protected_media = false
# Indicates if the ChromeOS protected media functionality should also be
# utilized by HW video decoding for ARC.
@ -59,5 +55,5 @@ if (use_chromeos_protected_av1) {
declare_args() {
# VA-API also allows decoding of images, but we don't want to use this
# outside of chromeos, even if video decoding is enabled.
use_vaapi_image_codecs = use_vaapi && is_chromeos_ash
use_vaapi_image_codecs = use_vaapi && is_chromeos
}

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//gpu/vulkan/features.gni")
import("//media/gpu/args.gni")
import("//testing/test.gni")
@ -110,7 +109,6 @@ source_set("common") {
deps = [
":fourcc",
"//base",
"//build:chromeos_buildflags",
"//build/config/linux/libdrm",
"//gpu/ipc/common:common",
"//media",
@ -264,7 +262,7 @@ source_set("unit_tests") {
"video_decoder_pipeline_unittest.cc",
"video_frame_resource_unittest.cc",
]
if (is_chromeos_ash) {
if (is_chromeos) {
deps +=
[ "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_gpu" ]
}
@ -290,7 +288,6 @@ test("image_processor_test") {
deps = [
":chromeos",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//media:test_support",
"//media/gpu:buildflags",
"//media/gpu:video_frame_mapper_common",

@ -27,7 +27,6 @@
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
@ -240,7 +239,7 @@ YuvSubsampling ToYuvSubsampling(VideoPixelFormat format) {
}
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
bool IsFormatTestedForDmabufAndGbm(VideoPixelFormat format) {
switch (format) {
case PIXEL_FORMAT_NV12:
@ -250,7 +249,7 @@ bool IsFormatTestedForDmabufAndGbm(VideoPixelFormat format) {
return false;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(USE_V4L2_CODEC)
bool SupportsNecessaryGLExtension() {
@ -540,7 +539,7 @@ TEST_P(ImageProcessorParamTest, ConvertOneTime_MemToMem) {
EXPECT_TRUE(ip_client->WaitForFrameProcessors());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// We don't yet have the function to create Dmabuf-backed VideoFrame on
// platforms except ChromeOS. So MemToDmabuf test is limited on ChromeOS.
TEST_P(ImageProcessorParamTest, ConvertOneTime_DmabufToMem) {
@ -633,7 +632,7 @@ TEST_P(ImageProcessorParamTest, ConvertOneTime_GmbToGmb) {
EXPECT_EQ(ip_client->GetNumOfProcessedImages(), 1u);
EXPECT_TRUE(ip_client->WaitForFrameProcessors());
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
INSTANTIATE_TEST_SUITE_P(
PixelFormatConversionToNV12,
@ -688,7 +687,7 @@ INSTANTIATE_TEST_SUITE_P(NV12CroppingAndScaling,
::testing::Values(std::make_tuple(kNV12Image360PIn480P,
kNV12Image270P)));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(hiroh): Add more tests.
// MEM->DMABUF (V4L2VideoEncodeAccelerator),
#endif

@ -7,7 +7,7 @@
#include "base/memory/ptr_util.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "chromeos/components/cdm_factory_daemon/stable_cdm_context_impl.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/format_utils.h"

@ -135,7 +135,7 @@ TEST(PlatformVideoFrameUtilsTest, CreateNativePixmapDmaBuf) {
// CreateGpuMemoryBufferVideoFrame() so that those functions return a
// non-nullptr frame on platforms where allocating NV12 buffers is not
// supported.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST(PlatformVideoFrameUtilsTest, CreateVideoFrame) {
constexpr VideoPixelFormat kPixelFormat = PIXEL_FORMAT_NV12;
constexpr gfx::Size kCodedSize(320, 240);
@ -186,5 +186,5 @@ TEST(PlatformVideoFrameUtilsTest, CreateVideoFrame) {
};
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace media

@ -34,14 +34,14 @@
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gl/gl_bindings.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including these headers will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h" // nogncheck
#include "media/gpu/chromeos/secure_buffer.pb.h" // nogncheck
#include "third_party/cros_system_api/constants/cdm_oemcrypto.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
namespace {
@ -82,7 +82,7 @@ std::string VectorToString(const std::vector<T>& vec) {
return result.str();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
scoped_refptr<DecoderBuffer> DecryptBitstreamBuffer(
BitstreamBuffer bitstream_buffer) {
// Check to see if we have our secure buffer tag and then extract the
@ -172,7 +172,7 @@ scoped_refptr<DecoderBuffer> DecryptBitstreamBuffer(
}
return buffer;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace
@ -269,11 +269,11 @@ bool VdVideoDecodeAccelerator::Initialize(const Config& config,
client_ = client;
}
media::CdmContext* cdm_context = nullptr;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
is_encrypted_ = config.is_encrypted();
if (is_encrypted_)
cdm_context = chromeos::ChromeOsCdmFactory::GetArcCdmContext();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
VideoDecoderConfig vd_config(
VideoCodecProfileToVideoCodec(config.profile), config.profile,
VideoDecoderConfig::AlphaMode::kIsOpaque, config.container_color_space,
@ -302,7 +302,7 @@ void VdVideoDecodeAccelerator::OnInitializeDone(DecoderStatus status) {
void VdVideoDecodeAccelerator::Decode(BitstreamBuffer bitstream_buffer) {
const int32_t bitstream_id = bitstream_buffer.id();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (is_encrypted_) {
scoped_refptr<DecoderBuffer> buffer =
DecryptBitstreamBuffer(std::move(bitstream_buffer));
@ -314,7 +314,7 @@ void VdVideoDecodeAccelerator::Decode(BitstreamBuffer bitstream_buffer) {
Decode(std::move(buffer), bitstream_id);
return;
}
#endif // BUILFLAG(IS_CHROMEOS_ASH)
#endif // BUILFLAG(IS_CHROMEOS)
Decode(bitstream_buffer.ToDecoderBuffer(), bitstream_id);
}

@ -17,7 +17,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/thread_annotations.h"
#include "base/unguessable_token.h"
#include "build/chromeos_buildflags.h"
#include "media/base/status.h"
#include "media/base/video_decoder.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
@ -154,11 +153,11 @@ class MEDIA_GPU_EXPORT VdVideoDecodeAccelerator
std::pair<scoped_refptr<VideoFrame>, size_t /* num_sent */>>
picture_at_client_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Indicates we are handling encrypted content which requires an extra check
// to see if it is a secure buffer format.
bool is_encrypted_ = false;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Value of |low_delay| from the most recent initialization (via either Create
// or Initialize(const Config&, Client*, bool). When re-initialization happens

@ -1182,14 +1182,7 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
main_frame_pool_.reset();
return *viable_candidate;
}
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
// Lacros should always use a PlatformVideoFramePool outside of tests (because
// it doesn't need to handle ARC++/ARCVM requests) with no custom allocator
// (because buffers are allocated with minigbm).
CHECK(!allocator.has_value());
CHECK(main_frame_pool_->AsPlatformVideoFramePool() ||
main_frame_pool_->IsFakeVideoFramePool());
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
// Ash Chrome can use any type of frame pool (because it may get requests from
// ARC++/ARCVM) but never a custom allocator.
CHECK(!allocator.has_value());
@ -1256,9 +1249,8 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
// that callers of this method don't need to inspect GetGpuBufferLayout()
// of this class' GetVideoFramePool().
#if BUILDFLAG(USE_VAAPI) && BUILDFLAG(IS_CHROMEOS_ASH)
// Linux and Lacros do not check the modifiers,
// since they do not set any.
#if BUILDFLAG(USE_VAAPI) && BUILDFLAG(IS_CHROMEOS)
// Linux does not check the modifiers since it does not set any.
const GpuBufferLayout layout(std::move(status_or_layout).value());
if (layout.modifier() == viable_candidate->modifier) {
return *viable_candidate;
@ -1275,7 +1267,7 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
}
#else
return *viable_candidate;
#endif // BUILDFLAG(USE_VAAPI) && BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(USE_VAAPI) && BUILDFLAG(IS_CHROMEOS)
}
// We haven't found a |viable_candidate|, and need to instantiate an

@ -14,7 +14,6 @@
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/base/cdm_context.h"
#include "media/base/limits.h"

@ -27,12 +27,12 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libdrm/src/include/drm/drm_fourcc.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including this header will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
using base::test::RunClosure;
using ::testing::_;
@ -104,7 +104,7 @@ class MockDecoder : public VideoDecoderMixin {
MOCK_CONST_METHOD0(GetDecoderType, VideoDecoderType());
};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
constexpr uint8_t kEncryptedData[] = {1, 8, 9};
constexpr uint8_t kTranscryptedData[] = {9, 2, 4};
constexpr uint64_t kFakeSecureHandle = 75;
@ -149,7 +149,7 @@ class FakeCdmContextRef : public CdmContextRef {
private:
raw_ptr<CdmContext> cdm_context_;
};
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
class MockImageProcessor : public ImageProcessor {
public:
@ -269,7 +269,7 @@ class VideoDecoderPipelineTest
testing::Mock::VerifyAndClearExpectations(this);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
void InitializeForTranscrypt(bool vp9 = false) {
decoder_->allow_encrypted_content_for_testing_ = true;
if (vp9) {
@ -302,7 +302,7 @@ class VideoDecoderPipelineTest
encrypted_buffer_ = DecoderBuffer::CopyFrom(kEncryptedData);
transcrypted_buffer_ = DecoderBuffer::CopyFrom(kTranscryptedData);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
static std::unique_ptr<VideoDecoderMixin> CreateNullMockDecoder(
std::unique_ptr<MediaLog> /* media_log */,
@ -399,14 +399,14 @@ class VideoDecoderPipelineTest
base::test::TaskEnvironment task_environment_;
VideoDecoderConfig config_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
MockCdmContext cdm_context_; // Keep this before |decoder_|.
MockChromeOsCdmContext chromeos_cdm_context_;
StrictMock<MockDecryptor> decryptor_;
scoped_refptr<DecoderBuffer> encrypted_buffer_;
scoped_refptr<DecoderBuffer> transcrypted_buffer_;
media::CallbackRegistry<CdmContext::EventCB::RunType> event_callbacks_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<VideoDecoderPipeline> decoder_;
raw_ptr<MockVideoFramePool> pool_;
};
@ -431,7 +431,7 @@ const struct DecoderPipelineTestParams kDecoderPipelineTestParams[] = {
{base::BindRepeating(&VideoDecoderPipelineTest::CreateGoodMockDecoder),
DecoderStatus::Codes::kOk},
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// A CreateDecoderFunctionCB for transcryption, where Create() is ok, and
// the decoder will Initialize OK, but then the pipeline will not create the
// transcryptor due to a missing CdmContext. This will succeed if called
@ -439,7 +439,7 @@ const struct DecoderPipelineTestParams kDecoderPipelineTestParams[] = {
{base::BindRepeating(
&VideoDecoderPipelineTest::CreateGoodMockTranscryptDecoder),
DecoderStatus::Codes::kUnsupportedEncryptionMode},
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// A CreateDecoderFunctionCB that Create()s ok but fails to Initialize()
// correctly.
@ -491,7 +491,7 @@ TEST_F(VideoDecoderPipelineTest, Reset) {
base::Unretained(this)));
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(VideoDecoderPipelineTest, TranscryptThenEos) {
InitializeForTranscrypt();
@ -1062,7 +1062,7 @@ TEST_F(VideoDecoderPipelineTest, SplitVp9Superframe) {
testing::Mock::VerifyAndClearExpectations(this);
}
#endif // BUILDFLAG(USE_V4L2_CODEC)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Verifies the algorithm for choosing formats in PickDecoderOutputFormat works
// as expected.
@ -1140,10 +1140,9 @@ TEST_F(VideoDecoderPipelineTest, PickDecoderOutputFormat) {
DetachDecoderSequenceChecker();
}
// These tests only work on non-linux and non-lacros vaapi systems, since on
// linux and lacros there is no support for different modifiers.
#if BUILDFLAG(USE_VAAPI) && !BUILDFLAG(IS_LINUX) && \
!BUILDFLAG(IS_CHROMEOS_LACROS)
// These tests only work on non-linux vaapi systems, since on linux there is no
// support for different modifiers.
#if BUILDFLAG(USE_VAAPI) && !BUILDFLAG(IS_LINUX)
// Verifies the algorithm for choosing formats in PickDecoderOutputFormat works
// as expected when the pool returns linear buffers. It should allocate an image
@ -1226,8 +1225,7 @@ TEST_F(VideoDecoderPipelineTest, PickDecoderOutputFormatUnsupportedModifier) {
DetachDecoderSequenceChecker();
}
#endif // BUILDFLAG(USE_VAAPI) && !BUILDFLAG(IS_LINUX) &&
// !BUILDFLAG(IS_CHROMEOS_LACROS)
#endif // BUILDFLAG(USE_VAAPI) && !BUILDFLAG(IS_LINUX)
// Verifies that ReleaseAllFrames is called on the frame pool when we receive
// the kDecoderStateLost event through the waiting callback. This can occur

@ -12,8 +12,7 @@
#include "media/gpu/media_gpu_export.h"
#include "media/media_buildflags.h"
#if BUILDFLAG(USE_V4L2_CODEC) && \
(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH))
#if BUILDFLAG(USE_V4L2_CODEC) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
#include "media/gpu/v4l2/legacy/v4l2_video_decode_accelerator.h"
#include "media/gpu/v4l2/v4l2_device.h"
#endif
@ -29,8 +28,7 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA(
if (gpu_preferences.disable_accelerated_video_decode)
return nullptr;
#if BUILDFLAG(USE_V4L2_CODEC) && \
(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH))
#if BUILDFLAG(USE_V4L2_CODEC) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
std::unique_ptr<VideoDecodeAccelerator> vda;
vda.reset(new V4L2VideoDecodeAccelerator(new V4L2Device()));

@ -32,7 +32,6 @@ target(link_target_type, "service") {
"//media/gpu",
]
deps = [
"//build:chromeos_buildflags",
"//gpu/command_buffer/service:gles2",
"//gpu/ipc/service",
"//media:media_buildflags",

@ -2,19 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//media/gpu/args.gni")
source_set("sandbox") {
sources = []
if (is_linux || is_chromeos_ash) {
if (is_linux || is_chromeos) {
sources += [
"hardware_video_decoding_sandbox_hook_linux.cc",
"hardware_video_decoding_sandbox_hook_linux.h",
]
}
if (is_linux || is_chromeos) {
sources += [
"hardware_video_encoding_sandbox_hook_linux.cc",
"hardware_video_encoding_sandbox_hook_linux.h",
]

@ -9,6 +9,7 @@
#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "media/gpu/buildflags.h"
#include "sandbox/policy/linux/bpf_hardware_video_decoding_policy_linux.h"
@ -57,7 +58,7 @@ void AllowAccessToRenderNodes(std::vector<BrokerFilePermission>& permissions,
bool HardwareVideoDecodingPreSandboxHookForVaapiOnIntel(
sandbox::syscall_broker::BrokerCommandSet& command_set,
std::vector<BrokerFilePermission>& permissions) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// This should only be needed in order for GbmDeviceWrapper in
// platform_video_frame_utils.cc to be able to initialize minigbm after
// entering the sandbox. Since minigbm is only needed for buffer allocation on
@ -83,7 +84,7 @@ bool HardwareVideoDecodingPreSandboxHookForVaapiOnIntel(
AllowAccessToRenderNodes(permissions, /*include_sys_dev_char=*/true,
/*read_write=*/false);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(USE_VAAPI)
VaapiWrapper::PreSandboxInitialization(/*allow_disabling_global_lock=*/true);
return true;
@ -99,14 +100,14 @@ bool HardwareVideoDecodingPreSandboxHookForVaapiOnAMD(
command_set.set(sandbox::syscall_broker::COMMAND_STAT);
command_set.set(sandbox::syscall_broker::COMMAND_READLINK);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// This is added because libdrm calls access() from drmGetMinorType() that is
// called from drmGetNodeTypeFromFd(). libva calls drmGetNodeTypeFromFd()
// during initialization.
//
// TODO(b/210759684): we probably will need to do this for Linux as well.
command_set.set(sandbox::syscall_broker::COMMAND_ACCESS);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
AllowAccessToRenderNodes(permissions, /*include_sys_dev_char=*/true,
/*read_write=*/true);

@ -2,9 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_chromeos || is_linux) {
import("//build/config/chromeos/ui_mode.gni")
}
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
@ -136,10 +133,6 @@ source_set("frame_validator") {
":test_helpers",
"//media/gpu",
]
if (is_chromeos || is_linux) {
deps += [ "//build:chromeos_buildflags" ]
}
}
source_set("frame_file_writer") {
@ -153,10 +146,6 @@ source_set("frame_file_writer") {
"//media/gpu",
"//ui/gfx/codec:codec",
]
if (is_chromeos || is_linux) {
deps += [ "//build:chromeos_buildflags" ]
}
}
source_set("test_helpers") {
@ -232,10 +221,6 @@ static_library("video_player_test_environment") {
":video_test_environment",
"//media/gpu",
]
if (is_chromeos || is_linux) {
deps += [ "//build:chromeos_buildflags" ]
}
}
static_library("video_encoder") {
@ -274,11 +259,7 @@ static_library("video_encoder_test_environment") {
":video_test_environment",
"//media/gpu",
]
deps = [ "//base:base" ]
if (is_chromeos || is_linux) {
deps += [ "//build:chromeos_buildflags" ]
}
deps = [ "//base" ]
}
if (use_vaapi || use_v4l2_codec) {
@ -296,16 +277,11 @@ if (use_vaapi || use_v4l2_codec) {
"//testing/gtest",
"//third_party/libyuv",
]
if (is_chromeos || is_linux) {
deps += [ "//build:chromeos_buildflags" ]
}
data = [ "//media/test/data/" ]
}
}
if (is_chromeos_ash) {
if (is_chromeos) {
static_library("local_gpu_memory_buffer_manager") {
testonly = true
sources = [

@ -19,7 +19,6 @@
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "media/base/bitrate.h"
#include "media/base/media_switches.h"

@ -18,7 +18,6 @@
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/video_frame_mapper.h"
#include "media/gpu/video_frame_mapper_factory.h"

@ -9,7 +9,6 @@
#include <utility>
#include "base/system/sys_info.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/base/video_types.h"
#include "media/gpu/buildflags.h"

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
@ -110,7 +109,7 @@ source_set("v4l2") {
"//ui/ozone",
]
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [
"v4l2_jpeg_encode_accelerator.cc",
"v4l2_jpeg_encode_accelerator.h",

@ -18,7 +18,6 @@
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"

@ -15,7 +15,6 @@
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
namespace media {
namespace {

@ -35,12 +35,12 @@
#include "media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including this header will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// TODO(jkardatzke): Remove these once they are in linux/videodev2.h.
#define V4L2_CID_MPEG_MTK_BASE (0x00990000 | 0x2000)
@ -243,7 +243,7 @@ void V4L2VideoDecoder::Initialize(const VideoDecoderConfig& config,
cdm_context_ref_ = nullptr;
if (config.is_encrypted()) {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
VLOGF(1) << "Encrypted content is not supported";
std::move(init_cb).Run(DecoderStatus::Codes::kUnsupportedEncryptionMode);
return;
@ -499,7 +499,7 @@ V4L2Status V4L2VideoDecoder::InitializeBackend() {
void V4L2VideoDecoder::AllocateSecureBuffer(uint32_t size,
SecureBufferAllocatedCB callback) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
pending_secure_allocate_callbacks_++;
// Wrap this with a default handler if it gets dropped somehow or otherwise we
// could hang waiting to finish init.
@ -514,7 +514,7 @@ void V4L2VideoDecoder::AllocateSecureBuffer(uint32_t size,
mojo::PlatformHandle()));
#else
NOTREACHED();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
void V4L2VideoDecoder::AllocateSecureBufferCB(SecureBufferAllocatedCB callback,

@ -18,18 +18,17 @@
#include "base/containers/heap_array.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/macros.h"
#include "media/gpu/v4l2/v4l2_decode_surface.h"
#include "media/gpu/v4l2/v4l2_decode_surface_handler.h"
#include "media/gpu/v4l2/v4l2_device.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including this header will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -408,7 +407,7 @@ V4L2VideoDecoderDelegateH264::ParseEncryptedSliceHeader(
const std::vector<SubsampleEntry>& /*subsamples*/,
uint64_t secure_handle,
H264SliceHeader* slice_header_out) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (!cdm_context_ || !cdm_context_->GetChromeOsCdmContext()) {
LOG(ERROR) << "Missing ChromeOSCdmContext";
return Status::kFail;
@ -502,7 +501,7 @@ V4L2VideoDecoderDelegateH264::ParseEncryptedSliceHeader(
return Status::kOk;
#else
return Status::kFail;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
H264Decoder::H264Accelerator::Status V4L2VideoDecoderDelegateH264::SubmitSlice(

@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
@ -19,7 +18,7 @@ assert(use_ozone)
generate_stubs("libva_stubs") {
extra_header = "va_stub_header.fragment"
sigs = [ "va.sigs" ]
if (is_chromeos_ash) {
if (is_chromeos) {
sigs += [ "va_prot.sigs" ]
}
sigs += [ "va_drm.sigs" ]
@ -87,7 +86,6 @@ source_set("vaapi") {
":common",
":vaapi_status",
"//base",
"//build:chromeos_buildflags",
"//gpu/command_buffer/service:gles2",
"//gpu/config",
"//gpu/ipc/common",
@ -108,7 +106,7 @@ source_set("vaapi") {
"//skia",
]
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [
"vaapi_jpeg_encode_accelerator.cc",
"vaapi_jpeg_encode_accelerator.h",
@ -158,7 +156,6 @@ source_set("common") {
]
deps = [
":libva_stubs",
"//build:chromeos_buildflags",
"//media/gpu/chromeos:video_frame_resource",
"//third_party/libyuv",
"//ui/base:features",
@ -181,7 +178,7 @@ source_set("vaapi_test_utils") {
"//testing/gtest",
"//third_party/libyuv:libyuv",
]
if (is_chromeos_ash) {
if (is_chromeos) {
deps += [ "//media/gpu/test:local_gpu_memory_buffer_manager" ]
}
public_deps = [ "//ui/gfx/geometry" ]
@ -213,7 +210,7 @@ source_set("unit_test") {
"//ui/gfx:test_support",
"//ui/gfx/geometry",
]
if (is_chromeos_ash) {
if (is_chromeos) {
sources += [ "vaapi_video_decoder_unittest.cc" ]
deps +=
[ "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_gpu" ]
@ -236,7 +233,7 @@ source_set("vaapi_image_decoder_test_common") {
}
# TODO(crbug.com/40115082): remove is_chromeos.
if (is_chromeos_ash) {
if (is_chromeos) {
source_set("jpeg_decoder_unit_test") {
testonly = true
sources = [ "vaapi_jpeg_decoder_unittest.cc" ]
@ -292,7 +289,6 @@ test("vaapi_unittest") {
":vaapi_utils_unittest",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//gpu",
"//media/gpu/test:helpers",
"//testing/gtest",
@ -307,7 +303,7 @@ test("vaapi_unittest") {
data_deps = [ "//media/gpu/vaapi/test/fake_libva_driver:fake_drv_video" ]
# TODO(crbug.com/40115082): remove is_chromeos.
if (is_chromeos_ash) {
if (is_chromeos) {
deps += [
":jpeg_decoder_unit_test",
":webp_decoder_unit_test",

@ -18,7 +18,6 @@
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/av1_picture.h"
#include "media/gpu/vaapi/vaapi_common.h"
#include "media/gpu/vaapi/vaapi_decode_surface_handler.h"
@ -791,7 +790,7 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
base::span<const uint8_t> data) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const DecryptConfig* decrypt_config = pic.decrypt_config();
if (decrypt_config && !SetDecryptConfig(decrypt_config->Clone()))
return DecodeStatus::kFail;
@ -821,7 +820,7 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
return DecodeStatus::kFail;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// libgav1 ensures that tile_columns is >= 0 and <= MAX_TILE_COLS.
DCHECK_LE(0, pic.frame_header.tile_info.tile_columns);
@ -867,7 +866,7 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
{{picture_params_->id(),
{picture_params_->type(), picture_params_->size(), &pic_param}}};
buffers.reserve(3 + slice_params.size());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (IsTranscrypted()) {
CHECK(decrypt_config);
CHECK_EQ(decrypt_config->subsamples().size(), 2u);
@ -892,7 +891,7 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
{encoded_data->type(), encoded_data->size(),
data.data() + decrypt_config->subsamples()[0].clear_bytes}});
} else {
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
encoded_data = vaapi_wrapper_->CreateVABuffer(VASliceDataBufferType,
data.size_bytes());
if (!encoded_data)
@ -900,14 +899,14 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
buffers.push_back(
{encoded_data->id(),
{encoded_data->type(), encoded_data->size(), data.data()}});
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
}
if (uses_crypto) {
buffers.push_back(
{crypto_params_->id(),
{crypto_params_->type(), crypto_params_->size(), &crypto_param}});
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
for (size_t i = 0; i < slice_params.size(); ++i) {
buffers.push_back({slice_params_va_buffers[i]->id(),

@ -44,7 +44,7 @@ constexpr std::array<uint8_t, 64> kZigzagScan8x8 = {
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
int GetSliceHeaderCounter() {
// Needs to be static in case there are multiple active at once, in which case
// they all need unique values.
@ -57,7 +57,7 @@ int GetSliceHeaderCounter() {
// This is the size of the data block which the AMD_SLICE_PARAMS is stored in.
constexpr size_t kAmdEncryptedSliceHeaderSize = 1024;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// These structures match what AMD uses to pass back the extra slice header
// parameters we need for CENCv1. This is stored in the first 1KB of the
// encrypted subsample returned by the cdm-oemcrypto daemon on ChromeOS.
@ -75,7 +75,7 @@ typedef struct AMD_SLICE_PARAMS {
static_assert(sizeof(AMD_SLICE_PARAMS) <= kAmdEncryptedSliceHeaderSize,
"Invalid size for AMD_SLICE_PARAMS");
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
H264VaapiVideoDecoderDelegate::H264VaapiVideoDecoderDelegate(
VaapiDecodeSurfaceHandler* const vaapi_dec,
@ -135,9 +135,9 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata(
"H264VaapiVideoDecoderDelegate::SubmitFrameMetadata");
VAPictureParameterBufferH264 pic_param;
memset(&pic_param, 0, sizeof(pic_param));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
memset(&crypto_params_, 0, sizeof(crypto_params_));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
full_sample_ = false;
#define FROM_SPS_TO_PP(a) pic_param.a = sps->a
@ -252,7 +252,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::ParseEncryptedSliceHeader(
DCHECK(!subsamples.empty());
DCHECK(!data.empty());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
auto slice_param_buf = std::make_unique<VACencSliceParameterBufferH264>();
// For AMD, we get the slice parameters as structures in the last encrypted
// range.
@ -431,7 +431,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::ParseEncryptedSliceHeader(
}
slice_header_out->full_sample_encryption = true;
return DecodeStatus::kOk;
#else // BUILDFLAG(IS_CHROMEOS_ASH)
#else // BUILDFLAG(IS_CHROMEOS)
return DecodeStatus::kFail;
#endif
}
@ -461,7 +461,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
: DecodeStatus::kFail;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (IsEncryptedSession()) {
const ProtectedSessionState state = SetupDecryptDecode(
/*full_sample=*/false, size, &crypto_params_, &encryption_segment_info_,
@ -474,7 +474,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
return DecodeStatus::kTryAgain;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
VASliceParameterBufferH264 slice_param;
memset(&slice_param, 0, sizeof(slice_param));
@ -589,19 +589,19 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitDecode(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT0("media,gpu", "H264VaapiVideoDecoderDelegate::SubmitDecode");
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (IsEncryptedSession() && !full_sample_ &&
!vaapi_wrapper_->SubmitBuffer(VAEncryptionParameterBufferType,
sizeof(crypto_params_), &crypto_params_)) {
return DecodeStatus::kFail;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const VaapiH264Picture* vaapi_pic = pic->AsVaapiH264Picture();
const bool success = vaapi_wrapper_->ExecuteAndDestroyPendingBuffers(
vaapi_pic->va_surface_id());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
encryption_segment_info_.clear();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (!success && NeedsProtectedSessionRecovery())
return DecodeStatus::kTryAgain;
@ -623,9 +623,9 @@ bool H264VaapiVideoDecoderDelegate::OutputPicture(
void H264VaapiVideoDecoderDelegate::Reset() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
encryption_segment_info_.clear();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
vaapi_wrapper_->DestroyPendingBuffers();
}

@ -9,7 +9,6 @@
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/h264_decoder.h"
#include "media/gpu/vaapi/vaapi_video_decoder_delegate.h"
#include "media/parsers/h264_parser.h"
@ -76,7 +75,7 @@ class H264VaapiVideoDecoderDelegate : public H264Decoder::H264Accelerator,
private:
void FillVAPicture(VAPictureH264* va_pic, scoped_refptr<H264Picture> pic);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// We need to hold onto this memory here because it's referenced by the
// mapped buffer in libva across calls. It is filled in SubmitSlice() and
// stays alive until SubmitDecode() or Reset().
@ -86,7 +85,7 @@ class H264VaapiVideoDecoderDelegate : public H264Decoder::H264Accelerator,
// We need to retain this for the multi-slice case since that will aggregate
// the encryption details across all the slices.
VAEncryptionParameters crypto_params_ GUARDED_BY_CONTEXT(sequence_checker_);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// We need to set this so we don't resubmit crypto params on decode.
bool full_sample_ GUARDED_BY_CONTEXT(sequence_checker_);

@ -9,7 +9,7 @@
#include "media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/base/cdm_context.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/vaapi_common.h"
@ -94,9 +94,9 @@ DecodeStatus H265VaapiVideoDecoderDelegate::SubmitFrameMetadata(
VAPictureParameterBufferHEVC pic_param;
memset(&pic_param, 0, sizeof(pic_param));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
memset(&crypto_params_, 0, sizeof(crypto_params_));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
int highest_tid = sps->sps_max_sub_layers_minus1;
#define FROM_SPS_TO_PP(a) pic_param.a = sps->a
@ -341,7 +341,7 @@ DecodeStatus H265VaapiVideoDecoderDelegate::SubmitSlice(
return DecodeStatus::kFail;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (IsEncryptedSession()) {
const ProtectedSessionState state =
SetupDecryptDecode(/*full_sample=*/false, size, &crypto_params_,
@ -354,7 +354,7 @@ DecodeStatus H265VaapiVideoDecoderDelegate::SubmitSlice(
return DecodeStatus::kTryAgain;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
memset(&slice_param_, 0, sizeof(slice_param_));
slice_param_.slice_data_size = slice_hdr->nalu_size;
@ -474,10 +474,10 @@ DecodeStatus H265VaapiVideoDecoderDelegate::SubmitSlice(
SHDR_TO_SP(five_minus_max_num_merge_cand);
// TODO(jkardatzke): Remove this guard once Chrome has libva uprev'd to 2.6.0.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
slice_param_.slice_data_num_emu_prevn_bytes =
slice_hdr->header_emulation_prevention_bytes;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (IsTranscrypted()) {
// We use the encrypted region of the data as the actual slice data.
@ -505,21 +505,21 @@ DecodeStatus H265VaapiVideoDecoderDelegate::SubmitDecode(
return DecodeStatus::kFail;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (IsEncryptedSession() &&
!vaapi_wrapper_->SubmitBuffer(VAEncryptionParameterBufferType,
sizeof(crypto_params_), &crypto_params_)) {
return DecodeStatus::kFail;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const VaapiH265Picture* vaapi_pic = pic->AsVaapiH265Picture();
const bool success = vaapi_wrapper_->ExecuteAndDestroyPendingBuffers(
vaapi_pic->va_surface_id());
ref_pic_list_pocs_.clear();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
encryption_segment_info_.clear();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (!success && NeedsProtectedSessionRecovery())
return DecodeStatus::kTryAgain;
@ -544,9 +544,9 @@ void H265VaapiVideoDecoderDelegate::Reset() {
DETACH_FROM_SEQUENCE(sequence_checker_);
vaapi_wrapper_->DestroyPendingBuffers();
ref_pic_list_pocs_.clear();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
encryption_segment_info_.clear();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
drop_frame_ = false;
last_slice_data_ = nullptr;
last_slice_size_ = 0;

@ -9,7 +9,6 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/h265_decoder.h"
#include "media/gpu/h265_dpb.h"
#include "media/gpu/vaapi/vaapi_video_decoder_delegate.h"
@ -103,7 +102,7 @@ class H265VaapiVideoDecoderDelegate : public H265Decoder::H265Accelerator,
// (RASL frame). This is updated every SubmitFrameMetadata().
bool drop_frame_ = false;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// We need to hold onto this memory here because it's referenced by the
// mapped buffer in libva across calls. It is filled in SubmitSlice() and
// stays alive until SubmitDecode() or Reset().
@ -112,7 +111,7 @@ class H265VaapiVideoDecoderDelegate : public H265Decoder::H265Accelerator,
// We need to retain this for the multi-slice case since that will aggregate
// the encryption details across all the slices.
VAEncryptionParameters crypto_params_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
};
} // namespace media

@ -16,7 +16,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/gpu/vaapi/test/av1_decoder.h"
#include "media/gpu/vaapi/test/h264_decoder.h"
#include "media/gpu/vaapi/test/shared_va_surface.h"
@ -46,7 +46,7 @@ using media::vaapi_test::Vp9Decoder;
using media_gpu_vaapi::InitializeStubs;
using media_gpu_vaapi::kModuleVa;
using media_gpu_vaapi::kModuleVa_drm;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
using media_gpu_vaapi::kModuleVa_prot;
#endif
using media_gpu_vaapi::StubPathMap;
@ -252,7 +252,7 @@ int main(int argc, char** argv) {
const std::string va_suffix(base::NumberToString(VA_MAJOR_VERSION + 1));
paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix);
paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
paths[kModuleVa_prot].push_back(std::string("libva.so.") + va_suffix);
#endif
if (!InitializeStubs(paths)) {

@ -26,7 +26,7 @@
#include "media/gpu/vaapi/va_stubs.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
using media_gpu_vaapi::kModuleVa_prot;
#endif
@ -713,7 +713,7 @@ int main(int argc, char** argv) {
paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix);
paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
paths[kModuleVa_prot].push_back(std::string("libva.so.") + va_suffix);
#endif

@ -9,11 +9,11 @@
#include "media/gpu/vaapi/test/h265_vaapi_wrapper.h"
#include "build/chromeos_buildflags.h"
#include <va/va.h>
#include "build/build_config.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/test/macros.h"
#include <va/va.h>
namespace media {
namespace {
@ -445,10 +445,10 @@ bool H265VaapiWrapper::SubmitSlice(
SHDR_TO_SP(five_minus_max_num_merge_cand);
// TODO(jchinlee): Remove this guard once Chrome has libva uprev'd to 2.6.0.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
slice_param_.slice_data_num_emu_prevn_bytes =
slice_hdr->header_emulation_prevention_bytes;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
last_slice_data_.assign(data, data + size);
return true;

@ -24,14 +24,14 @@
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/gpu_memory_buffer.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "media/gpu/test/local_gpu_memory_buffer_manager.h"
#endif
namespace media {
namespace vaapi_test_utils {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
namespace {
@ -128,7 +128,7 @@ std::string TestParamToString(
return param_info.param.test_name;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
DecodedImage ScopedVAImageToDecodedImage(const ScopedVAImage* scoped_va_image) {
DecodedImage decoded_image{};

@ -12,7 +12,7 @@
#include <string>
#include "base/memory/raw_ptr.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_pixmap_handle.h"
@ -54,7 +54,7 @@ struct DecodedImage {
// the same decoded result.
DecodedImage ScopedVAImageToDecodedImage(const ScopedVAImage* scoped_va_image);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<DecodedImage> NativePixmapToDecodedImage(
gfx::NativePixmapHandle& handle,
const gfx::Size& size,

@ -4,7 +4,6 @@
#include "media/gpu/vaapi/vaapi_common.h"
#include "build/chromeos_buildflags.h"
namespace media {

@ -4,7 +4,6 @@
#ifndef MEDIA_GPU_VAAPI_VAAPI_COMMON_H_
#define MEDIA_GPU_VAAPI_VAAPI_COMMON_H_
#include "build/chromeos_buildflags.h"
#include "media/gpu/av1_picture.h"
#include "media/gpu/h264_dpb.h"
#include "media/gpu/vaapi/vaapi_utils.h"

@ -18,7 +18,6 @@
#include "base/task/thread_pool.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/format_utils.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
@ -194,7 +193,7 @@ void VaapiImageProcessorBackend::ProcessFrame(
}
bool use_protected = false;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VAProtectedSessionID va_protected_session_id = VA_INVALID_ID;
if (input_frame->metadata().hw_va_protected_session_id.has_value()) {
static_assert(
@ -208,7 +207,7 @@ void VaapiImageProcessorBackend::ProcessFrame(
input_frame->metadata().hw_va_protected_session_id.value();
use_protected = va_protected_session_id != VA_INVALID_ID;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (needs_context_ && !vaapi_wrapper_->CreateContext(gfx::Size())) {
VLOGF(1) << "Failed to create context for VPP";
@ -237,12 +236,12 @@ void VaapiImageProcessorBackend::ProcessFrame(
dst_va_surface->id(), dst_va_surface->size(),
input_frame->visible_rect(),
output_frame->visible_rect()
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
va_protected_session_id
#endif
)) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (use_protected &&
vaapi_wrapper_->IsProtectedSessionDead(va_protected_session_id)) {
DCHECK_NE(va_protected_session_id, VA_INVALID_ID);
@ -258,7 +257,7 @@ void VaapiImageProcessorBackend::ProcessFrame(
std::move(cb).Run(std::move(output_frame));
return;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
error_cb_.Run();
return;
}

@ -38,7 +38,6 @@
#include "base/test/scoped_feature_list.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media_switches.h"
#include "media/base/platform_features.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
@ -419,7 +418,7 @@ TEST_F(VaapiTest, VbrAndCbrResolutionsMatch) {
}
#if BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Verifies that VAProfileProtected is indeed supported by the command line
// vainfo utility.
TEST_F(VaapiTest, VaapiProfileProtected) {
@ -437,7 +436,7 @@ TEST_F(VaapiTest, VaapiProfileProtected) {
EXPECT_EQ(impl, VAImplementation::kMesaGallium);
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#endif // BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
// Verifies that if JPEG decoding and encoding are supported by VaapiWrapper,
@ -522,8 +521,8 @@ TEST_F(VaapiTest, TooManyDecoderInstances) {
// Verifies that VaapiWrapper::Create...() fails when an EncryptionScheme is
// specified for a non-protected CodecMode.
TEST_F(VaapiTest, EncryptionSchemeNeedsCodecMode) {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
GTEST_SKIP() << "This test only applies to Chrome Ash builds.";
#if !BUILDFLAG(IS_CHROMEOS)
GTEST_SKIP() << "This test only applies to ChromeOS builds.";
#else
std::map<VAProfile, std::vector<VAEntrypoint>> configurations =
VaapiWrapper::GetSupportedConfigurationsForCodecModeForTesting(

@ -16,7 +16,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/synchronization/lock.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/gpu/vaapi/vaapi_common.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
#include "media/gpu/vp8_picture.h"
@ -394,11 +394,11 @@ void FillVP8DataStructures(const Vp8FrameHeader& frame_header,
bool IsValidVABufferType(VABufferType type) {
return type < VABufferTypeMax ||
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(jkardatzke): Remove this once we update to libva 2.0.10 in
// ChromeOS.
type == VAEncryptionParameterBufferType ||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
type == VACencStatusParameterBufferType;
}

@ -21,7 +21,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/format_utils.h"
#include "media/base/media_log.h"
@ -47,13 +46,13 @@
#include "media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h"
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including these headers will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h" // nogncheck
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h" // nogncheck
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -207,7 +206,7 @@ void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
// don't want |decoder_| to have a dangling pointer. We also destroy
// |cdm_event_cb_registration_| before |cdm_context_ref_| so that we have a
// CDM at the moment of destroying the callback registration.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
cdm_event_cb_registration_ = nullptr;
#endif
cdm_context_ref_ = nullptr;
@ -224,7 +223,7 @@ void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
DCHECK(output_frames_.empty());
if (config.is_encrypted()) {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
SetErrorState("encrypted content is not supported");
std::move(init_cb).Run(DecoderStatus::Codes::kUnsupportedEncryptionMode);
return;
@ -237,9 +236,6 @@ void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool encrypted_av1_support = false;
#if BUILDFLAG(USE_CHROMEOS_PROTECTED_AV1)
encrypted_av1_support = true;
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
encrypted_av1_support = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLacrosUseChromeosProtectedAv1);
#endif
if (config.codec() != VideoCodec::kH264 &&
config.codec() != VideoCodec::kVP9 &&
@ -264,7 +260,7 @@ void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
const VideoCodecProfile profile = config.profile();
if (!IsConfiguredForTesting()) {
auto vaapi_wrapper_or_error = VaapiWrapper::CreateForVideoCodec(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
(!cdm_context_ref_ || transcryption_) ? VaapiWrapper::kDecode
: VaapiWrapper::kDecodeProtected,
#else
@ -436,7 +432,7 @@ void VaapiVideoDecoder::HandleDecodeTask() {
// If we have lost our protected HW session, it should be recoverable, so
// indicate that we have lost our decoder state so it can be reloaded.
if (decoder_delegate_->HasInitiatedProtectedRecovery()) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// We only do the VAContext recreation for Chrome playback because there
// is no mechanism in ARC to re-seek so we would end up using invalid
// reference frames.
@ -460,7 +456,7 @@ void VaapiVideoDecoder::HandleDecodeTask() {
return;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
waiting_cb_.Run(WaitingReason::kDecoderStateLost);
}
break;
@ -588,7 +584,7 @@ void VaapiVideoDecoder::SurfaceReady(VASurfaceID va_surface_id,
frame = std::move(wrapped_frame);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (cdm_context_ref_ && !transcryption_) {
// Store the VA-API protected session ID so that it can be re-used for
// scaling the decoded video frame later in the pipeline.
@ -603,7 +599,7 @@ void VaapiVideoDecoder::SurfaceReady(VASurfaceID va_surface_id,
"does not match the type exposed by VaapiWrapper");
frame->metadata().hw_va_protected_session_id = va_protected_session_id;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const auto gfx_color_space = color_space.ToGfxColorSpace();
if (gfx_color_space.IsValid())
@ -631,7 +627,7 @@ void VaapiVideoDecoder::ApplyResolutionChange() {
// protected content requires overlays currently.
// NOTE: Only use this for protected content as other requirements for using
// it are tied to protected content.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
cdm_context_ref_->GetCdmContext()
->GetChromeOsCdmContext()
->GetScreenResolutions(
@ -757,7 +753,7 @@ void VaapiVideoDecoder::ApplyResolutionChangeWithScreenSizes(
profile_ = decoder_->GetProfile();
auto new_vaapi_wrapper =
VaapiWrapper::CreateForVideoCodec(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
(!cdm_context_ref_ || transcryption_)
? VaapiWrapper::kDecode
: VaapiWrapper::kDecodeProtected,
@ -791,13 +787,6 @@ void VaapiVideoDecoder::ApplyResolutionChangeWithScreenSizes(
{.fourcc = *format_fourcc,
.size = decoder_pic_size,
.modifier = gfx::NativePixmapHandle::kNoModifier}};
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
std::optional<DmabufVideoFramePool::CreateFrameCB> allocator = std::nullopt;
std::vector<ImageProcessor::PixelLayoutCandidate> candidates = {
{.fourcc = *format_fourcc,
.size = decoder_pic_size,
.modifier = gfx::NativePixmapHandle::kNoModifier}};
#else
std::optional<DmabufVideoFramePool::CreateFrameCB> allocator = std::nullopt;
@ -957,7 +946,7 @@ bool VaapiVideoDecoder::NeedsTranscryption() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(state_ == State::kWaitingForInput);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// We do not need to invoke transcryption if this is coming from a remote CDM
// since it will already have been done.
if (cdm_context_ref_ &&
@ -967,7 +956,7 @@ bool VaapiVideoDecoder::NeedsTranscryption() {
->IsRemoteCdm()) {
return false;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
return transcryption_;
}

@ -22,7 +22,6 @@
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "media/base/callback_registry.h"
#include "media/base/cdm_context.h"
#include "media/base/status.h"
@ -272,7 +271,7 @@ class VaapiVideoDecoder : public VideoDecoderMixin,
EncryptionScheme encryption_scheme_ GUARDED_BY_CONTEXT(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// To keep the CdmContext event callback registered.
std::unique_ptr<CallbackRegistration> cdm_event_cb_registration_
GUARDED_BY_CONTEXT(sequence_checker_);

@ -11,14 +11,14 @@
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/base/cdm_context.h"
#include "media/gpu/vaapi/vaapi_decode_surface_handler.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// gn check does not account for BUILDFLAG(), so including these headers will
// make gn check fail for builds other than ash-chrome. See gn help nogncheck
// make gn check fail for builds other than ChromeOS. See gn help nogncheck
// for more information.
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h" // nogncheck
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h" // nogncheck
@ -34,7 +34,7 @@ void ctr128_inc64(uint8_t* counter) {
}
} // namespace
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -54,10 +54,10 @@ VaapiVideoDecoderDelegate::VaapiVideoDecoderDelegate(
DCHECK(vaapi_wrapper_);
DCHECK(vaapi_dec_);
DETACH_FROM_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (cdm_context)
chromeos_cdm_context_ = cdm_context->GetChromeOsCdmContext();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
transcryption_ = cdm_context && VaapiWrapper::GetImplementationType() ==
VAImplementation::kMesaGallium;
}
@ -101,7 +101,7 @@ bool VaapiVideoDecoderDelegate::SetDecryptConfig(
return true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VaapiVideoDecoderDelegate::ProtectedSessionState
VaapiVideoDecoderDelegate::SetupDecryptDecode(
bool full_sample,
@ -245,7 +245,7 @@ VaapiVideoDecoderDelegate::SetupDecryptDecode(
crypto_params->segment_info = &segments->front();
return protected_session_state_;
}
#endif // if BUILDFLAG(IS_CHROMEOS_ASH)
#endif // if BUILDFLAG(IS_CHROMEOS)
bool VaapiVideoDecoderDelegate::NeedsProtectedSessionRecovery() {
if (!IsEncryptedSession() || !vaapi_wrapper_->IsProtectedSessionDead() ||
@ -334,7 +334,7 @@ void VaapiVideoDecoderDelegate::RecoverProtectedSession() {
protected_session_state_ = ProtectedSessionState::kNeedsRecovery;
hw_key_data_map_.clear();
hw_identifier_.clear();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
CHECK(chromeos_cdm_context_);
// ARC will not re-seek, so we cannot do the VAContext recreation for it.
if (!chromeos_cdm_context_->UsingArcCdm()) {
@ -349,7 +349,7 @@ void VaapiVideoDecoderDelegate::RecoverProtectedSession() {
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindRepeating(on_protected_session_update_cb_, true));
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
} // namespace media

@ -17,17 +17,17 @@
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/base/decryptor.h"
#include "media/base/encryption_scheme.h"
#include "media/base/subsample_entry.h"
#include "third_party/libva_protected_content/va_protected_content.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
namespace chromeos {
class ChromeOsCdmContext;
} // namespace chromeos
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -93,14 +93,14 @@ class VaapiVideoDecoderDelegate {
// |subsamples| is for the current slice. |size| is the size of the slice
// data. This should be called if IsEncrypted() is true even if the current
// data is not encrypted (i.e. |subsamples| is empty).
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ProtectedSessionState SetupDecryptDecode(
bool full_sample,
size_t size,
VAEncryptionParameters* crypto_params,
std::vector<VAEncryptionSegmentInfo>* segments,
const std::vector<SubsampleEntry>& subsamples);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Returns true if we are handling encrypted content, in which case
// SetupDecryptDecode() should be called for every slice. This is specifically
@ -147,11 +147,11 @@ class VaapiVideoDecoderDelegate {
// All members below pertain to protected content playback.
ProtectedSessionUpdateCB on_protected_session_update_cb_;
EncryptionScheme encryption_scheme_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Not owned.
raw_ptr<chromeos::ChromeOsCdmContext> chromeos_cdm_context_ = nullptr;
EncryptionScheme last_used_encryption_scheme_{EncryptionScheme::kUnencrypted};
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
ProtectedSessionState protected_session_state_;
std::unique_ptr<DecryptConfig> decrypt_config_;
std::vector<uint8_t> hw_identifier_;

@ -4,16 +4,13 @@
#include "media/gpu/vaapi/vaapi_video_decoder.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#error This file should only be built for Ash.
#endif
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/thread_pool.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "chromeos/components/cdm_factory_daemon/chromeos_cdm_context.h"
#include "media/base/media_util.h"
#include "media/base/mock_filters.h"
@ -25,6 +22,9 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
static_assert(BUILDFLAG(IS_CHROMEOS),
"This file should only be built for ChromeOS.");
using base::test::RunClosure;
using ::testing::_;
using ::testing::ByMove;

@ -14,7 +14,7 @@
#include "base/run_loop.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/task_environment.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/base/media_util.h"
#include "media/base/mock_media_log.h"
#include "media/base/video_frame.h"
@ -198,7 +198,7 @@ class MockVaapiWrapper : public VaapiWrapper {
const gfx::Size& va_surface_dst_size,
std::optional<gfx::Rect> src_rect = std::nullopt,
std::optional<gfx::Rect> dest_rect = std::nullopt
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
VAProtectedSessionID va_protected_session_id = VA_INVALID_ID
#endif

@ -50,7 +50,6 @@
#include "base/trace_event/trace_event.h"
#include "base/version.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/platform_features.h"
@ -73,7 +72,7 @@
#include "ui/gfx/native_pixmap.h"
#include "ui/gfx/native_pixmap_handle.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include <va/va_prot.h>
using media_gpu_vaapi::kModuleVa_prot;
#endif
@ -639,7 +638,7 @@ bool IsLowPowerIntelProcessor() {
bool IsModeDecoding(VaapiWrapper::CodecMode mode) {
return mode == VaapiWrapper::CodecMode::kDecode
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
|| VaapiWrapper::CodecMode::kDecodeProtected
#endif
;
@ -750,7 +749,7 @@ bool IsVAProfileSupported(VAProfile va_profile, bool is_encoding) {
if (va_profile == VAProfileJPEGBaseline) {
return true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_profile == VAProfileProtected) {
return true;
}
@ -863,16 +862,17 @@ std::vector<VAEntrypoint> GetEntryPointsForProfile(const base::Lock* va_lock,
va_entrypoints.resize(num_va_entrypoints);
const std::vector<VAEntrypoint> kAllowedEntryPoints[] = {
{VAEntrypointVLD}, // kDecode.
#if BUILDFLAG(IS_CHROMEOS_ASH)
{VAEntrypointVLD, VAEntrypointProtectedContent}, // kDecodeProtected.
{VAEntrypointVLD}, // kDecode.
#if BUILDFLAG(IS_CHROMEOS)
{VAEntrypointVLD, VAEntrypointProtectedContent}, // kDecodeProtected.
#endif
{VAEntrypointEncSlice, VAEntrypointEncPicture,
VAEntrypointEncSliceLP}, // kEncodeConstantBitrate.
{VAEntrypointEncSlice,
VAEntrypointEncSliceLP}, // kEncodeConstantQuantizationParameter.
{VAEntrypointEncSlice, VAEntrypointEncSliceLP}, // kEncodeVariableBitrate.
{VAEntrypointVideoProc} // kVideoProcess.
{VAEntrypointEncSlice, VAEntrypointEncPicture,
VAEntrypointEncSliceLP}, // kEncodeConstantBitrate.
{VAEntrypointEncSlice,
VAEntrypointEncSliceLP}, // kEncodeConstantQuantizationParameter.
{VAEntrypointEncSlice,
VAEntrypointEncSliceLP}, // kEncodeVariableBitrate.
{VAEntrypointVideoProc} // kVideoProcess.
};
static_assert(std::size(kAllowedEntryPoints) == VaapiWrapper::kCodecModeMax,
"");
@ -900,7 +900,7 @@ bool GetRequiredAttribs(const base::Lock* va_lock,
if (profile == VAProfileVP9Profile2 || profile == VAProfileVP9Profile3) {
required_attribs->push_back(
{VAConfigAttribRTFormat, VA_RT_FORMAT_YUV420_10BPP});
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
} else if (profile == VAProfileProtected) {
DCHECK_EQ(mode, VaapiWrapper::kDecodeProtected);
constexpr int kWidevineUsage = 0x1;
@ -917,7 +917,7 @@ bool GetRequiredAttribs(const base::Lock* va_lock,
required_attribs->push_back({VAConfigAttribRTFormat, VA_RT_FORMAT_YUV420});
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (mode == VaapiWrapper::kDecodeProtected && profile != VAProfileProtected) {
required_attribs->push_back(
{VAConfigAttribEncryption, VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR});
@ -1111,15 +1111,14 @@ void VASupportedProfiles::FillSupportedProfileInfos(
GetSupportedVAProfiles(va_lock, va_display);
constexpr VaapiWrapper::CodecMode kWrapperModes[] = {
VaapiWrapper::kDecode,
#if BUILDFLAG(IS_CHROMEOS_ASH)
VaapiWrapper::kDecodeProtected,
VaapiWrapper::kDecode,
#if BUILDFLAG(IS_CHROMEOS)
VaapiWrapper::kDecodeProtected,
#endif
VaapiWrapper::kEncodeConstantBitrate,
VaapiWrapper::kEncodeConstantQuantizationParameter,
VaapiWrapper::kEncodeVariableBitrate,
VaapiWrapper::kVideoProcess
};
VaapiWrapper::kEncodeConstantBitrate,
VaapiWrapper::kEncodeConstantQuantizationParameter,
VaapiWrapper::kEncodeVariableBitrate,
VaapiWrapper::kVideoProcess};
static_assert(std::size(kWrapperModes) == VaapiWrapper::kCodecModeMax, "");
for (VaapiWrapper::CodecMode mode : kWrapperModes) {
@ -1186,7 +1185,7 @@ bool VASupportedProfiles::FillProfileInfo_Locked(
}
};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Nothing further to query for protected profile.
if (va_profile == VAProfileProtected) {
profile_info->va_profile = va_profile;
@ -1620,22 +1619,6 @@ bool VADisplayStateSingleton::Initialize() {
CHECK(runtime_version.IsValid());
const base::Version build_time_version({VA_MAJOR_VERSION, VA_MINOR_VERSION});
CHECK(build_time_version.IsValid());
#if BUILDFLAG(IS_CHROMEOS_LACROS)
if (IsGen11Gpu()) {
// Jasperlake devices run with pinned libva driver (VA-API version 1.15)
// due to b/303841978.
// Relax the VA-API version check so Lacros does not fall back to
// software encoding on these devices by hardcoding the minor version number
// to be 15 instead of the actual (higher) one.
// TODO(b/303841978): go back to using the actual minor version number
// when libva is upreved in Jasperlake devices.
const base::Version jsl_build_version({VA_MAJOR_VERSION, 15});
CHECK(jsl_build_version.IsValid());
if (!IsLibVACompatible(runtime_version, jsl_build_version)) {
return false;
}
} else
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
if (!IsLibVACompatible(runtime_version, build_time_version)) {
return false;
}
@ -1714,7 +1697,7 @@ base::expected<scoped_refptr<VaapiWrapper>, DecoderStatus> VaapiWrapper::Create(
DVLOG(1) << "Unsupported va_profile: " << vaProfileStr(va_profile);
return base::unexpected(DecoderStatus::Codes::kUnsupportedProfile);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// In protected decode |mode| we need to ensure that |va_profile| is supported
// (which we verified above) and that VAProfileProtected is supported, which
// we check here.
@ -2088,7 +2071,7 @@ VAEntrypoint VaapiWrapper::GetDefaultVaEntryPoint(CodecMode mode,
switch (mode) {
case VaapiWrapper::kDecode:
return VAEntrypointVLD;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
case VaapiWrapper::kDecodeProtected:
if (profile == VAProfileProtected)
return VAEntrypointProtectedContent;
@ -2187,7 +2170,7 @@ bool VaapiWrapper::CreateProtectedSession(
const std::vector<uint8_t>& hw_config,
std::vector<uint8_t>* hw_identifier_out) {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
DCHECK_EQ(va_protected_config_id_, VA_INVALID_ID);
DCHECK_EQ(va_protected_session_id_, VA_INVALID_ID);
DCHECK(hw_identifier_out);
@ -2290,14 +2273,14 @@ bool VaapiWrapper::CreateProtectedSession(
bool VaapiWrapper::IsProtectedSessionDead() {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return IsProtectedSessionDead(va_protected_session_id_);
#else
return false;
#endif
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
bool VaapiWrapper::IsProtectedSessionDead(
VAProtectedSessionID va_protected_session_id) {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@ -2331,7 +2314,7 @@ bool VaapiWrapper::IsProtectedSessionDead(
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VAProtectedSessionID VaapiWrapper::GetProtectedSessionID() const {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return va_protected_session_id_;
@ -2340,7 +2323,7 @@ VAProtectedSessionID VaapiWrapper::GetProtectedSessionID() const {
void VaapiWrapper::DestroyProtectedSession() {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_protected_session_id_ == VA_INVALID_ID)
return;
base::AutoLockMaybe auto_lock(va_lock_.get());
@ -2911,7 +2894,7 @@ std::unique_ptr<ScopedVABuffer> VaapiWrapper::CreateVABuffer(VABufferType type,
base::AutoLockMaybe auto_lock(va_lock_.get());
TRACE_EVENT2("media,gpu", "VaapiWrapper::CreateVABufferLocked", "type", type,
"size", size);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
VAContextID context_id = type == VAProtectedSessionExecuteBufferType
? va_protected_session_id_
: va_context_id_;
@ -3078,7 +3061,7 @@ bool VaapiWrapper::BlitSurface(VASurfaceID va_surface_src_id,
const gfx::Size& va_surface_dst_size,
std::optional<gfx::Rect> src_rect,
std::optional<gfx::Rect> dest_rect
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
VAProtectedSessionID va_protected_session_id
#endif
@ -3147,7 +3130,7 @@ bool VaapiWrapper::BlitSurface(VASurfaceID va_surface_src_id,
pipeline_param->rotation_state = VA_ROTATION_NONE;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_protected_session_id != VA_INVALID_ID) {
const VAStatus va_res = vaAttachProtectedSession(
va_display_, va_context_id_, va_protected_session_id);
@ -3164,7 +3147,7 @@ bool VaapiWrapper::BlitSurface(VASurfaceID va_surface_src_id,
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
vaDetachProtectedSession(va_display_, va_context_id_);
};
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TRACE_EVENT2("media,gpu", "VaapiWrapper::BlitSurface", "src_rect",
src_rect->ToString(), "dest_rect", dest_rect->ToString());
@ -3196,7 +3179,7 @@ void VaapiWrapper::PreSandboxInitialization(bool allow_disabling_global_lock) {
paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix);
paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
paths[kModuleVa_prot].push_back(std::string("libva.so.") + va_suffix);
#endif
@ -3260,7 +3243,7 @@ bool VaapiWrapper::Initialize(VAProfile va_profile,
}
#endif // DCHECK_IS_ON()
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (encryption_scheme != EncryptionScheme::kUnencrypted &&
mode_ != kDecodeProtected) {
return false;
@ -3276,7 +3259,7 @@ bool VaapiWrapper::Initialize(VAProfile va_profile,
return false;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (encryption_scheme != EncryptionScheme::kUnencrypted) {
DCHECK(!required_attribs.empty());
// We need to adjust the attribute for encryption scheme.
@ -3288,7 +3271,7 @@ bool VaapiWrapper::Initialize(VAProfile va_profile,
}
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const VAStatus va_res =
vaCreateConfig(va_display_, va_profile, entrypoint,
@ -3305,7 +3288,7 @@ void VaapiWrapper::Deinitialize() {
VAAPI_CHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
{
base::AutoLockMaybe auto_lock(va_lock_.get());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_protected_session_id_ != VA_INVALID_ID) {
VAStatus va_res =
vaDestroyProtectedSession(va_display_, va_protected_session_id_);
@ -3318,7 +3301,7 @@ void VaapiWrapper::Deinitialize() {
const VAStatus va_res = vaDestroyConfig(va_display_, va_config_id_);
VA_LOG_ON_ERROR(va_res, VaapiFunctions::kVADestroyConfig);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
va_protected_session_id_ = VA_INVALID_ID;
va_protected_config_id_ = VA_INVALID_ID;
#endif
@ -3349,7 +3332,7 @@ void VaapiWrapper::DestroyContext() {
DVLOG(2) << "Destroying context";
if (va_context_id_ != VA_INVALID_ID) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_protected_session_id_ != VA_INVALID_ID) {
const VAStatus va_res =
vaDetachProtectedSession(va_display_, va_context_id_);
@ -3625,7 +3608,7 @@ bool VaapiWrapper::MaybeAttachProtectedSession_Locked() {
MAYBE_ASSERT_ACQUIRED(va_lock_);
if (va_context_id_ == VA_INVALID_ID)
return true;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (va_protected_session_id_ == VA_INVALID_ID)
return true;

@ -29,7 +29,7 @@
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "base/types/expected.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/vaapi/vaapi_utils.h"
@ -165,7 +165,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
enum CodecMode {
kDecode,
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// NOTE: A kDecodeProtected VaapiWrapper is created using the actual video
// profile and an extra VAProfileProtected, each with some special added
// VAConfigAttribs. Then when CreateProtectedSession() is called, it will
@ -351,7 +351,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// querying libva indicates that our protected session is no longer alive,
// otherwise this will return false.
bool IsProtectedSessionDead();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Returns true if and only if |va_protected_session_id| is not VA_INVALID_ID
// and querying libva indicates that the protected session identified by
// |va_protected_session_id| is no longer alive.
@ -575,7 +575,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
const gfx::Size& va_surface_dst_size,
std::optional<gfx::Rect> src_rect = std::nullopt,
std::optional<gfx::Rect> dest_rect = std::nullopt
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
VAProtectedSessionID va_protected_session_id = VA_INVALID_ID
#endif
@ -728,7 +728,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
std::unique_ptr<ScopedVABuffer> va_buffer_for_vpp_
GUARDED_BY_CONTEXT(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// For protected decode mode.
VAConfigID va_protected_config_id_ GUARDED_BY_CONTEXT(sequence_checker_){
VA_INVALID_ID};

@ -14,7 +14,7 @@
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/vaapi_common.h"
#include "media/gpu/vaapi/vaapi_decode_surface_handler.h"
@ -80,7 +80,7 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
return DecodeStatus::kFail;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const DecryptConfig* decrypt_config = pic->decrypt_config();
if (decrypt_config && !SetDecryptConfig(decrypt_config->Clone()))
return DecodeStatus::kFail;
@ -110,7 +110,7 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
return DecodeStatus::kFail;
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
pic_param.frame_width = base::checked_cast<uint16_t>(frame_hdr->frame_width);
pic_param.frame_height =
@ -209,7 +209,7 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
{picture_params_->type(), picture_params_->size(), &pic_param}},
{slice_params_->id(),
{slice_params_->type(), slice_params_->size(), &slice_param}}};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<uint8_t[]> protected_vp9_data;
std::string amd_decrypt_params;
if (IsTranscrypted()) {
@ -263,7 +263,7 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
{encoded_data->type(), encoded_data->size(),
protected_vp9_data.get()}});
} else {
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
encoded_data = vaapi_wrapper_->CreateVABuffer(VASliceDataBufferType,
frame_hdr->data.size());
if (!encoded_data)
@ -271,14 +271,14 @@ DecodeStatus VP9VaapiVideoDecoderDelegate::SubmitDecode(
buffers.push_back(
{encoded_data->id(),
{encoded_data->type(), encoded_data->size(), frame_hdr->data.data()}});
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
}
if (uses_crypto) {
buffers.push_back(
{crypto_params_->id(),
{crypto_params_->type(), crypto_params_->size(), &crypto_param}});
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
const VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture();
const bool success =

@ -10,7 +10,6 @@
#include "base/functional/bind.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/platform_features.h"

@ -5,7 +5,6 @@
import("//build/config/cast.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
@ -29,11 +28,11 @@ is_cast_media_device = is_castos || is_cast_android
#
# TODO(b/195769334): finish replacing usages of (is_linux || is_chromeos) with
# allow_oop_video_decoder where appropriate. Also, finish replacing usages of
# (is_linux || is_chromeos_ash) with allow_hosting_oop_video_decoder where
# (is_linux || is_chromeos) with allow_hosting_oop_video_decoder where
# appropriate.
allow_hosting_oop_video_decoder =
(is_chromeos_ash || is_linux) && (use_vaapi || use_v4l2_codec)
allow_oop_video_decoder = is_chromeos_lacros || allow_hosting_oop_video_decoder
(is_chromeos || is_linux) && (use_vaapi || use_v4l2_codec)
allow_oop_video_decoder = allow_hosting_oop_video_decoder
declare_args() {
# Allows distributions to link pulseaudio directly (DT_NEEDED) instead of
@ -132,8 +131,8 @@ declare_args() {
# Determines if a GpuChannel is needed between media capture utility process
# and gpu process for a given platform.
enable_gpu_channel_media_capture = is_linux || is_win || is_chromeos_ash ||
is_apple || is_android || is_fuchsia
enable_gpu_channel_media_capture =
is_linux || is_win || is_chromeos || is_apple || is_android || is_fuchsia
}
# Use another declare_args() to allow dependence on args defined above.
@ -143,12 +142,12 @@ declare_args() {
enable_av1_decoder = enable_dav1d_decoder
# Enable HEVC/H265 demuxing. Actual decoding must be provided by the
# platform. Always enable this for Lacros, it determines support at runtime.
# platform.
# TODO(crbug.com/1336055): Revisit the default value for this setting as it
# applies to video-capable devices.
enable_platform_hevc =
proprietary_codecs && (enable_hevc_parser_and_hw_decoder ||
is_cast_media_device || is_chromeos_lacros)
proprietary_codecs &&
(enable_hevc_parser_and_hw_decoder || is_cast_media_device)
enable_mse_mpeg2ts_stream_parser =
proprietary_codecs &&
@ -296,8 +295,7 @@ if (is_cast_media_device) {
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_chromeos_ash || ((is_linux || is_chromeos_lacros) &&
(use_vaapi || use_v4l2_codec))) {
} else if (is_chromeos || (is_linux && (use_vaapi || use_v4l2_codec))) {
_default_mojo_media_services = [ "video_decoder" ]
_default_mojo_media_host = "gpu"
}

@ -3,7 +3,6 @@
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/media_options.gni")

@ -94,7 +94,6 @@ source_set("clients") {
]
deps = [
"//build:chromeos_buildflags",
"//media/gpu",
"//media/mojo/common",
"//services/service_manager/public/cpp",

@ -5,7 +5,6 @@
#include "media/mojo/clients/mojo_video_decoder.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
@ -18,7 +17,6 @@
#include "base/trace_event/trace_event.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_switches.h"
@ -123,12 +121,6 @@ bool MojoVideoDecoder::SupportsDecryption() const {
// Currently only the Android backends and specific ChromeOS configurations
// support decryption.
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
#if BUILDFLAG(IS_CHROMEOS_LACROS)
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLacrosUseChromeosProtectedMedia)) {
return false;
}
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
return true;
#else
return false;

@ -251,7 +251,7 @@ interface SpeechRecognitionClientBrowserInterface {
// Similar to BindSpeechRecognitionBrowserObserver, however binds Browser
// observers that listen to events specific to BabelOrca rather than
// the traditional LiveCaption preference.
[MinVersion=7, EnableIf=is_chromeos_ash]
[MinVersion=7, EnableIf=is_chromeos]
BindBabelOrcaSpeechRecognitionBrowserObserver@2(
pending_remote<SpeechRecognitionBrowserObserver> observer);
};

@ -10,7 +10,7 @@ import "mojo/public/mojom/base/unguessable_token.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
// This API is a stable version of VideoDecoder. This is used both by LaCrOS and
// This API is a stable version of VideoDecoder. This is used
// by out-of-process video decoding to allow the GPU process to forward video
// decoding requests to a video decoder process.
// In order to avoid depending on unstable definitions or on components which
@ -176,13 +176,13 @@ interface StableVideoDecoder {
Reset@4() => ();
};
// Only Chrome-for-Linux and ash-chrome should host the implementation of a
// Only Chrome-for-Linux and ChromeOS should host the implementation of a
// StableVideoDecoderFactory.
[EnableIf=is_chromeos_ash|is_linux]
[EnableIf=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox =
sandbox.mojom.Sandbox.kHardwareVideoDecoding;
[EnableIfNot=is_chromeos_ash|is_linux]
[EnableIfNot=is_chromeos|is_linux]
const sandbox.mojom.Sandbox kStableVideoDecoderFactoryServiceSandbox =
sandbox.mojom.Sandbox.kNoSandbox;
@ -198,7 +198,7 @@ interface StableVideoDecoderTracker {};
// A StableVideoDecoderFactory allows the browser process to bind a
// StableVideoDecoder on behalf of some client which can be, e.g., the
// lacros-chrome browser process or a renderer process in ash-chrome.
// renderer process in ChromeOS.
// Next min method ID: 1
// Next min version: 2
[Uuid="d6047fd9-fffb-4e37-ad9b-383a1c9e1d2d"]
@ -215,11 +215,11 @@ interface StableVideoDecoderFactory {
};
// A StableVideoDecoderFactoryProcess is intended to be hosted in a utility
// process in either ash-chrome or Chrome-for-linux. The client is expected to
// be the browser process of ash-chrome or Chrome-for-linux. The intended usage
// process in either ChromeOS or Chrome-for-linux. The client is expected to
// be the browser process of ChromeOS or Chrome-for-linux. The intended usage
// is as follows:
//
// 1) The browser process of ash-chrome or Chrome-for-linux receives a request
// 1) The browser process of ChromeOS or Chrome-for-linux receives a request
// to bind a pending_receiver<StableVideoDecoderFactory>.
//
// 2) That browser process starts a utility process to bind a
@ -227,7 +227,7 @@ interface StableVideoDecoderFactory {
// connection to call InitializeStableVideoDecoderFactory() with the
// pending_receiver<StableVideoDecoderFactory> from (1).
[ServiceSandbox=kStableVideoDecoderFactoryServiceSandbox,
EnableIf=is_chromeos_ash|is_linux]
EnableIf=is_chromeos|is_linux]
interface StableVideoDecoderFactoryProcess {
// Initializes a StableVideoDecoderFactory using |gpu_feature_info| to
// restrict the supported video decode configurations.

@ -3,7 +3,6 @@
# found in the LICENSE file.
import("//build/config/cast.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/fuzzers/mojolpm.gni")
@ -98,7 +97,6 @@ component("services") {
]
deps = [
"//build:chromeos_buildflags",
"//gpu/ipc/service",
"//media",
"//media:shared_memory_support",
@ -205,7 +203,7 @@ component("services") {
deps += [ "//ui/gfx/mojom:dxgi_info" ]
}
if ((is_chromeos_ash || is_linux) && (use_vaapi || use_v4l2_codec)) {
if ((is_chromeos || is_linux) && (use_vaapi || use_v4l2_codec)) {
sources += [
"stable_video_decoder_factory_process_service.cc",
"stable_video_decoder_factory_process_service.h",
@ -321,13 +319,13 @@ source_set("unit_tests") {
deps += [ "//third_party/widevine/cdm:headers" ]
}
if (is_chromeos_ash) {
if (is_chromeos) {
deps += [
"//components/chromeos_camera:mjpeg_decode_accelerator_service_unittest",
]
}
if ((is_chromeos_ash || is_linux) && (use_vaapi || use_v4l2_codec)) {
if ((is_chromeos || is_linux) && (use_vaapi || use_v4l2_codec)) {
sources += [ "stable_video_decoder_service_unittest.cc" ]
deps += [ "//gpu:test_support" ]
}

@ -14,7 +14,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/ipc/service/gpu_channel.h"
#include "media/base/audio_decoder.h"
#include "media/base/audio_encoder.h"

@ -46,7 +46,7 @@ void MojoCdmServiceContext::UnregisterCdm(
cdm_services_.erase(cdm_id);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
base::UnguessableToken MojoCdmServiceContext::RegisterRemoteCdmContext(
chromeos::RemoteCdmContext* remote_context) {
DCHECK(remote_context);
@ -63,7 +63,7 @@ void MojoCdmServiceContext::UnregisterRemoteCdmContext(
DCHECK(remote_cdm_contexts_.count(cdm_id));
remote_cdm_contexts_.erase(cdm_id);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<CdmContextRef> MojoCdmServiceContext::GetCdmContextRef(
const base::UnguessableToken& cdm_id) {
@ -81,12 +81,12 @@ std::unique_ptr<CdmContextRef> MojoCdmServiceContext::GetCdmContextRef(
}
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Try the remote contexts now.
auto remote_context = remote_cdm_contexts_.find(cdm_id);
if (remote_context != remote_cdm_contexts_.end())
return remote_context->second->GetCdmContextRef();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
LOG(ERROR) << "CdmContextRef cannot be obtained for CDM ID: " << cdm_id;
return nullptr;

@ -14,13 +14,13 @@
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "base/unguessable_token.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/media_buildflags.h"
#include "media/mojo/services/media_mojo_export.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/cdm_factory_daemon/remote_cdm_context.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -43,7 +43,7 @@ class MEDIA_MOJO_EXPORT MojoCdmServiceContext {
// Unregisters the CDM. Must be called before the CDM is destroyed.
void UnregisterCdm(const base::UnguessableToken& cdm_id);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Registers the |remote_context| and returns a unique (per-process) CDM ID.
// This is used with out-of-process video decoding with HWDRM. We run
// MojoCdmServiceContext in the GPU process which works with MojoCdmService.
@ -56,7 +56,7 @@ class MEDIA_MOJO_EXPORT MojoCdmServiceContext {
// Unregisters the RemoteCdmContext. Must be called before the
// RemoteCdmContext is destroyed.
void UnregisterRemoteCdmContext(const base::UnguessableToken& cdm_id);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Returns the CdmContextRef associated with |cdm_id|.
std::unique_ptr<CdmContextRef> GetCdmContextRef(
@ -70,12 +70,12 @@ class MEDIA_MOJO_EXPORT MojoCdmServiceContext {
std::map<base::UnguessableToken, raw_ptr<MojoCdmService, CtnExperimental>>
cdm_services_ GUARDED_BY(cdm_services_lock_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// A map between CDM ID and RemoteCdmContext.
std::map<base::UnguessableToken,
raw_ptr<chromeos::RemoteCdmContext, CtnExperimental>>
remote_cdm_contexts_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
};
} // namespace media

@ -8,7 +8,7 @@
#include "media/gpu/chromeos/frame_registry.h"
#include "media/mojo/common/media_type_converters.h"
#if BUILDFLAG(IS_CHROMEOS_ASH) && BUILDFLAG(USE_VAAPI)
#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_wrapper.h"
#endif
@ -148,10 +148,10 @@ StableVideoDecoderService::StableVideoDecoderService(
stable_video_frame_handle_releaser_receiver_(this),
dst_video_decoder_(std::move(dst_video_decoder)),
dst_video_decoder_receiver_(dst_video_decoder_.get())
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
cdm_service_context_(cdm_service_context)
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
,
frame_registry_(frame_registry) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@ -163,10 +163,10 @@ StableVideoDecoderService::StableVideoDecoderService(
StableVideoDecoderService::~StableVideoDecoderService() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (cdm_id_)
cdm_service_context_->UnregisterRemoteCdmContext(cdm_id_.value());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
void StableVideoDecoderService::GetSupportedConfigs(
@ -232,7 +232,7 @@ void StableVideoDecoderService::Initialize(
// The |config| should have been validated at deserialization time.
DCHECK(config.IsValidConfig());
if (config.is_encrypted()) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (!cdm_id_) {
if (!cdm_context) {
std::move(callback).Run(DecoderStatus::Codes::kMissingCDM,
@ -258,7 +258,7 @@ void StableVideoDecoderService::Initialize(
VideoDecoderType::kUnknown,
/*needs_transcryption=*/false);
return;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
// Even though this is in-process, we still need to pass a |cdm_id_|

@ -9,7 +9,7 @@
#include "base/sequence_checker.h"
#include "base/thread_annotations.h"
#include "base/unguessable_token.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "media/mojo/mojom/media_log.mojom.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
#include "media/mojo/mojom/video_decoder.mojom.h"
@ -20,9 +20,9 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/cdm_factory_daemon/remote_cdm_context.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace media {
@ -147,14 +147,14 @@ class MEDIA_MOJO_EXPORT StableVideoDecoderService
mojo::Remote<mojom::VideoDecoder> dst_video_decoder_remote_
GUARDED_BY_CONTEXT(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Used for registering the |remote_cdm_context_| so that it can be resolved
// from the |cdm_id_| later.
const raw_ptr<MojoCdmServiceContext> cdm_service_context_
GUARDED_BY_CONTEXT(sequence_checker_);
scoped_refptr<chromeos::RemoteCdmContext> remote_cdm_context_
GUARDED_BY_CONTEXT(sequence_checker_);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Used by OnVideoFrameDecoded() to convert media VideoFrames to a
// stable::mojo::VideoFrame.

@ -45,7 +45,6 @@ source_set("video") {
public_deps = [ "//gpu/command_buffer/client:gles2_interface" ]
deps = [
"//build:chromeos_buildflags",
"//gpu/command_buffer/client",
"//gpu/command_buffer/common",
"//gpu/ipc/common",

@ -12,7 +12,6 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/video_frame.h"
namespace media {
@ -248,7 +247,7 @@ bool VideoEncodeAccelerator::IsFlushSupported() {
}
bool VideoEncodeAccelerator::IsGpuFrameResizeSupported() {
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
// TODO(crbug.com/40164413) Add proper method overrides in
// MojoVideoEncodeAccelerator and other subclasses that might return true.
return true;

@ -26,7 +26,6 @@ component("webrtc") {
deps = [
"//base",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//media",
"//media:shared_memory_support",
"//third_party/webrtc_overrides:webrtc_component",

@ -27,7 +27,6 @@
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "build/chromeos_buildflags.h"
#include "media/base/audio_fifo.h"
#include "media/base/audio_parameters.h"
#include "media/base/audio_timestamp_helper.h"
@ -508,8 +507,7 @@ std::optional<double> AudioProcessor::ProcessData(
// controller.
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
DCHECK_LE(volume, 1.0);
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
BUILDFLAG(IS_OPENBSD)
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
// We have a special situation on Linux where the microphone volume can be
// "higher than maximum". The input volume slider in the sound preference
// allows the user to set a scaling that is higher than 100%. It means that