Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass BitmapPool for gif images #32

Closed
savvasdalkitsis opened this issue Nov 5, 2013 · 3 comments
Closed

Bypass BitmapPool for gif images #32

savvasdalkitsis opened this issue Nov 5, 2013 · 3 comments
Labels

Comments

@savvasdalkitsis
Copy link
Contributor

We load facebook avatars in one of our lists and it seems that some of them are GIFs.

We got some weird errors in our logs:

11-05 17:13:45.143  19634-19634/com.shazam.android E/GLIDE﹕ IP: onImageLoadException model= https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v2/y9/r/IB7NOFmPw2a.gif
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ java.lang.IllegalArgumentException: Problem decoding into existing bitmap
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:540)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.load.Downsampler.decodeStream(Downsampler.java:182)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.load.Downsampler.downsampleWithSize(Downsampler.java:114)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.load.Downsampler.downsample(Downsampler.java:98)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.load.ImageResizer.load(ImageResizer.java:113)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.ImageManager$ImageManagerRunner.resizeIfNotFound(ImageManager.java:573)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.ImageManager$ImageManagerRunner.access$1600(ImageManager.java:466)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at com.bumptech.glide.resize.ImageManager$ImageManagerRunner$1$1$1.run(ImageManager.java:554)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
11-05 17:13:45.143  19634-19634/com.shazam.android W/System.err﹕ at java.lang.Thread.run(Thread.java:841)

it seems that on Android, you cannot recycle a bitmap when it comes to GIFs. See the discussion here:

https://groups.google.com/forum/#!msg/android-developers/Mp0MFVFi1Fo/e8ZQ9FGdWdEJ

Can we have Glide bypass the pool when dealing with GIFs?

@sjudd
Copy link
Collaborator

sjudd commented Nov 5, 2013

This is definitely possible, thanks for pointing this out. If you're feeling particularly ambitious you can take a look in the Downsampler where we read the image header: https://github.com/bumptech/glide/blob/master/library/src/com/bumptech/glide/resize/load/Downsampler.java#L121

@savvasdalkitsis
Copy link
Contributor Author

Done. Please checkout pull request #36 and tell me if you think it is correct. It seems to work for us. The errors are gone :)

@sjudd
Copy link
Collaborator

sjudd commented Nov 9, 2013

Merged the pull request, this should be fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants