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
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
index 29f7d04..5007600 100644
--- a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.h
@@ -35,7 +35,7 @@
   bool _captureInitialized;
 
   webrtc::videocapturemodule::VideoCaptureMacQTKit* _owner;
-  NSLock* lock_;
+  NSLock* _lock;
 
   QTCaptureSession* _captureSession;
   QTCaptureDeviceInput* _captureVideoDeviceInput;
diff --git a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
index 7cd7407..4bbd8c4 100644
--- a/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
+++ b/webrtc/modules/video_capture/mac/qtkit/video_capture_qtkit_objc.mm
@@ -46,6 +46,7 @@
   [_captureDecompressedVideoOutput release];
   [_captureSession release];
   [_captureDevices release];
+  [_lock release];
 
   [super dealloc];
 }
@@ -53,9 +54,9 @@
 #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 @@
   _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 @@
      withSampleBuffer:(QTSampleBuffer *)sampleBuffer
        fromConnection:(QTCaptureConnection *)connection {
 
-  [lock_ lock];
+  [_lock lock];
   if (!_owner) {
-    [lock_ unlock];
+    [_lock unlock];
     return;
   }
 
@@ -251,7 +252,7 @@
                           tempCaptureCapability, 0);
     CVPixelBufferUnlockBaseAddress(videoFrame, kFlags);
   }
-  [lock_ unlock];
+  [_lock unlock];
   _framesDelivered++;
   _framesRendered++;
 }