Fresco: Failure to load WebP images on Gingerbread

Created on 3 Aug 2017  路  3Comments  路  Source: facebook/fresco

Description

Images not being loaded on an older Samsung device - Samsung S3 mini.

It seems like there has been a major change in the image decoder and image purging which is now causing issues on particular devices.

The last version of Fresco this was NOT observed on was 0.14.1.

Additional Information

  • Fresco version: 1.0.0 and above
  • Platform version: Observed on Samsung GT-I9300 running Android 4.3 (API 18)

Relevant logs from both system and exception from onFailure Controller Listener using Fresco 1.4.0

E/OpenGLRenderer: Cannot generate texture from bitmap
E/OpenGLRenderer: Cannot generate texture from bitmap
W/System.err: java.lang.NullPointerException
W/System.err:     at com.facebook.imagepipeline.platform.GingerbreadPurgeableDecoder.decodeFileDescriptorAsPurgeable(GingerbreadPurgeableDecoder.java:134)
W/System.err:     at com.facebook.imagepipeline.platform.GingerbreadPurgeableDecoder.decodeJPEGByteArrayAsPurgeable(GingerbreadPurgeableDecoder.java:75)
W/System.err:     at com.facebook.imagepipeline.platform.DalvikPurgeableDecoder.decodeJPEGFromEncodedImage(DalvikPurgeableDecoder.java:89)
W/System.err:     at com.facebook.imagepipeline.platform.GingerbreadPurgeableDecoder.decodeJPEGFromEncodedImage(GingerbreadPurgeableDecoder.java:41)
W/System.err:     at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeJpeg(DefaultImageDecoder.java:187)
W/System.err:     at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:62)
W/System.err:     at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:125)
W/System.err:     at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:248)
W/System.err:     at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:112)
W/System.err:     at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:145)
W/System.err:     at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
W/System.err:     at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
W/System.err:     at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
W/System.err:     at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
W/System.err:     at java.lang.Thread.run(Thread.java:841)
bug

Most helpful comment

I can see the cause, inside WebpSupportStatus which doesn't set the static instance of the decoder.

If you're hitting this line, I assume your ImagePipelineConfig requests the WebpSupportEnabled experiment and that this is a WebP image.

I'll fix the bug but the good news is that you don't need to enable that flag to have WebP images work. It's not a well-named method so I'll add a meaningful Javadoc to that too.

All 3 comments

I can see the cause, inside WebpSupportStatus which doesn't set the static instance of the decoder.

If you're hitting this line, I assume your ImagePipelineConfig requests the WebpSupportEnabled experiment and that this is a WebP image.

I'll fix the bug but the good news is that you don't need to enable that flag to have WebP images work. It's not a well-named method so I'll add a meaningful Javadoc to that too.

When I came to fix this I found the decoder should be set after all. I'm going to return to this though when I have time.

Have you tried turning off the flag and did that help?

Hi @kirwan ,
I found codes in ImagePipelineConfig.java

      // We check using introspection only if the experiment is enabled
      if (mImagePipelineExperiments.isWebpSupportEnabled() &&
          WebpSupportStatus.sIsWebpSupportRequired) {
        webpBitmapFactory = WebpSupportStatus.loadWebpBitmapFactoryIfExists();
        if (webpBitmapFactory != null) {
          BitmapCreator bitmapCreator = new HoneycombBitmapCreator(getPoolFactory());
          setWebpBitmapFactory(webpBitmapFactory, mImagePipelineExperiments, bitmapCreator);
        }
      }

As you can see, if running on android 4.3, WebpSupportStatus.sIsWebpSupportRequired is false when turn on the flag.
So there is no chance to execute the method WebpSupportStatus.loadWebpBitmapFactoryIfExists().
However, the method buildPlatformDecoder() in ImagePipelineFactory returns GingerbreadPurgeableDecoder. The NPE thrown when GingerbreadPurgeableDecoder decoding file via the sWebpBitmapFactory.

It's very confused to me 馃槩

Was this page helpful?
0 / 5 - 0 ratings