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

Refactor MaxImageDimensionSubscriber #7850

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

emilk
Copy link
Member

@emilk emilk commented Oct 21, 2024

What

The change is that MaxImageDimensionSubscriber parses each .mp4 to figure out its size…
…except I disabled that check last-second because we don't have access to the VideoCache, and so this PR would lead to each video getting parsed twice.

Still, I would like to get this PR merged as a necessary refactor and generally improved structure.

This is where we're heading:
image

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

To run all checks from main, comment on the PR with @rerun-bot full-check.

@emilk
Copy link
Member Author

emilk commented Oct 21, 2024

Actually, I just realized this means each video is parsed twice, which is… not great. I'll look into giving MaxImageDimensionSubscriber access to VideoCache

@emilk emilk marked this pull request as draft October 21, 2024 14:39
@emilk emilk added exclude from changelog PRs with this won't show up in CHANGELOG.md 🚜 refactor Change the code, not the functionality and removed include in changelog labels Oct 21, 2024
@emilk emilk changed the title Fix heuristics: Put each video in its own spaceview Refactor MaxImageDimensionSubscriber Oct 21, 2024
Comment on lines +155 to +161
if true {
None // TODO(#7821): Use the VideoCache here so we make sure we only load each video ONCE
} else {
re_video::VideoData::load_from_bytes(&blob, &media_type)
.ok()
.map(|video| video.dimensions())
}
Copy link
Member Author

@emilk emilk Oct 21, 2024

Choose a reason for hiding this comment

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

This is the core of it. I'll work on having access to VideoCache here, and then we can resolve this in a follow-up PR.

…or we add functionality to re_mp4 to very quickly parse an .mp4 to only look for its size info 🤔

That would be easy if we had:

(…and used memory-mapping)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md 📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality 🎞️ video
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant