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

fix: Use 0x0 as a fallback Size if SENSOR_INFO_PHYSICAL_SIZE is null (e.g. on USB cameras) #2608

Merged

Conversation

BrainLei
Copy link
Contributor

…cs cannot get the SENSOR_INFO_PHYSICAL_SIZE value of the camera device

What

Changes

Tested on

Related issues

…cs cannot get the SENSOR_INFO_PHYSICAL_SIZE value of the camera device
Copy link

vercel bot commented Feb 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2024 2:50am

@mrousavy mrousavy changed the title 2602:There is a NullPointerException here because CameraCharacteristi… fix: Use 0x0 as a fallback Size if SENSOR_INFO_PHYSICAL_SIZE is null (e.g. on USB cameras) Feb 27, 2024
@mrousavy
Copy link
Owner

Hey - thanks for the PR this is a good fix. I'm hoping a size of 0x0 won't cause any issues later, e.g. divisions by zero in zooming or similar. But we'll see.

Did you run yarn check-all in the package/ directory? Looks like it is not formatted properly, please do that.

@mrousavy
Copy link
Owner

Actually it is formatted properly - nevermind!

@BrainLei
Copy link
Contributor Author

BrainLei commented Feb 28, 2024

Hey - thanks for the PR this is a good fix. I'm hoping a size of 0x0 won't cause any issues later, e.g. divisions by zero in zooming or similar. But we'll see.

Did you run yarn check-all in the package/ directory? Looks like it is not formatted properly, please do that.

Hi, Mrousavy
I think it should not affect the zoom operation because:
1 sensorSize seems to be only used in the calling path of getDeviceTypes->getMaxFieldOfView->getFieldOfView, and not used elsewhere.
2 Generally, when the SENSOR_INFO_PHYSICAL_SIZE value cannot be obtained, the camera will not be used as a preview scene.

@BrainLei
Copy link
Contributor Author

Actually it is formatted properly - nevermind!

I tested yarn check-all on the main branch, and these Formatting errors also exist.
The error is as follows:
Formatting Swift code.. error: SwiftFormat not installed, install with 'brew install swiftformat' (or manually from https://github.com/nicklockwood/SwiftFormat) Linting Swift code.. error: SwiftLint not installed, install with 'brew install swiftlint' (or manually from https://github.com/realm/SwiftLint) Linting Kotlin code.. error: KTLint not installed, install with 'brew install ktlint' (or manually from https://github.com/pinterest/ktlint) Formatting C++ code.. error: clang-format not installed, install with 'brew install clang-format' (or manually from https://clang.llvm.org/docs/ClangFormat.html) Linting JS/TS code..

@mrousavy mrousavy merged commit e8dd1e0 into mrousavy:main Feb 29, 2024
5 checks passed
@mrousavy
Copy link
Owner

lgtm!

@mrousavy
Copy link
Owner

the error is btw that you didnt install the tools. you need them to format.

@BrainLei
Copy link
Contributor Author

BrainLei commented Mar 4, 2024

tools

I get it, I will install the tools immediately, thank you

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

Successfully merging this pull request may close these issues.

None yet

2 participants