[camera_avfoundation] Pigeon swift migration - part 1#10939
[camera_avfoundation] Pigeon swift migration - part 1#10939RobertOdrowaz wants to merge 1 commit intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request effectively refactors the camera package to remove its dependency on the mutability of MediaSettings, which is a necessary preparation for the upcoming Pigeon Swift migration. The changes are well-contained and logical, primarily by introducing a local framesPerSecond property in DefaultCamera and making FormatUtils.findBestFormat a pure function. I have one minor suggestion to improve code readability.
...ra/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FormatUtils.swift
Outdated
Show resolved
Hide resolved
5fc630a to
f4d2b57
Compare
| @@ -1,3 +1,7 @@ | |||
| ## 0.9.22+10 | |||
|
|
|||
| * Removes dependence on MediaSettings mutability. | |||
There was a problem hiding this comment.
could you explain more about what this means? Is it removing a feature?
There was a problem hiding this comment.
It doesn't remove any feature. It's just a refactor, I've described it in the description
Current implementation of FormatUtils.selectBestFormat overrides MediaSettings.framesPerSecond. With swift pigeon contracts MediaSettings is non mutable so that will no longer be possible.
MediaSettings class is generated by pigeon. And when pigeon output is ObjC its fields are mutable specifically framesPerSecond. This field is overwritten as a result of FormatUtils.selectBestFormat execution. When pigeon output is Swift all fields in MediaSettings are declared as let so selectBestFormat can no longer set it. Also in Swift framesPerSecond is an Int64 not NSNumber so it's not possible to assign floating point frame rate to it.
Prepares camera package for pigeon Swift migration as part of flutter/flutter#119109
Current implementation of
FormatUtils.selectBestFormatoverridesMediaSettings.framesPerSecond. With swift pigeon contractsMediaSettingsis non mutable so that will no longer be possible.Pre-Review Checklist
[shared_preferences]pubspec.yamlwith 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.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
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