Skip to content

Fix NvDec decoder stale state when cropping#1165

Merged
mthrok merged 1 commit intomainfrom
fix-nvdec-test
Nov 24, 2025
Merged

Fix NvDec decoder stale state when cropping#1165
mthrok merged 1 commit intomainfrom
fix-nvdec-test

Conversation

@mthrok
Copy link
Collaborator

@mthrok mthrok commented Nov 21, 2025

This commit address an issue where executing test_nvdec_decode_crop_resize before test_nvdec_decode_h264_420p_crop causes the latter to return wrong results
due to bad state left behind.

The fix involves modifying the NvDecDecoderCore::reset() method to properly clean up state,
including resetting crop, target width and height, and source information to default values.
This ensures that the thread-local cached decoder does not carry over stale parameters from previous test runs.

Modifying the NvDecDecoderCore is more elaborated, so, for now, we disable cache if crop is provided.

This commit also adds the stand alone test that would repro the issue without the patch.
Moved to #1186 as the test manifests a different issue.

Closes #1159

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 21, 2025
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Nov 21, 2025

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D87682390. (Because this pull request was imported automatically, there will not be any future comments.)

@mthrok mthrok changed the title Add test for NvDec state Fix NvDec decoder stale state Nov 22, 2025
@mthrok mthrok marked this pull request as ready for review November 22, 2025 00:07
@mthrok mthrok force-pushed the fix-nvdec-test branch 3 times, most recently from 3604ece to 7619393 Compare November 24, 2025 16:30
@mthrok mthrok changed the title Fix NvDec decoder stale state Fix NvDec decoder stale state when cropping Nov 24, 2025
@mthrok mthrok merged commit 8f13028 into main Nov 24, 2025
107 checks passed
@mthrok mthrok deleted the fix-nvdec-test branch November 24, 2025 22:11
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.

GPU Video Decoder test failure

1 participant