Skip to content

Conversation

@ahmadsharif1
Copy link
Contributor

This PR does:

  1. Ensures we don't read keyFrames[-1] when trying to seek before the first keyFrame. Note that our function returns the last keyframe whose pts is <= to the desired pts. And it returns -1 if no such keyframe is found.
  2. We also use a single function to convert seconds to pts. Here we do a call to std::round() to ensure that we go back to int64 as faithfully as possible. Previously we were truncating and that could lead to off-by-one errors.

This fixes #307 (in particular, (1) fixes that)

I added a test for (1) but adding a test for (2) requires a lot of precise video editing that I haven't done.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2024
@ahmadsharif1 ahmadsharif1 merged commit b979201 into meta-pytorch:main Nov 4, 2024
37 of 40 checks passed
@ahmadsharif1 ahmadsharif1 deleted the negative1 branch November 4, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We could potentially access invalid memory while seeking

3 participants