Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reversed logic when enumerating Linux device capabilities #127

Closed
gplwhite opened this issue Jan 9, 2024 · 3 comments
Closed

Reversed logic when enumerating Linux device capabilities #127

gplwhite opened this issue Jan 9, 2024 · 3 comments

Comments

@gplwhite
Copy link
Contributor

gplwhite commented Jan 9, 2024

I've been trying to diagnose why I cannot get Flashcap to correctly enumerate a built-in camera on a Raspberry PI (model 3 B+).

During my investigation I think I've discovered a flaw in the logic for enumerating the device capabilities - specifically related to the enumeration of the FramesPerSecond.

As commented in the code, while the V4L2 api reports the value as a time interval, Flashcap inverts this value to a FramesPerSecond value.
The minimum and maximum intervals are converted to their FPS value and used to filter a list of standardised frame rates.

However, the problem is that while the interval values have been inverted, the minimum and maximum values are still treated as a minimum and maximum when filtering the standardised rates. But the minimum and maximum meanings should also be swapped.

For example, if the interval values reported by the V4L2 api is:

min: 10/1
max: 30/1

this would be converted to FPS values of

min: 1/10
max: 1/30

1/10 is a larger value than 1/30 so the minimum and maximum meanings should be reversed:

min: 1/30
max: 1/10

Because the minimum value is larger than the maximum value, the fps >= min && fps <= max filtering constraint can never be true and no FramesPerSecond values are returned.

@gplwhite
Copy link
Contributor Author

gplwhite commented Jan 9, 2024

This will affect devices that report framerates as either Stepwise and Continuous values. Devices that report Discrete values will not be affected since the filtering is not performed.

@kekyo
Copy link
Owner

kekyo commented Jan 10, 2024

Thank you send PR, I'll review it in a couple of days!

@kekyo
Copy link
Owner

kekyo commented Jan 15, 2024

Thank you, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants