change imageId in AnimatedImageResult from the class hash to decodeHa… #2612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I create an issue a few days ago, #2605, I'm kind of dying to know if this is a bug? And if this is, is my way of fixing it appropriate?
Motivation (required)
Fix issue where fresco fails to cache accurately the gif frames.
What existing problem does the pull request solve?
First,I want to talk briefly about the Fresco gif cache:
When the encode cache is decoded to memory cache, the encodeImage will be decoded and packed into AnimatedImage, and finally will be decoded into CloseableReference.
Like this:
1,AnimatedImage( GifImage implement AnimatedImage)contain the info of gif like loopCount, frameCount and encode frames bytes .
2,CloseableReference,a closeable bitmap, expression each frame memory cache and decoded by encode frames bytes .
But, AnimatedImage was further encapsulated as a new AnimatedImageResult object. At that Time, AnimatedImageResult hashCode changed every time.So encodeImage was fixed, but AnimatedImageResult that decoded by encodeImage changes. That's why decoded memory is disabled while encode memory is enabled.
Test Plan
Load the same GIF multiple times, and :
Like the image in the Gif cache doesn't seem to be working. #2605 shows.
Next Steps
Could I know when will you fix this bug and which way will be select? Maybe merge this PR or you have other ideas.
I look forward to your reply.😁