Chromium Code Reviews| 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. |