Enable clear HEVC content for testing
BUG=b:153111783,chromium:1141237
TEST=With flag, clear HEVC can be played back, fails otherwise
Change-Id: I0549d81600ad33d257d72c2b03b3079b098afb7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566291
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832144}
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index bcef78d..2879999 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -272,6 +272,9 @@
switches::kVModule,
switches::kUseAdapterLuid,
switches::kWebViewDrawFunctorUsesVulkan,
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
+ switches::kEnableClearHevcForTesting,
+#endif
#if defined(OS_MAC)
sandbox::policy::switches::kEnableSandboxLogging,
switches::kDisableAVFoundationOverlays,
diff --git a/gpu/config/gpu_switches.cc b/gpu/config/gpu_switches.cc
index 82ede09b..761c23ac 100644
--- a/gpu/config/gpu_switches.cc
+++ b/gpu/config/gpu_switches.cc
@@ -102,4 +102,9 @@
const char kDisableVulkanFallbackToGLForTesting[] =
"disable-vulkan-fallback-to-gl-for-testing";
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
+// Enables playback of clear (unencrypted) HEVC content for testing purposes.
+const char kEnableClearHevcForTesting[] = "enable-clear-hevc-for-testing";
+#endif
+
} // namespace switches
diff --git a/gpu/config/gpu_switches.h b/gpu/config/gpu_switches.h
index 7135afdb..f935a3f 100644
--- a/gpu/config/gpu_switches.h
+++ b/gpu/config/gpu_switches.h
@@ -6,6 +6,7 @@
#define GPU_CONFIG_GPU_SWITCHES_H_
#include "gpu/gpu_export.h"
+#include "media/media_buildflags.h"
namespace switches {
@@ -34,6 +35,9 @@
GPU_EXPORT extern const char kEnableVulkanProtectedMemory[];
GPU_EXPORT extern const char kEnforceVulkanProtectedMemory[];
GPU_EXPORT extern const char kDisableVulkanFallbackToGLForTesting[];
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
+GPU_EXPORT extern const char kEnableClearHevcForTesting[];
+#endif
} // namespace switches
diff --git a/media/gpu/vaapi/vaapi_video_decoder.cc b/media/gpu/vaapi/vaapi_video_decoder.cc
index 21a4de9..b68479d9 100644
--- a/media/gpu/vaapi/vaapi_video_decoder.cc
+++ b/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -9,9 +9,11 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
+#include "gpu/config/gpu_switches.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/format_utils.h"
#include "media/base/video_frame.h"
@@ -174,6 +176,14 @@
base::BindRepeating(&VaapiVideoDecoder::OnCdmContextEvent,
weak_this_factory_.GetWeakPtr()));
#endif
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
+ } else if (config.codec() == kCodecHEVC &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClearHevcForTesting)) {
+ DVLOG(1) << "Clear HEVC content is not supported";
+ std::move(init_cb).Run(StatusCode::kClearContentUnsupported);
+ return;
+#endif
}
// We expect the decoder to have released all output buffers (by the client