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

Side by Side Diff: trunk/src/media/video/capture/mac/video_capture_device_qtkit_mac.mm

Issue 126883005: Revert 242936 "When stopping QTKit video capture, call stopRunni..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
6 6
7 #import <QTKit/QTKit.h> 7 #import <QTKit/QTKit.h>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 selector:@selector(handleNotification:) 212 selector:@selector(handleNotification:)
213 name:QTCaptureSessionRuntimeErrorNotification 213 name:QTCaptureSessionRuntimeErrorNotification
214 object:captureSession_]; 214 object:captureSession_];
215 [captureSession_ startRunning]; 215 [captureSession_ startRunning];
216 } 216 }
217 return YES; 217 return YES;
218 } 218 }
219 219
220 - (void)stopCapture { 220 - (void)stopCapture {
221 if ([[captureSession_ inputs] count] == 1) { 221 if ([[captureSession_ inputs] count] == 1) {
222 // |stopRunning| must be called before |removeInput:| to avoid a deadlock 222 [captureSession_ removeInput:captureDeviceInput_];
223 // with device enumeration when the active camera is unplugged.
224 [captureSession_ stopRunning]; 223 [captureSession_ stopRunning];
225 [captureSession_ removeInput:captureDeviceInput_];
226 } 224 }
227 225
228 [[NSNotificationCenter defaultCenter] removeObserver:self]; 226 [[NSNotificationCenter defaultCenter] removeObserver:self];
229 } 227 }
230 228
231 // |captureOutput| is called by the capture device to deliver a new frame. 229 // |captureOutput| is called by the capture device to deliver a new frame.
232 - (void)captureOutput:(QTCaptureOutput*)captureOutput 230 - (void)captureOutput:(QTCaptureOutput*)captureOutput
233 didOutputVideoFrame:(CVImageBufferRef)videoFrame 231 didOutputVideoFrame:(CVImageBufferRef)videoFrame
234 withSampleBuffer:(QTSampleBuffer*)sampleBuffer 232 withSampleBuffer:(QTSampleBuffer*)sampleBuffer
235 fromConnection:(QTCaptureConnection*)connection { 233 fromConnection:(QTCaptureConnection*)connection {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 [lock_ unlock]; 306 [lock_ unlock];
309 } 307 }
310 308
311 - (void)handleNotification:(NSNotification*)errorNotification { 309 - (void)handleNotification:(NSNotification*)errorNotification {
312 NSError * error = (NSError*)[[errorNotification userInfo] 310 NSError * error = (NSError*)[[errorNotification userInfo]
313 objectForKey:QTCaptureSessionErrorKey]; 311 objectForKey:QTCaptureSessionErrorKey];
314 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]); 312 frameReceiver_->ReceiveError([[error localizedDescription] UTF8String]);
315 } 313 }
316 314
317 @end 315 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698