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

[camera_android] Don't override default fps range when not recording #8891

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

davidmartos96
Copy link
Contributor

@davidmartos96 davidmartos96 commented Mar 19, 2025

In production I have an app using the camera_android plugin that just uses the frame streaming feature. I've been pinning version 0.10.8+18 for a while because we found an issue after updating to 0.10.9. Some users reported a dark camera preview.

After some investigation, I believe the issue is because of the call to this.cameraFeatures.setFpsRange in the Camera constructor. That is the only difference in behavior that .9 and .8+18 have.

Fixes flutter/flutter#165491

From the linked issue I went with the second possible fix. Would that be a good approach?
Or should the fps setting also apply to the camera streaming and preview?
cc @camsim99

Pre-Review Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I linked to at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which test exemption this PR falls under1.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@davidmartos96 davidmartos96 marked this pull request as ready for review March 20, 2025 10:09
@davidmartos96 davidmartos96 requested a review from camsim99 as a code owner March 20, 2025 10:09
@camsim99
Copy link
Contributor

Left one concern on this approach in flutter/flutter#165491; otherwise, I'm ok moving forward!

@camsim99 camsim99 requested a review from a team March 22, 2025 13:06
@@ -1,3 +1,7 @@
## 0.10.10+2

* Don't set the FPS range unless video recording. It can cause dark image previews on some devices becuse the auto exposure algorithm is more constrained after fixing a min & max FPS value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this description to include the behavior change to users of this plugin that rely on the defaults? (even if that is no impact)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reidbaker Would this be more clear?

Don't set the FPS range unless video recording. It can cause dark image previews on some devices becuse the auto exposure algorithm is more constrained after fixing the min/max FPS range to the same value. This change has the side effect that providing the fps parameter will not affect the camera preview when not video recording. And if you need a lower frame rate in your image streaming handler, you can skip frames by checking the time it passed since the last frame.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great.

@davidmartos96

This comment was marked as outdated.

@jesswrd jesswrd added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 25, 2025
Copy link
Contributor

auto-submit bot commented Mar 25, 2025

autosubmit label was removed for flutter/packages/8891, because - The status or check suite Linux_android android_device_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 25, 2025
@davidmartos96

This comment was marked as outdated.

@davidmartos96
Copy link
Contributor Author

@jesswrd Can the autosubmit label be added again? It was removed because of a timeout on firebase test lab, but it succeeded after a few merges

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

Successfully merging this pull request may close these issues.

Dark camera preview on some Android devices
5 participants