Skip to content

Fixes some issues with GIF images in the reader.#13906

Merged
diegoreymendez merged 2 commits intodevelopfrom
issue/13895-reader-dropping-frames-while-scrolling
Apr 20, 2020
Merged

Fixes some issues with GIF images in the reader.#13906
diegoreymendez merged 2 commits intodevelopfrom
issue/13895-reader-dropping-frames-while-scrolling

Conversation

@diegoreymendez
Copy link
Copy Markdown
Contributor

@diegoreymendez diegoreymendez commented Apr 15, 2020

Fixes #13895 (well kind of, read on).

The issue in #13895 is that the GIFs were really large, so we kept loading frames at all times. This PR changes the amount of frames in the buffer to 300, which means there will be no more jumps when scrolling the reader AFTER THE GIF IS DONE LOADING.

There will still be some jumps before the GIFs finish loading, and fixing this IMHO is not great in terms of efforts vs benefit.

Additionally, an issue in the reader was causing attachments to be loaded twice, so these GIFs were animating twice. This was caused by a strong reference to the images held by a the mediaArray we're removing.

To test:

  1. Load in the reader the post shown in p4a5px-2xT-p2.
  2. Make sure that after the GIFs are done loading for good, scrolling is smooth in that post.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

return nil
}
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Apr 15, 2020

You can trigger an installable build for these changes by visiting CircleCI here.

@diegoreymendez
Copy link
Copy Markdown
Contributor Author

Fyi, @yaelirub

@peril-wordpress-mobile
Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

Copy link
Copy Markdown
Contributor

@leandroalonso leandroalonso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diegoreymendez after the GIF is loaded the scroll is smooth. :)

Just a question, this is an issue only with big GIFs?

@diegoreymendez
Copy link
Copy Markdown
Contributor Author

diegoreymendez commented Apr 16, 2020

@leandroalonso - The core issue was that loading the frames was consuming a lot of CPU. The reason why the jumpy behavior never ended before was that the GIF had more frames than the buffer size (141 frames in the gif vs 50 in our buffer).

So the number of frames is one factor but I believe the file size is probably a factor too, as loading larger frames would consume more cpu.

Additionally we were loading all media twice and animating twice, which also consumed more memory and CPU.

I’ll want to profile this a bit more before merging, so let me know if you have any other concern.

@loremattei loremattei modified the milestones: 14.7 ❄️, 14.8 Apr 20, 2020
@loremattei
Copy link
Copy Markdown
Contributor

Hey! I'm moving this to 14.8 because 14.7 has been cut. If you want this to make it to 14.7, please feel free to ping me.

@diegoreymendez
Copy link
Copy Markdown
Contributor Author

I've tested in all of my devices and haven't found any issue with the new code. I'm merging.

@diegoreymendez diegoreymendez merged commit a5339a7 into develop Apr 20, 2020
@diegoreymendez diegoreymendez deleted the issue/13895-reader-dropping-frames-while-scrolling branch April 20, 2020 15:33
@staskus staskus mentioned this pull request Jul 21, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reader dropping frames while scrolling

4 participants