[camera_windows] Support camera on windows desktop platform #4641
Conversation
31bf2d3
to
f188352
Compare
- Moved event handling to the capture_controller - When camera is detached - When camera is already in use
- Fix memory leaks found by tests
1dddfdd
to
8a80e1c
Compare
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.
I did another pass over the metadata and Dart and skimmed the C++ headers. I found a few things that I'd missed before; mostly they are very minor but the main things are:
- The Dart code not having unit tests
- The C++ code not having class comments
Both are maintainability issues, so definitely need to be addressed.
Having also tried out the example: something we should file an issue to track for follow-up if it's not already filed is preview mirroring. This has been an issue on mobile with front-facing cameras, and on desktop that's going to be the normal case, so we'll want to handle it. |
@stuartmorgan mirror mode is actually already supported (by software flip) but by default set to |
Overall LGTM modulo a few minor fixes that I've prepared in a branch to make them easier to patch in. That branch includes minor fixes for three categories of issues:
You should be able to patch them in via:
Apologies if the above is old-hat to you, it's always hard to tell how much git-related pain any given contributor has suffered through in the past :) Once those commits are merged, I think this looks good to me! |
There were a few places where strings were being passed by value. Instead, pass by const reference.
@cbracken thanks, good tweaks. |
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.
Changes LGTM (I didn't do a full re-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.
This PR adds a Windows Desktop implementation of camera plugin using Media Foundation and CaptureEngine interface.
The implementation supports multiple cameras, video preview, and capturing photos and videos. Works with camera plugin and camera example.
The current implementation uses FlutterDesktopPixelBuffer, but could be switched to use shared textures or Platform views after those are supported.
Unit tests are partially done; for the CaptureControllerImpl class all falilure code paths are not yet covered.
Still missing some features, like exposure and focus controls. These can be done later with interfaces IAMCameraControl and IAMVideoProcAmp,
Resolves flutter/flutter#41709: [camera] Add Windows support
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.