Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01ad812
Set higher resolution when using max preset
sergeidesenko Jul 30, 2023
5f5cabc
Merge remote-tracking branch 'upstream/main' into camera_avfoundation…
sergeidesenko Oct 27, 2023
f9f302f
chore: update changelog
sergeidesenko Oct 27, 2023
e5a33f6
chore: update changelog and pubspec
sergeidesenko Oct 27, 2023
d3ce411
refactor: add comments
sergeidesenko Oct 27, 2023
5813f25
chore: update pubspec
sergeidesenko Oct 27, 2023
60e043a
feat(tests): add convenience method for camera init
sergeidesenko Jan 22, 2024
9830404
feat(tests): add tests for setting resolutionPresets
sergeidesenko Jan 22, 2024
87b0c59
chore(tests): add tests file to .pbxproj
sergeidesenko Jan 22, 2024
0c29019
chore: fix formatting for updated files
sergeidesenko Jan 22, 2024
ae0210f
fix: don't update the changelog
sergeidesenko Jan 31, 2024
0c8b21a
refactor: remove todo and renaming
sergeidesenko Jan 31, 2024
37ffaa7
Merge remote-tracking branch 'upstream/main' into camera_avfoundation…
sergeidesenko Jan 31, 2024
70deac4
Merge branch 'main' into camera_avfoundation-max-resolution
sergeidesenko Feb 2, 2024
0fe1ac7
feat: add tests for different resolution presets
sergeidesenko Feb 2, 2024
c314755
refactor: update comment
sergeidesenko Feb 2, 2024
ec1b896
refactor: change tests to use DI
sergeidesenko Feb 2, 2024
5e6f1f5
refactor: rename method
sergeidesenko Feb 2, 2024
decce1e
refactor: rename method
sergeidesenko Feb 2, 2024
832cc7b
refactor: cleaner DI
sergeidesenko Feb 13, 2024
ddfe778
refactor: update comments
sergeidesenko Feb 21, 2024
5c01c8c
refactor: update comment to match arguments
sergeidesenko Feb 21, 2024
0c40901
refactor: rename types
sergeidesenko Feb 22, 2024
42e9cfa
Merge branch 'main' into camera_avfoundation-max-resolution
sergeidesenko Mar 1, 2024
8e019b3
refactor: address code review
sergeidesenko Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: remove todo and renaming
  • Loading branch information
sergeidesenko committed Jan 31, 2024
commit 0c8b21a277b941e0daba03613db56a55dd2f5aee
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: this file should be ...Tests.m, not ...Test.m, to follow our standard convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ - (void)testResolutionPresetWithCanSetSessionPresetMax_mustUpdateCaptureSessionP
OCMVerifyAll(videoSessionMock);
}

- (void)
testResolutionPresetWithCanSetSessionPresetUltraHigh_mustUpdateCaptureSessionPreset { // TODO
- (void)testResolutionPresetWithCanSetSessionPresetUltraHigh_mustUpdateCaptureSessionPreset {
NSString *expectedPreset = AVCaptureSessionPreset3840x2160;

id videoSessionMock = OCMClassMock([AVCaptureSession class]);
Expand Down
6 changes: 4 additions & 2 deletions packages/camera/camera_avfoundation/ios/Classes/FLTCam.m
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ - (NSString *)getTemporaryFilePathWithExtension:(NSString *)extension
- (BOOL)setCaptureSessionPreset:(FLTResolutionPreset)resolutionPreset withError:(NSError **)error {
switch (resolutionPreset) {
case FLTResolutionPresetMax: {
AVCaptureDeviceFormat *bestFormat = [self getHighestResolutionFormatFor:_captureDevice];
AVCaptureDeviceFormat *bestFormat =
[self getHighestResolutionFormatForCaptureDevice:_captureDevice];
if (bestFormat) {
_videoCaptureSession.sessionPreset = AVCaptureSessionPresetInputPriority;
if ([_captureDevice lockForConfiguration:NULL] == YES) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Never compare to YES; see go/objc-style#bool-expressions-and-conversions

Expand Down Expand Up @@ -425,7 +426,8 @@ - (BOOL)setCaptureSessionPreset:(FLTResolutionPreset)resolutionPreset withError:
}

/// Finds the highest available resolution in terms of pixel count for the given device
- (AVCaptureDeviceFormat *)getHighestResolutionFormatFor:(AVCaptureDevice *)captureDevice {
- (AVCaptureDeviceFormat *)getHighestResolutionFormatForCaptureDevice:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Drive-by nit: Obj-C methods should not start with "get".

(AVCaptureDevice *)captureDevice {
AVCaptureDeviceFormat *bestFormat = nil;
NSUInteger maxPixelCount = 0;
for (AVCaptureDeviceFormat *format in [_captureDevice formats]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: in _captureDevice.formats

Expand Down