Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: media/video/capture/mac/video_capture_device_qtkit_mac.mm

Issue 464363003: Mac QTKit Video Capture: Run QTCaptureSession teardown in UI thread, clean up -stopCapture use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: shess@ comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/mac/video_capture_device_qtkit_mac.mm
diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.mm b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
index 7f4a853c63a9bde6d9b260a720a947d143f68cbc..e2260d0698fa9e1686c719ffcb5847fd7441c300 100644
--- a/media/video/capture/mac/video_capture_device_qtkit_mac.mm
+++ b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
@@ -144,10 +144,7 @@
stringWithUTF8String:"No video capture device set, on removal."]];
return YES;
}
- if ([[captureSession_ inputs] count] > 0) {
- // The device is still running.
- [self stopCapture];
- }
+ [self stopCapture];
if ([[captureSession_ outputs] count] > 0) {
// Only one output is set for |captureSession_|.
DCHECK_EQ([[captureSession_ outputs] count], 1u);
@@ -240,12 +237,20 @@
}
- (void)stopCapture {
Scott Hess - ex-Googler 2014/08/15 23:38:15 Since you've removed the other user of -stopCaptur
mcasas 2014/08/18 11:29:43 -stopCapture is part of the device interface [1] t
+ // Similar to the comments about -removeOutput: in -setCaptureDevice:,
+ // -removeInput: can post a call to main thread while holding a lock,
+ // causing a deadlock, see http://crbug.com/399792.
+ [self performSelectorOnMainThread:@selector(stopCaptureOnUIThread:)
+ withObject:captureSession_
+ waitUntilDone:YES];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+- (void)stopCaptureOnUIThread:(QTCaptureSession*)captureSession {
if ([[captureSession_ inputs] count] == 1) {
Scott Hess - ex-Googler 2014/08/15 23:38:15 This test should definitely not be here. If the c
mcasas 2014/08/18 11:29:43 This test is actually a bug, since there is just o
[captureSession_ removeInput:captureDeviceInput_];
[captureSession_ stopRunning];
}
-
- [[NSNotificationCenter defaultCenter] removeObserver:self];
}
// |captureOutput| is called by the capture device to deliver a new frame.
« no previous file with comments | « media/video/capture/mac/video_capture_device_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698