audio: protection: fix weird volume limit behaviors (#2640)

This commit is contained in:
end-4
2025-12-05 10:38:33 +01:00
committed by GitHub
@@ -106,9 +106,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;
}