Reset FPS & bandwidth limits when switching video profile from custom to another one

This commit is contained in:
Sylvain Berfini 2023-06-13 10:06:47 +02:00
parent 32f4307674
commit 463ade0ade

View file

@ -87,7 +87,17 @@ class VideoSettingsViewModel : GenericSettingsViewModel() {
val videoPresetListener = object : SettingListenerStub() {
override fun onListValueChanged(position: Int) {
videoPresetIndex.value = position // Needed to display/hide two below settings
core.videoPreset = videoPresetLabels.value.orEmpty()[position]
val currentPreset = core.videoPreset
val newPreset = videoPresetLabels.value.orEmpty()[position]
if (newPreset != currentPreset) {
if (currentPreset == "custom") {
// Not "custom" anymore, reset FPS & bandwidth
core.preferredFramerate = 0f
core.downloadBandwidth = 0
core.uploadBandwidth = 0
}
core.videoPreset = newPreset
}
}
}
val videoPresetIndex = MutableLiveData<Int>()