From 2677bed8d4cd07758392d9634e40352f25d248ac Mon Sep 17 00:00:00 2001 From: "wjia@chromium.org" Date: Fri, 24 Aug 2012 21:59:27 +0000 Subject: use manual release for QTCaptureDecompressedVideoOutput. Need to make sure when setCaptureDevice:nil returns, QTCaptureDecompressedVideoOutput won't call captureOutput of VideoCaptureDeviceQTKit. BUG=139004 Review URL: https://chromiumcodereview.appspot.com/10875038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153307 0039d316-1c4b-4281-b951-d872f2087c98 --- media/video/capture/mac/video_capture_device_qtkit_mac.h | 2 ++ media/video/capture/mac/video_capture_device_qtkit_mac.mm | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'media/video') diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.h b/media/video/capture/mac/video_capture_device_qtkit_mac.h index 61d7900..526c855 100644 --- a/media/video/capture/mac/video_capture_device_qtkit_mac.h +++ b/media/video/capture/mac/video_capture_device_qtkit_mac.h @@ -14,6 +14,7 @@ namespace media { class VideoCaptureDeviceMac; } +@class QTCaptureDecompressedVideoOutput; @class QTCaptureDeviceInput; @class QTCaptureSession; @@ -29,6 +30,7 @@ namespace media { // QTKit variables. QTCaptureSession *captureSession_; QTCaptureDeviceInput *captureDeviceInput_; + QTCaptureDecompressedVideoOutput *captureDecompressedOutput_; } // Returns a dictionary of capture devices with friendly name and unique id. 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 c70e84b..a7e2c58 100644 --- a/media/video/capture/mac/video_capture_device_qtkit_mac.mm +++ b/media/video/capture/mac/video_capture_device_qtkit_mac.mm @@ -42,6 +42,7 @@ - (void)dealloc { [captureSession_ release]; [captureDeviceInput_ release]; + [captureDecompressedOutput_ release]; [super dealloc]; } @@ -72,10 +73,10 @@ captureDeviceInput_ = [[QTCaptureDeviceInput alloc] initWithDevice:device]; captureSession_ = [[QTCaptureSession alloc] init]; - QTCaptureDecompressedVideoOutput *captureDecompressedOutput = - [[[QTCaptureDecompressedVideoOutput alloc] init] autorelease]; - [captureDecompressedOutput setDelegate:self]; - if (![captureSession_ addOutput:captureDecompressedOutput error:&error]) { + captureDecompressedOutput_ = + [[QTCaptureDecompressedVideoOutput alloc] init]; + [captureDecompressedOutput_ setDelegate:self]; + if (![captureSession_ addOutput:captureDecompressedOutput_ error:&error]) { DLOG(ERROR) << "Could not connect video capture output." << [[error localizedDescription] UTF8String]; return NO; @@ -91,12 +92,14 @@ // The device is still running. [self stopCapture]; } - [[[captureSession_ outputs] objectAtIndex:0] setDelegate:nil]; - [captureSession_ removeOutput:[[captureSession_ outputs] objectAtIndex:0]]; + [captureDecompressedOutput_ setDelegate:nil]; + [captureSession_ removeOutput:captureDecompressedOutput_]; [captureSession_ release]; captureSession_ = nil; [captureDeviceInput_ release]; captureDeviceInput_ = nil; + [captureDecompressedOutput_ release]; + captureDecompressedOutput_ = nil; return YES; } } -- cgit v1.1