Skip to content

Fix audio resampling: decoding in chunks should return identical samples to decoding in one go - #1614

Merged
NicolasHug merged 7 commits into
mainfrom
audio-resampler-alignment
Aug 12, 2026
Merged

Fix audio resampling: decoding in chunks should return identical samples to decoding in one go#1614
NicolasHug merged 7 commits into
mainfrom
audio-resampler-alignment

Conversation

@NicolasHug

@NicolasHug NicolasHug commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This is a fix for the audio decoder when resampling happens: a resampled stream in consecutive chunks must return exactly the same samples as decoding it in one go. See test_resample_chunked_matches_full for the desired behavior and see the two big Notes I added for details on the solution. In the main lines: we must align the input and output 'grid' for the resampler to output the right samples, and we enforce that through preroll + skipping some samples.

This should address most of #1601 and specifically #1601 (comment)

Stack created with GitHub Stacks CLIGive Feedback 💬

@pytorch-bot

pytorch-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1614

Note: Links to docs will display an error until the docs builds have been completed.

❌ 5 New Failures, 16 Pending

As of commit 2c0db37 with merge base 1f36e84 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 11, 2026
Replaces [Resampler Grid Alignment] and [Resampler Preroll] with two
notes that explain the problem with diagrams instead of prose, and that
say how the pre-roll is sized.
@NicolasHug
NicolasHug force-pushed the audio-resampler-alignment branch from c75f51f to a97d5d6 Compare August 11, 2026 18:47
@NicolasHug NicolasHug added the bug Something isn't working label Aug 12, 2026
@NicolasHug

NicolasHug commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

There are minor test failures on FFmpeg <= 6, I'm going to ignore them here as they seem to be green on the follow-up PRs. I suspect it's exactly what #1615 fixes.

@NicolasHug NicolasHug changed the title audio resampler alignment Fix audio resampling: decoding in chunks should return identical samples to decoding in one go Aug 12, 2026
@NicolasHug
NicolasHug merged commit de0340f into main Aug 12, 2026
71 of 78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 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.

1 participant