Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[camera]manages ios camera's orientation states on capture session queue#4748

Merged
fluttergithubbot merged 2 commits intoflutter:mainfrom
hellohuanlin:camera_orientation_queue
Feb 8, 2022
Merged

[camera]manages ios camera's orientation states on capture session queue#4748
fluttergithubbot merged 2 commits intoflutter:mainfrom
hellohuanlin:camera_orientation_queue

Conversation

@hellohuanlin
Copy link
Contributor

@hellohuanlin hellohuanlin commented Feb 7, 2022

This PR moves iOS camera's orientation updates to the session queue.

As discussed in the proposal under "Overview" section:

Session queue: handles all camera operations, including capture session setup, sample buffer processing, camera state management (for example, isRecording, isStreamingImages)

and under the list of violation of the "Thread safety for state access" section:

Multiple orientation related states are mutated in both session queue and main queue

Issue here: flutter/flutter#96429

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki 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/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed 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 this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@hellohuanlin hellohuanlin force-pushed the camera_orientation_queue branch from 7978ee8 to cbeacff Compare February 7, 2022 20:53
@hellohuanlin hellohuanlin marked this pull request as ready for review February 7, 2022 20:54
Comment on lines +17 to +18
/// An internal camera object that manages camera's state and performs camera operations.
@property(nonatomic, strong) FLTCam *camera;
Copy link
Member

Choose a reason for hiding this comment

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

I don't love that this is exposed as readwrite now, but I can't think of a better way to do it since a test-only convenience initializer isn't great either since FLTCam is created later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh this was supposed to be readwrite in the first place. The old readonly worked before only because we used the ivar and bypassed the attribute's restriction:

      _camera = cam;

Copy link
Member

Choose a reason for hiding this comment

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

readwrite in the implementation though, not to, say, consumers of the plugin (who can also import the test module). But it's fine I don't have a better idea for testing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah should be fine. we already have many internal APIs exposed under this test module (eg CameraPlugin_Test.h). it's very unlikely for non-test code to import it.

@hellohuanlin hellohuanlin added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Feb 7, 2022
@fluttergithubbot fluttergithubbot merged commit 6b7083f into flutter:main Feb 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p: camera platform-ios waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants