Skip to content

Conversation

@NicolasHug
Copy link
Contributor

@NicolasHug NicolasHug commented Nov 11, 2025

This is a minor simplification that I hope will make #1028 easier to understand.

I'm trying to explain in plain english what the simplification is doing, but anything I come up with is a lot more complicated than just looking at the code. I hope it makes sense.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2025
@NicolasHug NicolasHug marked this pull request as ready for review November 11, 2025 17:07
Copy link
Contributor

@scotts scotts left a comment

Choose a reason for hiding this comment

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

Agreed this is better - we should try to consolidate seeking avoidance logic in canWeAvoidSeeking().

// For audio, we only need to seek if a backwards seek was requested
// within getFramesPlayedInRangeAudio(), when setCursorPtsInSeconds() was
// called. For more context, see [Audio Decoding Design]
return !cursorWasJustSet_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this can now be just return true. Should the comment above it also be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the comment about only needing to seek when backwards is relevant.

Logically yes, we could just return true here now, but that would make the logic of this if block dependent on the existence of the previous one. I.e. if we were to change it to true and later remove the new

  if (!cursorWasJustSet_) {
    return true;
  }

then we'd be changing the behavior and that wouldn't be trivial to notice.

Actually, I might move the new condition below the audio one to avoid just that.

@NicolasHug NicolasHug merged commit 982102b into meta-pytorch:main Nov 12, 2025
63 of 70 checks passed
@NicolasHug NicolasHug deleted the simplify_skip branch November 12, 2025 10:59
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.

2 participants