summaryrefslogtreecommitdiffstats
path: root/src/video_core/command_classes/codecs
diff options
context:
space:
mode:
authorliushuyu <liushuyu011@gmail.com>2021-12-13 01:43:10 +0100
committerliushuyu <liushuyu011@gmail.com>2021-12-14 06:29:19 +0100
commita2d73eaa107bb5e3cd570e522fc69311468c2c89 (patch)
tree62305d776efe84061d94003f4e51557e161c092f /src/video_core/command_classes/codecs
parentCI: fix MinGW installation step (diff)
downloadyuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.gz
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.bz2
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.lz
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.xz
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.zst
yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.zip
Diffstat (limited to 'src/video_core/command_classes/codecs')
-rw-r--r--src/video_core/command_classes/codecs/codec.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp
index 2a532b883..439c47209 100644
--- a/src/video_core/command_classes/codecs/codec.cpp
+++ b/src/video_core/command_classes/codecs/codec.cpp
@@ -130,6 +130,12 @@ bool Codec::CreateGpuAvDevice() {
}
if (config->methods & HW_CONFIG_METHOD && config->device_type == type) {
av_codec_ctx->pix_fmt = config->pix_fmt;
+ if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX) {
+ // skip zero-copy decoders, we don't currently support them
+ LOG_DEBUG(Service_NVDRV, "Skipping decoder {} with unsupported capability {}.",
+ av_hwdevice_get_type_name(type), config->methods);
+ continue;
+ }
LOG_INFO(Service_NVDRV, "Using {} GPU decoder", av_hwdevice_get_type_name(type));
return true;
}
@@ -251,6 +257,9 @@ void Codec::Decode() {
final_frame->format = PREFERRED_GPU_FMT;
const int ret = av_hwframe_transfer_data(final_frame.get(), initial_frame.get(), 0);
ASSERT_MSG(!ret, "av_hwframe_transfer_data error {}", ret);
+ // null the hw frame context to prevent the buffer from being deleted
+ // and leaving a dangling reference in the av_codec_ctx
+ initial_frame->hw_frames_ctx = nullptr;
} else {
final_frame = std::move(initial_frame);
}