Add 1440p and up to 90 FPS streaming options for > 60 Hz monitors
This commit is contained in:
parent
59d087adf5
commit
871988b2cb
2 changed files with 108 additions and 85 deletions
|
|
@ -34,7 +34,7 @@ ScrollView {
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
id: resFPStitle
|
id: resFPStitle
|
||||||
text: qsTr("Resolution and FPS target")
|
text: qsTr("Resolution and FPS")
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
@ -43,84 +43,113 @@ ScrollView {
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
id: resFPSdesc
|
id: resFPSdesc
|
||||||
text: qsTr("Setting values too high for your device may cause lag or crashes")
|
text: qsTr("Setting values too high for your PC may cause lag, stuttering, or errors")
|
||||||
font.pointSize: 9
|
font.pointSize: 9
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
ComboBox {
|
Row {
|
||||||
// ignore setting the index at first, and actually set it when the component is loaded
|
spacing: 5
|
||||||
Component.onCompleted: {
|
|
||||||
// load the saved width/height/fps, and iterate through the ComboBox until a match is found
|
ComboBox {
|
||||||
// set it to that index.
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
var saved_width = prefs.width
|
Component.onCompleted: {
|
||||||
var saved_height = prefs.height
|
// load the saved width/height, and iterate through the ComboBox until a match is found
|
||||||
var saved_fps = prefs.fps
|
// and set it to that index.
|
||||||
currentIndex = 0
|
var saved_width = prefs.width
|
||||||
for(var i = 0; i < resolutionComboBox.count; i++) {
|
var saved_height = prefs.height
|
||||||
var el_width = parseInt(resolutionListModel.get(i).video_width);
|
currentIndex = 0
|
||||||
var el_height = parseInt(resolutionListModel.get(i).video_height);
|
for (var i = 0; i < resolutionComboBox.count; i++) {
|
||||||
var el_fps = parseInt(resolutionListModel.get(i).video_fps);
|
var el_width = parseInt(resolutionListModel.get(i).video_width);
|
||||||
if(saved_width === el_width &&
|
var el_height = parseInt(resolutionListModel.get(i).video_height);
|
||||||
saved_height === el_height &&
|
if (saved_width === el_width && saved_height === el_height) {
|
||||||
saved_fps === el_fps) {
|
currentIndex = i
|
||||||
currentIndex = i
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
id: resolutionComboBox
|
||||||
|
font.pointSize: 9
|
||||||
|
textRole: "text"
|
||||||
|
model: ListModel {
|
||||||
|
id: resolutionListModel
|
||||||
|
ListElement {
|
||||||
|
text: "720p"
|
||||||
|
video_width: "1280"
|
||||||
|
video_height: "720"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "1080p"
|
||||||
|
video_width: "1920"
|
||||||
|
video_height: "1080"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "1440p"
|
||||||
|
video_width: "2560"
|
||||||
|
video_height: "1440"
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "4K"
|
||||||
|
video_width: "3840"
|
||||||
|
video_height: "2160"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
|
onActivated : {
|
||||||
|
prefs.width = parseInt(resolutionListModel.get(currentIndex).video_width)
|
||||||
|
prefs.height = parseInt(resolutionListModel.get(currentIndex).video_height)
|
||||||
|
|
||||||
|
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
||||||
|
slider.value = prefs.bitrateKbps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id: resolutionComboBox
|
ComboBox {
|
||||||
width: Math.min(bitrateDesc.implicitWidth, parent.width)
|
// ignore setting the index at first, and actually set it when the component is loaded
|
||||||
font.pointSize: 9
|
Component.onCompleted: {
|
||||||
textRole: "text"
|
// Get the max supported FPS on this system
|
||||||
model: ListModel {
|
var max_fps = prefs.getMaximumStreamingFrameRate();
|
||||||
id: resolutionListModel
|
|
||||||
ListElement {
|
|
||||||
text: "720p 30 FPS"
|
|
||||||
video_width: "1280"
|
|
||||||
video_height: "720"
|
|
||||||
video_fps: "30"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: "720p 60 FPS"
|
|
||||||
video_width: "1280"
|
|
||||||
video_height: "720"
|
|
||||||
video_fps: "60"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: "1080p 30 FPS"
|
|
||||||
video_width: "1920"
|
|
||||||
video_height: "1080"
|
|
||||||
video_fps: "30"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: "1080p 60 FPS"
|
|
||||||
video_width: "1920"
|
|
||||||
video_height: "1080"
|
|
||||||
video_fps: "60"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: "4K 30 FPS"
|
|
||||||
video_width: "3840"
|
|
||||||
video_height: "2160"
|
|
||||||
video_fps: "30"
|
|
||||||
}
|
|
||||||
ListElement {
|
|
||||||
text: "4K 60 FPS"
|
|
||||||
video_width: "3840"
|
|
||||||
video_height: "2160"
|
|
||||||
video_fps: "60"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
|
||||||
onActivated : {
|
|
||||||
prefs.width = parseInt(resolutionListModel.get(currentIndex).video_width)
|
|
||||||
prefs.height = parseInt(resolutionListModel.get(currentIndex).video_height)
|
|
||||||
prefs.fps = parseInt(resolutionListModel.get(currentIndex).video_fps)
|
|
||||||
|
|
||||||
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
// Use 64 as the cutoff for adding a separate option to
|
||||||
slider.value = prefs.bitrateKbps
|
// handle wonky displays that report just over 60 Hz.
|
||||||
|
if (max_fps > 64) {
|
||||||
|
fpsListModel.append({"text": max_fps+" FPS", "video_fps": ""+max_fps})
|
||||||
|
}
|
||||||
|
|
||||||
|
var saved_fps = prefs.fps
|
||||||
|
currentIndex = 0
|
||||||
|
for (var i = 0; i < fpsComboBox.count; i++) {
|
||||||
|
var el_fps = parseInt(fpsListModel.get(i).video_fps);
|
||||||
|
if (el_fps === saved_fps) {
|
||||||
|
currentIndex = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
id: fpsComboBox
|
||||||
|
font.pointSize: 9
|
||||||
|
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
|
||||||
|
}
|
||||||
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
|
onActivated : {
|
||||||
|
prefs.fps = parseInt(fpsListModel.get(currentIndex).video_fps)
|
||||||
|
|
||||||
|
prefs.bitrateKbps = prefs.getDefaultBitrate(prefs.width, prefs.height, prefs.fps);
|
||||||
|
slider.value = prefs.bitrateKbps
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,7 +179,7 @@ ScrollView {
|
||||||
|
|
||||||
stepSize: 500
|
stepSize: 500
|
||||||
from : 500
|
from : 500
|
||||||
to: 100000
|
to: 150000
|
||||||
|
|
||||||
snapMode: "SnapOnRelease"
|
snapMode: "SnapOnRelease"
|
||||||
width: Math.min(bitrateDesc.implicitWidth, parent.width)
|
width: Math.min(bitrateDesc.implicitWidth, parent.width)
|
||||||
|
|
|
||||||
|
|
@ -95,22 +95,16 @@ int StreamingPreferences::getMaximumStreamingFrameRate()
|
||||||
|
|
||||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||||
{
|
{
|
||||||
if (width * height * fps <= 1280 * 720 * 30) {
|
if (width * height <= 1280 * 720) {
|
||||||
return 5000;
|
return static_cast<int>(5000 * (fps / 30.0));
|
||||||
}
|
}
|
||||||
else if (width * height * fps <= 1280 * 720 * 60) {
|
else if (width * height <= 1920 * 1080) {
|
||||||
return 10000;
|
return static_cast<int>(10000 * (fps / 30.0));
|
||||||
}
|
}
|
||||||
else if (width * height * fps <= 1920 * 1080 * 30) {
|
else if (width * height <= 2560 * 1440) {
|
||||||
return 10000;
|
return static_cast<int>(20000 * (fps / 30.0));
|
||||||
}
|
}
|
||||||
else if (width * height * fps <= 1920 * 1080 * 60) {
|
else /* if (width * height <= 3840 * 2160) */ {
|
||||||
return 20000;
|
return static_cast<int>(40000 * (fps / 30.0));
|
||||||
}
|
|
||||||
else if (width * height * fps <= 3840 * 2160 * 30) {
|
|
||||||
return 40000;
|
|
||||||
}
|
|
||||||
else /* if (width * height * fps <= 3840 * 2160 * 60) */ {
|
|
||||||
return 80000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue