[Android] Fix the thumbnail quality issue: downsampling and cache

Nicolas Pomepuy git at videolan.org
Tue Oct 6 10:58:46 CEST 2020


vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep 28 12:18:23 2020 +0200| [52d03a4269d1a209e511b5e5e65cb677a2e55288] | committer: Nicolas Pomepuy

Fix the thumbnail quality issue: downsampling and cache

Fixes #1477

(cherry picked from commit f8ccb3ea80e955d73954e52615de1f122766e159)

> https://code.videolan.org/videolan/vlc-android/commit/52d03a4269d1a209e511b5e5e65cb677a2e55288
---

 application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
index 8556e5429..c2580892a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
@@ -169,7 +169,7 @@ object AudioUtil {
         if (path.startsWith("http")) return runBlocking(Dispatchers.Main) {
             HttpImageLoader.downloadBitmap(path)
         }
-        return BitmapCache.getBitmapFromMemCache(path.substringAfter("file://")) ?: fetchCoverBitmap(path, width)
+        return BitmapCache.getBitmapFromMemCache(path.substringAfter("file://")+"_$width") ?: fetchCoverBitmap(path, width)
     }
 
     @WorkerThread
@@ -188,7 +188,7 @@ object AudioUtil {
 
             // Find the best decoding scale for the bitmap
             if (width > 0) {
-                while (options.outWidth / options.inSampleSize > width)
+                while (options.outWidth / (options.inSampleSize + 1) > width)
                     options.inSampleSize = options.inSampleSize * 2
             }
 



More information about the Android mailing list