From cee56b28ea50cf0208de726fddd99fa4f27a17f6 Mon Sep 17 00:00:00 2001 From: alexanderbobrovnik <136349302+alexanderbobrovnik@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:52:54 +0100 Subject: [PATCH] [XB1] Replace the av1 decoder with dav1d based GPU decoder (#1540) Manually cherry picking due to issues with auto cherry pick at #1879 b/281831576 (cherry picked from commit 7e847b957ff2bfd955e3a779d5e9740a228616c4) Change-Id: Icd72953706102418ccbbdbf539268bb0bd36180d --- starboard/shared/uwp/extended_resources_manager.cc | 9 ++++----- starboard/shared/uwp/player_components_factory.cc | 4 ++-- starboard/xb1/BUILD.gn | 6 +++--- starboard/xb1/shared/gpu_base_video_decoder.cc | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/starboard/shared/uwp/extended_resources_manager.cc b/starboard/shared/uwp/extended_resources_manager.cc index 4d53de84bca5..21d2821441c7 100644 --- a/starboard/shared/uwp/extended_resources_manager.cc +++ b/starboard/shared/uwp/extended_resources_manager.cc @@ -26,7 +26,7 @@ #include "starboard/time.h" #include "starboard/xb1/shared/internal_shims.h" #if defined(INTERNAL_BUILD) -#include "internal/starboard/xb1/av1_video_decoder.h" +#include "internal/starboard/xb1/dav1d_video_decoder.h" #include "internal/starboard/xb1/vpx_video_decoder.h" #include "third_party/internal/libvpx_xb1/libvpx/d3dx12.h" #endif // defined(INTERNAL_BUILD) @@ -41,7 +41,7 @@ using Microsoft::WRL::ComPtr; using ::starboard::shared::starboard::media::MimeSupportabilityCache; using Windows::Foundation::Metadata::ApiInformation; #if defined(INTERNAL_BUILD) -using ::starboard::xb1::shared::Av1VideoDecoder; +using ::starboard::xb1::shared::Dav1dVideoDecoder; using ::starboard::xb1::shared::GpuVideoDecoderBase; using ::starboard::xb1::shared::VpxVideoDecoder; #endif // defined(INTERNAL_BUILD) @@ -392,8 +392,7 @@ void ExtendedResourcesManager::CompileShadersAsynchronously() { "shader compile."; return; } - if (Av1VideoDecoder::CompileShaders(d3d12device_, d3d12FrameBuffersHeap_, - d3d12queue_.Get())) { + if (Dav1dVideoDecoder::CompileShaders(d3d12device_)) { is_av1_shader_compiled_ = true; SB_LOG(INFO) << "Gpu based AV1 decoder finished compiling its shaders."; } else { @@ -465,7 +464,7 @@ void ExtendedResourcesManager::ReleaseExtendedResourcesInternal() { SB_LOG(INFO) << "CreateEvent() failed with " << GetLastError(); } #if defined(INTERNAL_BUILD) - Av1VideoDecoder::ReleaseShaders(); + Dav1dVideoDecoder::ReleaseShaders(); VpxVideoDecoder::ReleaseShaders(); #endif // #if defined(INTERNAL_BUILD) is_av1_shader_compiled_ = false; diff --git a/starboard/shared/uwp/player_components_factory.cc b/starboard/shared/uwp/player_components_factory.cc index ce7f0d26d463..c8511be2d08b 100644 --- a/starboard/shared/uwp/player_components_factory.cc +++ b/starboard/shared/uwp/player_components_factory.cc @@ -43,7 +43,7 @@ #include "starboard/xb1/shared/video_decoder_uwp.h" #if defined(INTERNAL_BUILD) -#include "internal/starboard/xb1/av1_video_decoder.h" +#include "internal/starboard/xb1/dav1d_video_decoder.h" #include "internal/starboard/xb1/vpx_video_decoder.h" #endif // defined(INTERNAL_BUILD) @@ -254,7 +254,7 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { #if defined(INTERNAL_BUILD) using GpuVp9VideoDecoder = ::starboard::xb1::shared::VpxVideoDecoder; - using GpuAv1VideoDecoder = ::starboard::xb1::shared::Av1VideoDecoder; + using GpuAv1VideoDecoder = ::starboard::xb1::shared::Dav1dVideoDecoder; if (video_codec == kSbMediaVideoCodecVp9) { video_decoder->reset(new GpuVp9VideoDecoder( diff --git a/starboard/xb1/BUILD.gn b/starboard/xb1/BUILD.gn index 200f9cfa454b..e4137bc401b4 100644 --- a/starboard/xb1/BUILD.gn +++ b/starboard/xb1/BUILD.gn @@ -217,8 +217,8 @@ static_library("starboard_platform") { if (is_internal_build) { sources += [ "//internal/starboard/shared/uwp/keys.cc", - "//internal/starboard/xb1/av1_video_decoder.cc", - "//internal/starboard/xb1/av1_video_decoder.h", + "//internal/starboard/xb1/dav1d_video_decoder.cc", + "//internal/starboard/xb1/dav1d_video_decoder.h", "//internal/starboard/xb1/drm_create_system.cc", "//internal/starboard/xb1/internal_shims.cc", "//internal/starboard/xb1/media_is_supported.cc", @@ -238,7 +238,7 @@ static_library("starboard_platform") { "//starboard/shared/widevine:oemcrypto", "//third_party/internal/ce_cdm/cdm:widevine_cdm_core", "//third_party/internal/ce_cdm/cdm:widevine_ce_cdm_static", - "//third_party/internal/libav1_xb1", + "//third_party/internal/dav1d_gpu/xb1:dav1d_xb1", "//third_party/internal/libvpx_xb1", ] } else { diff --git a/starboard/xb1/shared/gpu_base_video_decoder.cc b/starboard/xb1/shared/gpu_base_video_decoder.cc index 155fef26eca3..d2b83b328996 100644 --- a/starboard/xb1/shared/gpu_base_video_decoder.cc +++ b/starboard/xb1/shared/gpu_base_video_decoder.cc @@ -476,7 +476,6 @@ void GpuVideoDecoderBase::Reset() { decoder_thread_->job_queue()->Schedule( std::bind(&GpuVideoDecoderBase::DrainDecoder, this)); decoder_thread_.reset(); - SB_DCHECK(decoder_behavior_.load() == kDecodingStopped); } pending_inputs_.clear(); {