koral-- / android-gif-drawable

Views and Drawable for displaying animated GIFs on Android
Other
9.54k stars 1.78k forks source link

The abnormal invalidationDelay in RenderTask causes the animation to stop playing #829

Closed panpf closed 1 year ago

panpf commented 1 year ago

Symptom:

  1. Play animation for a while and then stop playing
  2. The playing time is not fixed, sometimes short and sometimes long
  3. There is no problem with the real device (only API 27 has been tested), and there is a problem with the Android emulator (API 24, 25, 26, 27, 28 have been tested with exceptions)

Debug found:

  1. By printing the log in debug mode, it is found that the abnormal invalidationDelay in RenderTask will cause the frame interval to be very long
  2. The normal invalidationDelay is around 90, and the abnormal invalidationDelay is around 450000

Test environment:

  1. Android emulator version v33.3.13
  2. Android version API 24, 25, 26, 27, 28 are abnormal
  3. android-gif-drawable version 1.2.15 and 1.2.27
  4. Mac book pro 2021 M1pro

Looking forward to your reply, thank you!

koral-- commented 1 year ago

Could you share a project/snippet reproducing this issue?

panpf commented 1 year ago

val imageView =... val gifDrawable = GifDrawable(context.assets, "dog.jpg") imageView.setImageDrawable(gifDrawable) gifDrawable.start()

koral-- commented 1 year ago

Play animation for a while and then stop playing

There is no play and stop in your snippet.

panpf commented 1 year ago

Sorry, less copy a line, already added in the previous one

koral-- commented 1 year ago

OK, there is a play but no stop. Also there is no printing anything to the log and no GIF file. Please post a complete example.

panpf commented 1 year ago

This is the test project: GifTest.zip

The screenshot below is the debug log:

Snipaste_2023-07-30_23-01-43 Snipaste_2023-07-30_23-03-24
panpf commented 1 year ago

It should be noted that this is not a problem with a certain gif, because the gif I got from the GIPHY API has the same problem

panpf commented 1 year ago

Has the problem been reproduced?

koral-- commented 1 year ago

No, I couldn't reproduce that. Tried on various emulators. I'll close this issue for now, but if there will be some new information I'll take a look.