This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera] Fixed a crash when streaming on iOS #4520
Merged
Merged
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 aec0f93
Fixed skip judgment
zuvola 0d9f61a
Merge branch 'flutter:master' into fix_ios_streaming
zuvola 7cff775
Add test
zuvola 5d1fb56
Update CHANGELOG.md
zuvola 7c0fa9e
Fix test
zuvola 3056e17
Add frameStack property to startImageStream
zuvola 1a48ffc
Merge branch 'flutter:master' into fix_ios_streaming
zuvola 4cb5d6e
Merge branch 'fix_ios_streaming' of https://github.com/zuvola/plugins…
zuvola 27957a1
Bump version to 0.9.4+6
zuvola 97d16c7
format
zuvola 1382d62
Fixed tests
zuvola 46d9df0
Merge branch 'main' into fix_ios_streaming
zuvola 84dc53d
Restored the API and set the number of pending frames to 4
zuvola 3ed1e94
Fixed tests
zuvola 9a3e627
Merge commit 'f7138f7222856623796c2ee2e561f866fcf08d38' into fix_ios_…
zuvola 6191e3a
Merge
zuvola e732d7b
Fixed CHANGELOG
zuvola b69ea0f
Fixed tests
zuvola e9beb1f
Merge branch 'main' into fix_ios_streaming
zuvola 74d9d85
Apply PR feedback
zuvola 6b81e1a
Update messages
zuvola 96f8edb
Merge branch 'main' into fix_ios_streaming
zuvola 1167112
Update to use CameraTestUtils
zuvola 24871c6
Update _Test header
zuvola 7635469
Bump version to 0.9.4+17
zuvola 376bbfa
Inject FLTImageStreamHandler object
zuvola f276bd0
Capital S
zuvola f69aed6
Use XCTNSPredicateExpectation
zuvola 9653345
Wait 1 second
zuvola 661cf49
Merge branch 'main' into fix_ios_streaming
zuvola 8e334bf
Format
zuvola 7b8d74f
Using KVO to wait
zuvola ab233fa
Add comments
zuvola 830d5ad
Update comments
zuvola 095faf3
Merge branch 'main' into fix_ios_streaming
stuartmorgan-g e185988
Version bump
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update _Test header
- Loading branch information
commit 24871c6dda2e7986509f5bd2dc89f2d78ebe26b2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -27,7 +22,7 @@ - (void)setUp { | |
| _sampleBuffer = FLTCreateTestSampleBuffer(); | ||
| } | ||
|
|
||
| -(void)tearDown { | ||
| - (void)tearDown { | ||
| CFRelease(_sampleBuffer); | ||
| } | ||
|
|
||
|
|
@@ -45,6 +40,10 @@ - (void)testExceedMaxStreamingPendingFramesCount { | |
| id messenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger)); | ||
| [_camera startImageStreamWithMessenger:messenger]; | ||
|
|
||
| while (!_camera.isStreamingImages) { | ||
| [NSThread sleepForTimeInterval:0.001]; | ||
|
||
| } | ||
|
|
||
| streamingExpectation.expectedFulfillmentCount = 4; | ||
| for (int i = 0; i < 10; i++) { | ||
| [_camera captureOutput:nil didOutputSampleBuffer:self.sampleBuffer fromConnection:nil]; | ||
|
|
@@ -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]; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 { | ||
|
|
@@ -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; | ||
|
||
| @property(assign, nonatomic) UIDeviceOrientation lockedCaptureOrientation; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nice to see these new test helpers being used :)