Commit b9dff62d authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

Enable pipeline for HEVC in ChromeOS if HEVC is enabled

This enables HEVC as a supported media format if the
ENABLE_PLATFORM_HEVC flag is on and we have enabled clear
HEVC for testing. This also enables the bitstream
conversion in the Chrome OS decoder pipeline.

Another CL enables HEVC for the encrypted path.

BUG=b:153111783,chromium:1141237
TEST=Clear HEVC playback works w/ cmd line flag

Change-Id: I27892296cec353d442178dc8e43f975921e8c036
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568210Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Cr-Commit-Position: refs/heads/master@{#836407}
parent c6ce750b
......@@ -3351,6 +3351,9 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
#if defined(ENABLE_IPC_FUZZER)
switches::kIpcDumpDirectory,
switches::kIpcFuzzerTestcase,
#endif
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
switches::kEnableClearHevcForTesting,
#endif
};
renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
......
......@@ -102,9 +102,4 @@ const char kEnforceVulkanProtectedMemory[] = "enforce-vulkan-protected-memory";
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
......@@ -6,7 +6,6 @@
#define GPU_CONFIG_GPU_SWITCHES_H_
#include "gpu/gpu_export.h"
#include "media/media_buildflags.h"
namespace switches {
......@@ -35,9 +34,6 @@ GPU_EXPORT extern const char kWebViewDrawFunctorUsesVulkan[];
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
......
......@@ -192,6 +192,11 @@ const char kOverrideHardwareSecureCodecsForTesting[] =
const char kEnableLiveCaptionPrefForTesting[] =
"enable-live-caption-pref-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 autoplay {
// Autoplay policy that requires a document user activation.
......
......@@ -86,6 +86,10 @@ MEDIA_EXPORT extern const char kOverrideEnabledCdmInterfaceVersion[];
MEDIA_EXPORT extern const char kOverrideHardwareSecureCodecsForTesting[];
MEDIA_EXPORT extern const char kEnableLiveCaptionPrefForTesting[];
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
MEDIA_EXPORT extern const char kEnableClearHevcForTesting[];
#endif
namespace autoplay {
MEDIA_EXPORT extern const char kDocumentUserActivationRequiredPolicy[];
......
......@@ -4,6 +4,7 @@
#include "media/base/supported_types.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/no_destructor.h"
......@@ -51,6 +52,25 @@ bool IsSupportedHdrMetadata(const gfx::HdrMetadataType& hdr_metadata_type) {
return false;
}
#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
bool IsHevcProfileSupported(VideoCodecProfile profile) {
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableClearHevcForTesting)) {
return false;
}
switch (profile) {
case HEVCPROFILE_MAIN: // fallthrough
case HEVCPROFILE_MAIN10:
return true;
case HEVCPROFILE_MAIN_STILL_PICTURE:
return false;
default:
NOTREACHED();
}
return false;
}
#endif // ENABLE_PLATFORM_HEVC && USE_CHROMEOS_PROTECTED_MEDIA
} // namespace
bool IsSupportedAudioType(const AudioType& type) {
......@@ -318,10 +338,16 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
case kCodecTheora:
return true;
case kCodecHEVC:
#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
return IsColorSpaceSupported(type.color_space) &&
IsHevcProfileSupported(type.profile);
#else
return false;
#endif
case kUnknownVideoCodec:
case kCodecVC1:
case kCodecMPEG2:
case kCodecHEVC:
case kCodecDolbyVision:
return false;
......
......@@ -218,7 +218,8 @@ void VideoDecoderPipeline::Initialize(const VideoDecoderConfig& config,
}
#endif // !BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
needs_bitstream_conversion_ = (config.codec() == kCodecH264);
needs_bitstream_conversion_ =
(config.codec() == kCodecH264) || (config.codec() == kCodecHEVC);
decoder_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&VideoDecoderPipeline::InitializeTask,
......
......@@ -15,9 +15,9 @@
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.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/media_switches.h"
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment