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:
parent
7ce4a584aa
commit
ed1a48b0cd
@ -35,7 +35,7 @@
|
|||||||
bool _captureInitialized;
|
bool _captureInitialized;
|
||||||
|
|
||||||
webrtc::videocapturemodule::VideoCaptureMacQTKit* _owner;
|
webrtc::videocapturemodule::VideoCaptureMacQTKit* _owner;
|
||||||
NSLock* lock_;
|
NSLock* _lock;
|
||||||
|
|
||||||
QTCaptureSession* _captureSession;
|
QTCaptureSession* _captureSession;
|
||||||
QTCaptureDeviceInput* _captureVideoDeviceInput;
|
QTCaptureDeviceInput* _captureVideoDeviceInput;
|
||||||
|
@ -46,6 +46,7 @@ using namespace videocapturemodule;
|
|||||||
[_captureDecompressedVideoOutput release];
|
[_captureDecompressedVideoOutput release];
|
||||||
[_captureSession release];
|
[_captureSession release];
|
||||||
[_captureDevices release];
|
[_captureDevices release];
|
||||||
|
[_lock release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@ -53,9 +54,9 @@ using namespace videocapturemodule;
|
|||||||
#pragma mark Public methods
|
#pragma mark Public methods
|
||||||
|
|
||||||
- (void)registerOwner:(VideoCaptureMacQTKit*)owner {
|
- (void)registerOwner:(VideoCaptureMacQTKit*)owner {
|
||||||
[lock_ lock];
|
[_lock lock];
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
[lock_ unlock];
|
[_lock unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)setCaptureDeviceById:(char*)uniqueId {
|
- (BOOL)setCaptureDeviceById:(char*)uniqueId {
|
||||||
@ -170,7 +171,7 @@ using namespace videocapturemodule;
|
|||||||
_frameRate = DEFAULT_FRAME_RATE;
|
_frameRate = DEFAULT_FRAME_RATE;
|
||||||
_frameWidth = DEFAULT_FRAME_WIDTH;
|
_frameWidth = DEFAULT_FRAME_WIDTH;
|
||||||
_frameHeight = DEFAULT_FRAME_HEIGHT;
|
_frameHeight = DEFAULT_FRAME_HEIGHT;
|
||||||
lock_ = [[NSLock alloc] init];
|
_lock = [[NSLock alloc] init];
|
||||||
_captureSession = [[QTCaptureSession alloc] init];
|
_captureSession = [[QTCaptureSession alloc] init];
|
||||||
_captureDecompressedVideoOutput =
|
_captureDecompressedVideoOutput =
|
||||||
[[QTCaptureDecompressedVideoOutput alloc] init];
|
[[QTCaptureDecompressedVideoOutput alloc] init];
|
||||||
@ -227,9 +228,9 @@ using namespace videocapturemodule;
|
|||||||
withSampleBuffer:(QTSampleBuffer *)sampleBuffer
|
withSampleBuffer:(QTSampleBuffer *)sampleBuffer
|
||||||
fromConnection:(QTCaptureConnection *)connection {
|
fromConnection:(QTCaptureConnection *)connection {
|
||||||
|
|
||||||
[lock_ lock];
|
[_lock lock];
|
||||||
if (!_owner) {
|
if (!_owner) {
|
||||||
[lock_ unlock];
|
[_lock unlock];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +252,7 @@ using namespace videocapturemodule;
|
|||||||
tempCaptureCapability, 0);
|
tempCaptureCapability, 0);
|
||||||
CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
|
CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
|
||||||
}
|
}
|
||||||
[lock_ unlock];
|
[_lock unlock];
|
||||||
_framesDelivered++;
|
_framesDelivered++;
|
||||||
_framesRendered++;
|
_framesRendered++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user