AudioDecoder: fix chunk decoding when split is exactly at half a sample boundary - #1616
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1616
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 8 Cancelled Jobs, 3 Unclassified FailuresAs of commit dab26e6 with merge base 088c229 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 11, 2026 18:47
1620a94 to
86a2f3d
Compare
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 12, 2026 08:11
86a2f3d to
001fe6e
Compare
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 12, 2026 08:34
001fe6e to
518c346
Compare
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 12, 2026 08:34
518c346 to
6673bfa
Compare
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 12, 2026 09:10
6673bfa to
dab26e6
Compare
round() rounds ties to the nearest even sample, which isn't stable across range requests: each one converts its boundaries into offsets from its own first_pts, and how far that is from the boundary decides which of the two samples is the even one. Consecutive ranges could disagree about who owns the sample on their common boundary and return it twice, or not at all. Round ties up instead, which is invariant to that shift. Note that this means the two ends of a range have to be computed the same way: as an offset from first_pts. Deriving the end from the number of samples we got, as we did, negates the offset, and only round() is symmetric enough for that to give the same answer.
NicolasHug
force-pushed
the
audio-range-boundary-rounding
branch
from
August 12, 2026 09:21
dab26e6 to
ff0e666
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See non-regression test and comment. The fix is to make our
round()mechanism stable across calls.With the previous PRs below in this stack, this should correctly fix #1601
Closes #1601
Stack created with GitHub Stacks CLI • Give Feedback 💬