Open tprochazka opened 3 years ago
You could try setExecutor(AsyncTask.SERIAL_EXECUTOR)
to see if this makes a difference. However, BitmapRegionDecoder is synchronized and the use of THREAD_POOL_EXECUTOR
is simply to reduce contention with other tasks running in the app, tiles are not actually decoded in parallel. I suspect this is an issue in Android code or Skia.
I had never heard of HEIC before now. I can't find anything conclusive but I suspect Skia might not fully support it.
I found the solution here https://stackoverflow.com/questions/65643305/heifdecoderimpl-causes-decstrong-called-too-many-times It is a workaround, the issue happens only with Bitmap.Config.RGB_565
That's useful info, thanks. I don't think this can be the default though, as the library is not aware of the format of the image it's showing. Are you happy for this to be closed?
It is not related to the image format. Bitmap.Config.HARDWARE can be and should be used as the default for all current devices. It saves heap memory and keeps data just in graphics memory. It is available since API 26, but until API 28 it is problematic on some devices. Coil library has excellent detection for that
I think that this issue is still valid for this library, at least for other developers that are stuck on it, as a workaround to fix it. Until it is fixed or at least mentioned in README. But it is, of course, your decision..
I'm reluctant to make changes when I don't know what the impact will be and can't support the library properly. Developers can override the default bitmap config if they need to.
the answer helps me, thanks!!!
Hard to say now if it is an Android bug or this library issue. But when I use it with HEIC it always crashes on Android 11, I tested the emulator and also the Samsung device.
Maybe it is because it creates too many parallel decoding threads because normal decoding of one heic image works without a crash. It crashes only when I zoom in enough to enable the tiling mechanism.