[Android] Fix rounding for the volume change on some devices

Nicolas Pomepuy git at videolan.org
Mon Nov 18 12:53:35 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov  6 14:48:23 2024 +0100| [1b20c3aa19d1512d635f492ed21dc79693a7fd1f] | committer: Duncan McNamara

Fix rounding for the volume change on some devices

Fixes #3106

> https://code.videolan.org/videolan/vlc-android/commit/1b20c3aa19d1512d635f492ed21dc79693a7fd1f
---

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index ebe0d82cb2..9b5446e647 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1497,7 +1497,7 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
     private fun volumeDown() {
         service?.let { service ->
             var vol = if (service.volume > 100)
-                (service.volume.toFloat() * audioMax / 100 - 1).roundToInt()
+                (((service.volume * audioMax).div(100)) - 1)
             else
                 audiomanager.getStreamVolume(AudioManager.STREAM_MUSIC) - 1
             vol = vol.coerceAtLeast(0).coerceAtMost(audioMax * if (isAudioBoostEnabled) 2 else 1)



More information about the Android mailing list