Skip to content

fix: add missing num_threads param to decode_avif disabled stub - #1671

Merged
NicolasHug merged 1 commit into
meta-pytorch:mainfrom
andre-motta:fix/decode-avif-stub-signature
Aug 24, 2026
Merged

fix: add missing num_threads param to decode_avif disabled stub#1671
NicolasHug merged 1 commit into
meta-pytorch:mainfrom
andre-motta:fix/decode-avif-stub-signature

Conversation

@andre-motta

Copy link
Copy Markdown
Contributor

Fixes #1670

Summary

The #if !TORCHCODEC_ENABLE_AVIF stub for decode_avif in DecodeAvif.cpp is missing the num_threads parameter that the header (DecodeAvif.h) declares and the enabled implementation uses. This causes libtorchcodec_image.so to have an undefined symbol when built with TORCHCODEC_BUILD_AVIF=0, which makes import torchcodec fail at runtime.

The fix adds the missing [[maybe_unused]] int64_t num_threads parameter to the disabled stub so its signature matches the header declaration.

Test plan

  • Build with TORCHCODEC_BUILD_AVIF=0 and verify import torchcodec succeeds
  • Verify decode_avif() raises the expected "not compiled with libavif support" error instead of a symbol resolution crash

The disabled-AVIF stub for decode_avif declares 3 parameters (input,
mode, output_dtype) but the header in DecodeAvif.h declares 4 (adding
num_threads). When building with TORCHCODEC_BUILD_AVIF=0, the linker
leaves the 4-parameter symbol unresolved, causing an OSError at runtime
when libtorchcodec_image.so is loaded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Andre Lustosa <alustosa@redhat.com>
@pytorch-bot

pytorch-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 16 Pending

As of commit d7ddd10 with merge base be6d503 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-cla

meta-cla Bot commented Aug 24, 2026

Copy link
Copy Markdown

Hi @andre-motta!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 24, 2026
@meta-cla

meta-cla Bot commented Aug 24, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@NicolasHug NicolasHug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @andre-motta

@NicolasHug
NicolasHug merged commit 60db9be into meta-pytorch:main Aug 24, 2026
96 checks passed
@andre-motta
andre-motta deleted the fix/decode-avif-stub-signature branch August 24, 2026 15:25
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.

decode_avif stub has wrong signature when built with TORCHCODEC_BUILD_AVIF=0

2 participants