Skip to content

Commit

Permalink
[XB1] Replace the av1 decoder with dav1d based GPU decoder (#1540)
Browse files Browse the repository at this point in the history
b/281831576

(cherry picked from commit 7e847b9)
  • Loading branch information
alexanderbobrovnik authored and TyHolc committed Nov 3, 2023
1 parent 6586e24 commit 71121f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
9 changes: 4 additions & 5 deletions starboard/shared/uwp/extended_resources_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions starboard/shared/uwp/player_components_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions starboard/xb1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,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",
Expand All @@ -235,7 +235,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 {
Expand Down
1 change: 0 additions & 1 deletion starboard/xb1/shared/gpu_base_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
{
Expand Down

0 comments on commit 71121f5

Please sign in to comment.