Fix vcam_enum_framesizes to enumerate all sizes when scaling is enabled#44
Merged
Merged
Conversation
jserv
requested changes
May 29, 2026
Collaborator
jserv
left a comment
There was a problem hiding this comment.
Read https://cbea.ms/git-commit/ carefully and enforce the rules.
Collaborator
|
Provide test cases to reproduce. |
When scaling is enabled (conv_res_on), vcam_enum_framesizes previously duplicated a branch that returned only the current output size with a hardcoded index guard of > 0, making it impossible to enumerate all supported sizes. Remove the redundant branch and iterate over vcam_sizes[] with proper bounds checking using ARRAY_SIZE(vcam_sizes).
c069436 to
ca444a0
Compare
Contributor
Author
|
I've modified my commit message. |
Contributor
Author
|
test case to reproduce: This test case verifies that sudo insmod vcam.ko allow_scaling=1
sudo ./vcam-util -l # find the device node, e.g. /dev/video0
v4l2-ctl -d /dev/video0 --list-framesizes=RGB3 # replace with actual device node
sudo rmmod vcamoutput before fix: output after fix: |
Collaborator
|
Thank @davidzwei for contributing! |
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.
When scaling is enabled,
vcam_enum_framesizesonly returned one frame size because the index guard was never updated after the branch was changed. The original else block also became unreachable dead code.Fix by removing the dead code and enumerating
vcam_sizes[]by index.Summary by cubic
Fixes vcam_enum_framesizes to return all discrete frame sizes instead of only the current output size when scaling is enabled. Removes redundant branches and adds proper bounds checking.
vcam_sizes[fsize->index]with>= ARRAY_SIZE(vcam_sizes)guard to enumerate all discrete sizes.conv_res_onduplicate path and the unreachable stepwise branch.Written for commit ca444a0. Summary will update on new commits.