Thanks to visit codestin.com
Credit goes to github.com

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

[camera] Switch app-facing package to new analysis options #4808

Merged
merged 7 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 9 additions & 8 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
## NEXT
## 0.9.4+12

* Skips unnecessary AppDelegate setup for unit tests on iOS.

* Internal code cleanup for stricter analysis options.

## 0.9.4+11

* Manages iOS camera's orientation-related states on a background queue to prevent potential race conditions.
* Manages iOS camera's orientation-related states on a background queue to prevent potential race conditions.

## 0.9.4+10

* iOS performance improvement by moving file writing from the main queue to a background IO queue.
* iOS performance improvement by moving file writing from the main queue to a background IO queue.

## 0.9.4+9

* iOS performance improvement by moving sample buffer handling from the main queue to a background session queue.
* Minor iOS internal code cleanup related to camera class and its delegate.
* iOS performance improvement by moving sample buffer handling from the main queue to a background session queue.
* Minor iOS internal code cleanup related to camera class and its delegate.
* Minor iOS internal code cleanup related to resolution preset, video format, focus mode, exposure mode and device orientation.
* Minor iOS internal code cleanup related to flash mode.

Expand All @@ -23,12 +24,12 @@

## 0.9.4+7

* Fixes a crash in iOS when passing null queue pointer into AVFoundation API due to race condition.
* Fixes a crash in iOS when passing null queue pointer into AVFoundation API due to race condition.
* Minor iOS internal code cleanup related to dispatch queue.

## 0.9.4+6

* Fixes a crash in iOS when using image stream due to calling Flutter engine API on non-main thread.
* Fixes a crash in iOS when using image stream due to calling Flutter engine API on non-main thread.

## 0.9.4+5

Expand Down
1 change: 0 additions & 1 deletion packages/camera/camera/analysis_options.yaml

This file was deleted.

28 changes: 15 additions & 13 deletions packages/camera/camera/example/integration_test/camera_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import 'dart:ui';
import 'package:camera/camera.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path_provider/path_provider.dart';
import 'package:video_player/video_player.dart';
import 'package:integration_test/integration_test.dart';

void main() {
late Directory testDir;
Expand Down Expand Up @@ -59,7 +59,7 @@ void main() {
'Capturing photo at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');

// Take Picture
final file = await controller.takePicture();
final XFile file = await controller.takePicture();

// Load picture
final File fileImage = File(file.path);
Expand All @@ -78,9 +78,9 @@ void main() {
if (cameras.isEmpty) {
return;
}
for (CameraDescription cameraDescription in cameras) {
for (final CameraDescription cameraDescription in cameras) {
bool previousPresetExactlySupported = true;
for (MapEntry<ResolutionPreset, Size> preset
for (final MapEntry<ResolutionPreset, Size> preset
in presetExpectedSizes.entries) {
final CameraController controller =
CameraController(cameraDescription, preset.key);
Expand Down Expand Up @@ -110,7 +110,7 @@ void main() {
// Take Video
await controller.startVideoRecording();
sleep(const Duration(milliseconds: 300));
final file = await controller.stopVideoRecording();
final XFile file = await controller.stopVideoRecording();

// Load video metadata
final File videoFile = File(file.path);
Expand All @@ -132,9 +132,9 @@ void main() {
if (cameras.isEmpty) {
return;
}
for (CameraDescription cameraDescription in cameras) {
for (final CameraDescription cameraDescription in cameras) {
bool previousPresetExactlySupported = true;
for (MapEntry<ResolutionPreset, Size> preset
for (final MapEntry<ResolutionPreset, Size> preset
in presetExpectedSizes.entries) {
final CameraController controller =
CameraController(cameraDescription, preset.key);
Expand Down Expand Up @@ -191,7 +191,7 @@ void main() {

sleep(const Duration(milliseconds: 500));

final file = await controller.stopVideoRecording();
final XFile file = await controller.stopVideoRecording();
final int recordingTime =
DateTime.now().millisecondsSinceEpoch - recordingStart;

Expand Down Expand Up @@ -224,7 +224,9 @@ void main() {
bool _isDetecting = false;

await controller.startImageStream((CameraImage image) {
if (_isDetecting) return;
if (_isDetecting) {
return;
}

_isDetecting = true;

Expand Down Expand Up @@ -252,14 +254,14 @@ void main() {
);

await controller.initialize();
final _completer = Completer<CameraImage>();
final Completer<CameraImage> _completer = Completer<CameraImage>();

await controller.startImageStream((CameraImage image) {
if (!_completer.isCompleted) {
Future(() async {
Future<void>(() async {
await controller.stopImageStream();
await controller.dispose();
}).then((value) {
}).then((Object? value) {
_completer.complete(image);
});
}
Expand All @@ -275,7 +277,7 @@ void main() {
return;
}

var _image = await startStreaming(cameras, null);
CameraImage _image = await startStreaming(cameras, null);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
Expand Down
Loading