Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
29beaa7
Fixed crash when streaming in iOS
zuvola Nov 18, 2021
aec0f93
Fixed skip judgment
zuvola Nov 18, 2021
0d9f61a
Merge branch 'flutter:master' into fix_ios_streaming
zuvola Nov 22, 2021
7cff775
Add test
zuvola Nov 22, 2021
5d1fb56
Update CHANGELOG.md
zuvola Nov 22, 2021
7c0fa9e
Fix test
zuvola Nov 22, 2021
3056e17
Add frameStack property to startImageStream
zuvola Dec 10, 2021
1a48ffc
Merge branch 'flutter:master' into fix_ios_streaming
zuvola Dec 10, 2021
4cb5d6e
Merge branch 'fix_ios_streaming' of https://github.com/zuvola/plugins…
zuvola Dec 10, 2021
27957a1
Bump version to 0.9.4+6
zuvola Dec 10, 2021
97d16c7
format
zuvola Dec 10, 2021
1382d62
Fixed tests
zuvola Dec 14, 2021
46d9df0
Merge branch 'main' into fix_ios_streaming
zuvola Jan 27, 2022
84dc53d
Restored the API and set the number of pending frames to 4
zuvola Jan 28, 2022
3ed1e94
Fixed tests
zuvola Feb 7, 2022
9a3e627
Merge commit 'f7138f7222856623796c2ee2e561f866fcf08d38' into fix_ios_…
zuvola Feb 7, 2022
6191e3a
Merge
zuvola Feb 7, 2022
e732d7b
Fixed CHANGELOG
zuvola Feb 7, 2022
b69ea0f
Fixed tests
zuvola Feb 7, 2022
e9beb1f
Merge branch 'main' into fix_ios_streaming
zuvola Mar 8, 2022
74d9d85
Apply PR feedback
zuvola Mar 10, 2022
6b81e1a
Update messages
zuvola Mar 11, 2022
96f8edb
Merge branch 'main' into fix_ios_streaming
zuvola Mar 11, 2022
1167112
Update to use CameraTestUtils
zuvola Mar 11, 2022
24871c6
Update _Test header
zuvola Mar 11, 2022
7635469
Bump version to 0.9.4+17
zuvola Mar 11, 2022
376bbfa
Inject FLTImageStreamHandler object
zuvola Mar 16, 2022
f276bd0
Capital S
zuvola Mar 16, 2022
f69aed6
Use XCTNSPredicateExpectation
zuvola Mar 16, 2022
9653345
Wait 1 second
zuvola Mar 16, 2022
661cf49
Merge branch 'main' into fix_ios_streaming
zuvola Mar 16, 2022
8e334bf
Format
zuvola Mar 16, 2022
7b8d74f
Using KVO to wait
zuvola Mar 16, 2022
ab233fa
Add comments
zuvola Mar 23, 2022
830d5ad
Update comments
zuvola Mar 24, 2022
095faf3
Merge branch 'main' into fix_ios_streaming
stuartmorgan-g Mar 25, 2022
e185988
Version bump
stuartmorgan-g Mar 25, 2022
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
Update _Test header
  • Loading branch information
zuvola committed Mar 11, 2022
commit 24871c6dda2e7986509f5bd2dc89f2d78ebe26b2
15 changes: 9 additions & 6 deletions packages/camera/camera/example/ios/RunnerTests/StreamingTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
#import <OCMock/OCMock.h>
#import "CameraTestUtils.h"

@interface FLTImageStreamHandler : NSObject <FlutterStreamHandler>
- (instancetype)initWithCaptureSessionQueue:(dispatch_queue_t)captureSessionQueue;
@property FlutterEventSink eventSink;
@end

@interface StreamingTests : XCTestCase
@property(readonly, nonatomic) FLTCam *camera;
@property(readonly, nonatomic) CMSampleBufferRef sampleBuffer;
Expand All @@ -27,7 +22,7 @@ - (void)setUp {
_sampleBuffer = FLTCreateTestSampleBuffer();
Copy link
Contributor

Choose a reason for hiding this comment

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

nice to see these new test helpers being used :)

}

-(void)tearDown {
- (void)tearDown {
CFRelease(_sampleBuffer);
}

Expand All @@ -45,6 +40,10 @@ - (void)testExceedMaxStreamingPendingFramesCount {
id messenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
[_camera startImageStreamWithMessenger:messenger];

while (!_camera.isStreamingImages) {
[NSThread sleepForTimeInterval:0.001];
Copy link
Contributor

Choose a reason for hiding this comment

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

If isStreamingImages flag is not flipped, then this unit test will run forever, instead of reporting test failure. can you wait for the flag instead? (e.g. XCTNSPredicateExpectation)

}

streamingExpectation.expectedFulfillmentCount = 4;
for (int i = 0; i < 10; i++) {
[_camera captureOutput:nil didOutputSampleBuffer:self.sampleBuffer fromConnection:nil];
Expand All @@ -68,6 +67,10 @@ - (void)testReceivedImageStreamData {
id messenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
[_camera startImageStreamWithMessenger:messenger];

while (!_camera.isStreamingImages) {
[NSThread sleepForTimeInterval:0.001];
}

streamingExpectation.expectedFulfillmentCount = 5;
for (int i = 0; i < 10; i++) {
[_camera captureOutput:nil didOutputSampleBuffer:self.sampleBuffer fromConnection:nil];
Expand Down
9 changes: 0 additions & 9 deletions packages/camera/camera/ios/Classes/FLTCam.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
@import CoreMotion;
#import <libkern/OSAtomic.h>

@interface FLTImageStreamHandler : NSObject <FlutterStreamHandler>
// The queue on which `eventSink` property should be accessed
@property(nonatomic, strong) dispatch_queue_t captureSessionQueue;
// `eventSink` property should be accessed on `captureSessionQueue`.
// The block itself should be invoked on the main queue.
@property FlutterEventSink eventSink;
@end

@implementation FLTImageStreamHandler

- (instancetype)initWithCaptureSessionQueue:(dispatch_queue_t)captureSessionQueue {
Expand Down Expand Up @@ -68,7 +60,6 @@ @interface FLTCam () <AVCaptureVideoDataOutputSampleBufferDelegate,
@property(assign, nonatomic) BOOL videoIsDisconnected;
@property(assign, nonatomic) BOOL audioIsDisconnected;
@property(assign, nonatomic) BOOL isAudioSetup;
@property(assign, nonatomic) BOOL isStreamingImages;
@property(assign, nonatomic) int streamingPendingFramesCount;
@property(assign, nonatomic) int maxstreamingPendingFramesCount;
Copy link
Contributor

Choose a reason for hiding this comment

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

capital S

@property(assign, nonatomic) UIDeviceOrientation lockedCaptureOrientation;
Expand Down
15 changes: 15 additions & 0 deletions packages/camera/camera/ios/Classes/FLTCam_Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
/// The output for photo capturing. Exposed setter for unit tests.
@property(strong, nonatomic) AVCapturePhotoOutput *capturePhotoOutput API_AVAILABLE(ios(10));

/// True when images from the camera are being streamed.
@property(assign, nonatomic) BOOL isStreamingImages;

/// A dictionary to retain all in-progress FLTSavePhotoDelegates. The key of the dictionary is the
/// AVCapturePhotoSettings's uniqueID for each photo capture operation, and the value is the
/// FLTSavePhotoDelegate that handles the result of each photo capture operation. Note that photo
Expand All @@ -39,3 +42,15 @@
error:(NSError **)error;

@end

@interface FLTImageStreamHandler : NSObject <FlutterStreamHandler>
// The queue on which `eventSink` property should be accessed
@property(nonatomic, strong) dispatch_queue_t captureSessionQueue;
// `eventSink` property should be accessed on `captureSessionQueue`.
// The block itself should be invoked on the main queue.
@property FlutterEventSink eventSink;
@end

@interface FLTImageStreamHandler ()
- (instancetype)initWithCaptureSessionQueue:(dispatch_queue_t)captureSessionQueue;
@end