Add bitrate auto-adjustment toggle and reset button

This change adds a 'Use Default' button next to the bitrate slider that resets the bitrate to the default value for the current resolution/FPS. It also implements an autoAdjustBitrate setting that controls whether the bitrate is automatically updated when resolution/FPS/YUV444 settings change.

- When the user manually adjusts the bitrate slider, autoAdjustBitrate is set to false
- When the user clicks the 'Use Default' button, autoAdjustBitrate is set to true
- Bitrate is only updated automatically when settings change if autoAdjustBitrate is true
This commit is contained in:
MoreOrLessSoftware
2025-03-24 13:17:10 -07:00
committed by Cameron Gutman
parent 9c9bfd8428
commit e807a52cfa
3 changed files with 62 additions and 29 deletions
+3
View File
@@ -16,6 +16,7 @@
#define SER_FPS "fps"
#define SER_BITRATE "bitrate"
#define SER_UNLOCK_BITRATE "unlockbitrate"
#define SER_AUTOADJUSTBITRATE "autoadjustbitrate"
#define SER_FULLSCREEN "fullscreen"
#define SER_VSYNC "vsync"
#define SER_GAMEOPTS "gameopts"
@@ -122,6 +123,7 @@ void StreamingPreferences::reload()
enableYUV444 = settings.value(SER_YUV444, false).toBool();
bitrateKbps = settings.value(SER_BITRATE, getDefaultBitrate(width, height, fps, enableYUV444)).toInt();
unlockBitrate = settings.value(SER_UNLOCK_BITRATE, false).toBool();
autoAdjustBitrate = settings.value(SER_AUTOADJUSTBITRATE, true).toBool();
enableVsync = settings.value(SER_VSYNC, true).toBool();
gameOptimizations = settings.value(SER_GAMEOPTS, true).toBool();
playAudioOnHost = settings.value(SER_HOSTAUDIO, false).toBool();
@@ -312,6 +314,7 @@ void StreamingPreferences::save()
settings.setValue(SER_FPS, fps);
settings.setValue(SER_BITRATE, bitrateKbps);
settings.setValue(SER_UNLOCK_BITRATE, unlockBitrate);
settings.setValue(SER_AUTOADJUSTBITRATE, autoAdjustBitrate);
settings.setValue(SER_VSYNC, enableVsync);
settings.setValue(SER_GAMEOPTS, gameOptimizations);
settings.setValue(SER_HOSTAUDIO, playAudioOnHost);
+3
View File
@@ -110,6 +110,7 @@ public:
Q_PROPERTY(int fps MEMBER fps NOTIFY displayModeChanged)
Q_PROPERTY(int bitrateKbps MEMBER bitrateKbps NOTIFY bitrateChanged)
Q_PROPERTY(bool unlockBitrate MEMBER unlockBitrate NOTIFY unlockBitrateChanged)
Q_PROPERTY(bool autoAdjustBitrate MEMBER autoAdjustBitrate NOTIFY autoAdjustBitrateChanged)
Q_PROPERTY(bool enableVsync MEMBER enableVsync NOTIFY enableVsyncChanged)
Q_PROPERTY(bool gameOptimizations MEMBER gameOptimizations NOTIFY gameOptimizationsChanged)
Q_PROPERTY(bool playAudioOnHost MEMBER playAudioOnHost NOTIFY playAudioOnHostChanged)
@@ -149,6 +150,7 @@ public:
int fps;
int bitrateKbps;
bool unlockBitrate;
bool autoAdjustBitrate;
bool enableVsync;
bool gameOptimizations;
bool playAudioOnHost;
@@ -185,6 +187,7 @@ signals:
void displayModeChanged();
void bitrateChanged();
void unlockBitrateChanged();
void autoAdjustBitrateChanged();
void enableVsyncChanged();
void gameOptimizationsChanged();
void playAudioOnHostChanged();