configure bitrate on client only
This commit is contained in:
@@ -23,24 +23,6 @@ Kirigami.ScrollablePage {
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
Controls.SpinBox {
|
||||
id: bitrate
|
||||
Kirigami.FormData.label: i18n("Bitrate:")
|
||||
from: 1
|
||||
to: 200
|
||||
|
||||
textFromValue: (value, locale) => i18nc("bitrate", "%1 Mbit/s", value)
|
||||
valueFromText: function (text, locale) {
|
||||
var prefix_suffix = i18nc("bitrate", "%1 Mbit/s", "%1").split('%1');
|
||||
for (var i of prefix_suffix) {
|
||||
text = text.replace(i, "");
|
||||
}
|
||||
return Number.fromLocaleString(text);
|
||||
}
|
||||
|
||||
onValueModified: Settings.bitrate = value
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("The current encoder configuration is not supported")
|
||||
@@ -314,9 +296,6 @@ Kirigami.ScrollablePage {
|
||||
Component.onCompleted: {
|
||||
openvr_libs.init()
|
||||
Settings.load(WivrnServer);
|
||||
// If bitrate was manually set higher, keep the limit
|
||||
bitrate.to = Math.max(bitrate.to, Settings.bitrate)
|
||||
bitrate.value = Settings.bitrate
|
||||
settings.allowUpdates = true;
|
||||
settings.load();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@ void Settings::emitAllChanged()
|
||||
encoderChanged();
|
||||
codecChanged();
|
||||
tenbitChanged();
|
||||
bitrateChanged();
|
||||
tcpOnlyChanged();
|
||||
applicationChanged();
|
||||
openvrChanged();
|
||||
@@ -313,26 +312,6 @@ void Settings::set_tenbit(const bool & value)
|
||||
tenbitChanged();
|
||||
}
|
||||
|
||||
int Settings::bitrate() const
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_jsonSettings.value("bitrate", 50'000'000) / 1'000'000;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::set_bitrate(const int & value)
|
||||
{
|
||||
auto old = bitrate();
|
||||
m_jsonSettings["bitrate"] = value * 1'000'000;
|
||||
if (old != value)
|
||||
bitrateChanged();
|
||||
}
|
||||
|
||||
QString Settings::application() const
|
||||
{
|
||||
// Automatically started application
|
||||
@@ -500,7 +479,6 @@ void Settings::save(wivrn_server * server)
|
||||
void Settings::restore_defaults()
|
||||
{
|
||||
m_jsonSettings.erase("encoder");
|
||||
m_jsonSettings.erase("bitrate");
|
||||
m_jsonSettings.erase("application");
|
||||
m_jsonSettings.erase("hid-forwarding");
|
||||
m_jsonSettings.erase("debug-gui");
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
Q_PROPERTY(QList<video_codec> allowedCodecs READ allowedCodecs NOTIFY encoderChanged)
|
||||
Q_PROPERTY(bool can10bit READ can10bit NOTIFY codecChanged)
|
||||
Q_PROPERTY(bool tenbit READ tenbit WRITE set_tenbit NOTIFY tenbitChanged)
|
||||
Q_PROPERTY(int bitrate READ bitrate WRITE set_bitrate NOTIFY bitrateChanged)
|
||||
|
||||
Q_PROPERTY(bool tcpOnly READ tcpOnly WRITE set_tcpOnly NOTIFY tcpOnlyChanged)
|
||||
Q_PROPERTY(QString application READ application WRITE set_application NOTIFY applicationChanged)
|
||||
@@ -85,7 +84,6 @@ public:
|
||||
SETTER_GETTER_NOTIFY(encoder_name, encoder)
|
||||
SETTER_GETTER_NOTIFY(video_codec, codec)
|
||||
SETTER_GETTER_NOTIFY(bool, tenbit)
|
||||
SETTER_GETTER_NOTIFY(int, bitrate)
|
||||
SETTER_GETTER_NOTIFY(QString, application)
|
||||
SETTER_GETTER_NOTIFY(bool, hidForwarding)
|
||||
SETTER_GETTER_NOTIFY(bool, debugGui)
|
||||
|
||||
Reference in New Issue
Block a user