Fix mac video capture leak.

BUG=3878
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/38459004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7971 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tkchin@webrtc.org 2014-12-19 20:51:02 +00:00
parent 7ce4a584aa
commit ed1a48b0cd
2 changed files with 8 additions and 7 deletions

View File

@ -35,7 +35,7 @@
bool _captureInitialized;
webrtc::videocapturemodule::VideoCaptureMacQTKit* _owner;
NSLock* lock_;
NSLock* _lock;
QTCaptureSession* _captureSession;
QTCaptureDeviceInput* _captureVideoDeviceInput;

View File

@ -46,6 +46,7 @@ using namespace videocapturemodule;
[_captureDecompressedVideoOutput release];
[_captureSession release];
[_captureDevices release];
[_lock release];
[super dealloc];
}
@ -53,9 +54,9 @@ using namespace videocapturemodule;
#pragma mark Public methods
- (void)registerOwner:(VideoCaptureMacQTKit*)owner {
[lock_ lock];
[_lock lock];
_owner = owner;
[lock_ unlock];
[_lock unlock];
}
- (BOOL)setCaptureDeviceById:(char*)uniqueId {
@ -170,7 +171,7 @@ using namespace videocapturemodule;
_frameRate = DEFAULT_FRAME_RATE;
_frameWidth = DEFAULT_FRAME_WIDTH;
_frameHeight = DEFAULT_FRAME_HEIGHT;
lock_ = [[NSLock alloc] init];
_lock = [[NSLock alloc] init];
_captureSession = [[QTCaptureSession alloc] init];
_captureDecompressedVideoOutput =
[[QTCaptureDecompressedVideoOutput alloc] init];
@ -227,9 +228,9 @@ using namespace videocapturemodule;
withSampleBuffer:(QTSampleBuffer *)sampleBuffer
fromConnection:(QTCaptureConnection *)connection {
[lock_ lock];
[_lock lock];
if (!_owner) {
[lock_ unlock];
[_lock unlock];
return;
}
@ -251,7 +252,7 @@ using namespace videocapturemodule;
tempCaptureCapability, 0);
CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
}
[lock_ unlock];
[_lock unlock];
_framesDelivered++;
_framesRendered++;
}