From b2265080fd1fc9696012ddaa64f090bdc2ac3f83 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 6 Jan 2022 22:07:31 -0600 Subject: [PATCH] Allow HEVC decoders to satisfy hardware decoding check if H.264 is unavailable --- app/gui/main.qml | 2 +- app/streaming/session.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/gui/main.qml b/app/gui/main.qml index a0a380ad..648dd1b4 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -412,7 +412,7 @@ ApplicationWindow { ErrorMessageDialog { id: noHwDecoderDialog - text: qsTr("No functioning hardware accelerated H.264 video decoder was detected by Moonlight. " + + text: qsTr("No functioning hardware accelerated video decoder was detected by Moonlight. " + "Your streaming performance may be severely degraded in this configuration.") helpText: qsTr("Click the Help button for more information on solving this problem.") helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems" diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 91dc2db7..6ec1106a 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -307,6 +307,23 @@ void Session::getDecoderInfo(SDL_Window* window, maxResolution = decoder->getDecoderMaxResolution(); delete decoder; + + // If we don't get back a hardware H.264 decoder, see if we have a hardware + // HEVC decoder. This can be the case on the Raspberry Pi with Full KMS + // when not running in X11. Everything since Maxwell in 2014 can encode HEVC, + // so we probably don't need to be concerned about a lack of fast H.264 + // decoding enough to bug the user about it every launch. + if (!isHardwareAccelerated) { + if (chooseDecoder(StreamingPreferences::VDS_FORCE_HARDWARE, + window, VIDEO_FORMAT_H265, 1920, 1080, 60, + false, false, true, decoder)) { + isHardwareAccelerated = decoder->isHardwareAccelerated(); + isFullScreenOnly = decoder->isAlwaysFullScreen(); + maxResolution = decoder->getDecoderMaxResolution(); + + delete decoder; + } + } } bool Session::isHardwareDecodeAvailable(SDL_Window* window,