-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add FPS Props for Linux Cameras #487
Conversation
@edaniels @bazile-clyde Tagging for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but can you write a few tests for this to make sure fitness is still working well 🏋️ ?
@edaniels Added tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for adding tests
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #487 +/- ##
==========================================
+ Coverage 58.83% 59.02% +0.19%
==========================================
Files 63 63
Lines 3826 3854 +28
==========================================
+ Hits 2251 2275 +24
- Misses 1444 1446 +2
- Partials 131 133 +2
☔ View full report in Codecov by Sentry. |
if denominator == 0 { | ||
return 0, errors.New("framerate denominator is zero") | ||
} | ||
// round to three decimal places to avoid floating point precision issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment here. Saved me a head scratch 😅
pkg/prop/prop.go
Outdated
// Note this also affect screen caputre as screen.Properties does not fill in the Framerate field. | ||
// cmps.add(p.FrameRate, o.FrameRate) | ||
// skip framerate if not requested by constraints and available in driver props | ||
if p.FrameRate != nil && o.FrameRate > 0.0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmps.add
already checks if p.FrameRate == nil
and will do nothing if it is. I don't think that check is needed here too. It does not check if o.FrameRate
is greater than 0.0
though. I think that should be handled by the compare method in the constraint interface itself like FrameFormatConstraint
. That appears to be what the other constraints do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point - can safely remove constraint check.
Cleaning up git history in preparation for merge. |
Description
This PR allows for retrieving and setting FPS properties on Linux cameras. Like FrameSize,
Discrete
andStepwise
FrameRate returns are supported.A simple check is added in the
fitness
function to avoid adding fps comparisons on MacOS and Screen drivers.Implementation depends on this blackjack/webcam PR.
Update: fps pr for blackjack/webcam has been merged!
Testing
Manual tests
Make sure there are no regressions across platforms (fitness distance is not affected).
Go tests
float
andFrameRate
matching inprop_test.go
. Includes cases where FPS is not available.calcFramerate
incamera_linux_test.go
.