-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camera_avfoundation] fix race condition when starting image stream on iOS #8733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
a978667
494fe89
e902881
c4aa926
e6dd1a6
423c038
0e16acb
364d2d6
8502b67
7c462d9
5dc4fb0
680820f
d46b835
2ed081e
80b733b
0add70e
7bd57e5
b50bab8
42be013
2e78c19
870f7f5
fba0373
a2b3269
488bf75
c5075a0
5dfac20
c0f8e90
987f067
48354d9
ce94fad
4661cc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,8 +224,7 @@ - (void)initializeCamera:(NSInteger)cameraId | |
| - (void)startImageStreamWithCompletion:(nonnull void (^)(FlutterError *_Nullable))completion { | ||
| __weak typeof(self) weakSelf = self; | ||
| dispatch_async(self.captureSessionQueue, ^{ | ||
| [weakSelf.camera startImageStreamWithMessenger:weakSelf.messenger]; | ||
| completion(nil); | ||
| [weakSelf.camera startImageStreamWithMessenger:weakSelf.messenger withCompletion:completion]; | ||
|
||
| }); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -842,7 +842,7 @@ - (void)startVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))com | |
| messengerForStreaming:(nullable NSObject<FlutterBinaryMessenger> *)messenger { | ||
| if (!_isRecording) { | ||
| if (messenger != nil) { | ||
| [self startImageStreamWithMessenger:messenger]; | ||
| [self startImageStreamWithMessenger:messenger withCompletion:completion]; | ||
|
||
| } | ||
|
|
||
| NSError *error; | ||
|
|
@@ -1168,14 +1168,17 @@ - (void)setExposureOffset:(double)offset { | |
| [_captureDevice unlockForConfiguration]; | ||
| } | ||
|
|
||
| - (void)startImageStreamWithMessenger:(NSObject<FlutterBinaryMessenger> *)messenger { | ||
| - (void)startImageStreamWithMessenger:(NSObject<FlutterBinaryMessenger> *)messenger | ||
| withCompletion:(void (^)(FlutterError *))completion { | ||
| [self startImageStreamWithMessenger:messenger | ||
| imageStreamHandler:[[FLTImageStreamHandler alloc] | ||
| initWithCaptureSessionQueue:_captureSessionQueue]]; | ||
| initWithCaptureSessionQueue:_captureSessionQueue] | ||
| withCompletion:completion]; | ||
| } | ||
|
|
||
| - (void)startImageStreamWithMessenger:(NSObject<FlutterBinaryMessenger> *)messenger | ||
| imageStreamHandler:(FLTImageStreamHandler *)imageStreamHandler { | ||
| imageStreamHandler:(FLTImageStreamHandler *)imageStreamHandler | ||
| withCompletion:(void (^)(FlutterError *))completion { | ||
js2702 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (!_isStreamingImages) { | ||
| id<FLTEventChannel> eventChannel = [FlutterEventChannel | ||
| eventChannelWithName:@"plugins.flutter.io/camera_avfoundation/imageStream" | ||
|
|
@@ -1197,6 +1200,7 @@ - (void)startImageStreamWithMessenger:(NSObject<FlutterBinaryMessenger> *)messen | |
|
|
||
| strongSelf.isStreamingImages = YES; | ||
| strongSelf.streamingPendingFramesCount = 0; | ||
| completion(nil); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the format seems off
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want the \n removed there?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh sorry the github web ui shows it weirdly. This is good. |
||
| }); | ||
| }]; | ||
| } else { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.