diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index dfd63715..fce1e640 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -109,7 +109,7 @@ ScrollView { var saved_width = prefs.width var saved_height = prefs.height currentIndex = 0 - for (var i = 0; i < resolutionComboBox.count; i++) { + for (var i = 0; i < resolutionListModel.count; i++) { var el_width = parseInt(resolutionListModel.get(i).video_width); var el_height = parseInt(resolutionListModel.get(i).video_height); @@ -168,21 +168,41 @@ ScrollView { } ComboBox { - // ignore setting the index at first, and actually set it when the component is loaded - Component.onCompleted: { + function createModel() { + var fpsListModel = Qt.createQmlObject('import QtQuick 2.0; ListModel {}', parent, '') + // Get the max supported FPS on this system var max_fps = prefs.getMaximumStreamingFrameRate(); + // Default entries + fpsListModel.append({"text": "30 FPS", "video_fps": "30"}) + fpsListModel.append({"text": "60 FPS", "video_fps": "60"}) + // Use 64 as the cutoff for adding a separate option to // handle wonky displays that report just over 60 Hz. if (max_fps > 64) { fpsListModel.append({"text": max_fps+" FPS", "video_fps": ""+max_fps}) } + if (prefs.unsupportedFps) { + if (max_fps !== 90) { + fpsListModel.append({"text": "90 FPS (Unsupported)", "video_fps": "90"}) + } + if (max_fps !== 120) { + fpsListModel.append({"text": "120 FPS (Unsupported)", "video_fps": "120"}) + } + } + + return fpsListModel + } + + function reinitialize() { + model = createModel() + var saved_fps = prefs.fps currentIndex = 0 - for (var i = 0; i < fpsComboBox.count; i++) { - var el_fps = parseInt(fpsListModel.get(i).video_fps); + for (var i = 0; i < model.count; i++) { + var el_fps = parseInt(model.get(i).video_fps); // Pick the highest value lesser or equal to the saved FPS if (saved_fps >= el_fps) { @@ -194,24 +214,17 @@ ScrollView { activated(currentIndex) } + // ignore setting the index at first, and actually set it when the component is loaded + Component.onCompleted: { + reinitialize() + } + id: fpsComboBox textRole: "text" - model: ListModel { - id: fpsListModel - ListElement { - text: "30 FPS" - video_fps: "30" - } - ListElement { - text: "60 FPS" - video_fps: "60" - } - // A higher value may be added at runtime - // based on the attached display refresh rate - } + width: 250 // ::onActivated must be used, as it only listens for when the index is changed by a human onActivated : { - var selectedFps = parseInt(fpsListModel.get(currentIndex).video_fps) + var selectedFps = parseInt(model.get(currentIndex).video_fps) // Only modify the bitrate if the values actually changed if (prefs.fps !== selectedFps) { @@ -565,6 +578,19 @@ ScrollView { } } + CheckBox { + id: unlockUnsupportedFps + text: "Unlock unsupported FPS options" + font.pointSize: 12 + checked: prefs.unsupportedFps + onCheckedChanged: { + prefs.unsupportedFps = checked + + // The selectable FPS values depend on whether + // this option is enabled or not + fpsComboBox.reinitialize() + } + } } } } diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index 341ee74b..3018724e 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -18,6 +18,7 @@ #define SER_VIDEOCFG "videocfg" #define SER_VIDEODEC "videodec" #define SER_WINDOWMODE "windowmode" +#define SER_UNSUPPORTEDFPS "unsupportedfps" StreamingPreferences::StreamingPreferences() { @@ -36,6 +37,7 @@ void StreamingPreferences::reload() gameOptimizations = settings.value(SER_GAMEOPTS, true).toBool(); playAudioOnHost = settings.value(SER_HOSTAUDIO, false).toBool(); multiController = settings.value(SER_MULTICONT, true).toBool(); + unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool(); audioConfig = static_cast(settings.value(SER_AUDIOCFG, static_cast(AudioConfig::AC_FORCE_STEREO)).toInt()); videoCodecConfig = static_cast(settings.value(SER_VIDEOCFG, @@ -60,6 +62,7 @@ void StreamingPreferences::save() settings.setValue(SER_GAMEOPTS, gameOptimizations); settings.setValue(SER_HOSTAUDIO, playAudioOnHost); settings.setValue(SER_MULTICONT, multiController); + settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps); settings.setValue(SER_AUDIOCFG, static_cast(audioConfig)); settings.setValue(SER_VIDEOCFG, static_cast(videoCodecConfig)); settings.setValue(SER_VIDEODEC, static_cast(videoDecoderSelection)); diff --git a/app/settings/streamingpreferences.h b/app/settings/streamingpreferences.h index c770c574..da427809 100644 --- a/app/settings/streamingpreferences.h +++ b/app/settings/streamingpreferences.h @@ -68,6 +68,7 @@ public: Q_PROPERTY(bool gameOptimizations MEMBER gameOptimizations NOTIFY gameOptimizationsChanged) Q_PROPERTY(bool playAudioOnHost MEMBER playAudioOnHost NOTIFY playAudioOnHostChanged) Q_PROPERTY(bool multiController MEMBER multiController NOTIFY multiControllerChanged) + Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged) Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged) Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged) Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged) @@ -82,6 +83,7 @@ public: bool gameOptimizations; bool playAudioOnHost; bool multiController; + bool unsupportedFps; AudioConfig audioConfig; VideoCodecConfig videoCodecConfig; VideoDecoderSelection videoDecoderSelection; @@ -94,6 +96,7 @@ signals: void gameOptimizationsChanged(); void playAudioOnHostChanged(); void multiControllerChanged(); + void unsupportedFpsChanged(); void audioConfigChanged(); void videoCodecConfigChanged(); void videoDecoderSelectionChanged(); diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 2de998a4..231a722d 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -415,6 +415,10 @@ bool Session::validateLaunch() emitLaunchWarning("Your settings selection to force software decoding may cause poor streaming performance."); } + if (m_Preferences.unsupportedFps && m_StreamConfig.fps > 60) { + emitLaunchWarning("Using unsupported FPS options may cause stuttering or lag."); + } + if (m_StreamConfig.supportsHevc) { bool hevcForced = m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC || m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC_HDR;