audio: protection: fix weird volume limit behavior

This commit is contained in:
Fengzi
2025-12-04 15:37:52 -05:00
parent 8e704e4009
commit f62ab85a19
@@ -111,9 +111,9 @@ Singleton {
if (newVolume - lastVolume > maxAllowedIncrease) {
sink.audio.volume = lastVolume;
root.sinkProtectionTriggered(Translation.tr("Illegal increment"));
} else if (newVolume > maxAllowed || newVolume > root.hardMaxValue) {
} else if (Math.round(newVolume * 100) / 100 > maxAllowed || newVolume > root.hardMaxValue) {
root.sinkProtectionTriggered(Translation.tr("Exceeded max allowed"));
sink.audio.volume = Math.min(lastVolume, maxAllowed);
sink.audio.volume = maxAllowed;
}
lastVolume = sink.audio.volume;
}