diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 17f1e376..355a8023 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts 1.3 import ComputerModel 1.0 import ComputerManager 1.0 +import StreamingPreferences 1.0 GridView { property ComputerModel computerModel : createModel() @@ -25,9 +26,17 @@ GridView { // routine to run, but only if we start as invisible visible: false + StreamingPreferences { + id: prefs + } + Component.onCompleted: { // Setup signals on CM ComputerManager.computerAddCompleted.connect(addComplete) + + if (!prefs.hasAnyHardwareAcceleration()) { + noHwDecoderDialog.open() + } } onVisibleChanged: { @@ -184,6 +193,19 @@ GridView { standardButtons: StandardButton.Ok } + MessageDialog { + id: noHwDecoderDialog + modality:Qt.WindowModal + icon: StandardIcon.Warning + standardButtons: StandardButton.Ok | StandardButton.Help + text: "No functioning hardware accelerated H.264 video decoder was detected by Moonlight. " + + "Your streaming performance may be severely degraded in this configuration. " + + "Click the Help button for more information on solving this problem." + onHelp: { + Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"); + } + } + MessageDialog { id: pairDialog // don't allow edits to the rest of the window while open diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index 51907b87..1b499c82 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -1,4 +1,5 @@ #include "streamingpreferences.h" +#include "streaming/session.hpp" #include @@ -57,6 +58,15 @@ void StreamingPreferences::save() settings.setValue(SER_VIDEODEC, static_cast(videoDecoderSelection)); } +bool StreamingPreferences::hasAnyHardwareAcceleration() +{ + // Always use VDS_AUTO to avoid spamming the user with warnings + // if they've forced software decoding. + return Session::isHardwareDecodeAvailable(VDS_AUTO, + VIDEO_FORMAT_H264, + 1920, 1080, 60); +} + int StreamingPreferences::getDefaultBitrate(int width, int height, int fps) { if (width * height * fps <= 1280 * 720 * 30) { diff --git a/app/settings/streamingpreferences.h b/app/settings/streamingpreferences.h index eba37971..b622758d 100644 --- a/app/settings/streamingpreferences.h +++ b/app/settings/streamingpreferences.h @@ -14,6 +14,8 @@ public: Q_INVOKABLE void save(); + Q_INVOKABLE static bool hasAnyHardwareAcceleration(); + void reload(); enum AudioConfig diff --git a/app/streaming/session.hpp b/app/streaming/session.hpp index 1b06a730..461770d1 100644 --- a/app/streaming/session.hpp +++ b/app/streaming/session.hpp @@ -21,6 +21,10 @@ public: Q_INVOKABLE void exec(); + static + bool isHardwareDecodeAvailable(StreamingPreferences::VideoDecoderSelection vds, + int videoFormat, int width, int height, int frameRate); + signals: void stageStarting(QString stage); @@ -45,10 +49,6 @@ private: void toggleFullscreen(); - static - bool isHardwareDecodeAvailable(StreamingPreferences::VideoDecoderSelection vds, - int videoFormat, int width, int height, int frameRate); - static bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds, SDL_Window* window, int videoFormat, int width, int height,