Propose of this CL: Close the camera properly on MacOS in order to allow other apps to use it.
Changes in this CL:
1. video_capture_qtkit_info_objc.mm _captureDevicesInfo is never released. I have found this memory leak using Instruments from XCode. The patch is releasing it in dealloc.
2. In video_capture_qtkit_objc.h:
a) _captureDeviceName is not needed. Is allocated in the class but never used.
b) I don't see the role of the NSAutoreleasePool. also if you use it you have to release it when the class is destroyed. Otherwise you will leak memory. Libjingle has for each thread a pool on mac os.
3. In video_capture_qtkit_objc.mm
a) the camera is not stopped properly . See the changes from dealloc. NOTE : If you don't call [[_captureVideoDeviceInput device] close] other apps will not be able to use the camera since you are not closing your app
b) Removed QTCaptureDevice* videoDevice = (QTCaptureDevice*)[_captureDevices objectAtIndex:0]; I don't know why this because the desired camera is opened in setCaptureDeviceById and can be different than position 0 in the camera array. At this moment if you have two cameras and user want to pick the one on index 1 the app also locks the one on 0 .
Other changes I have done to improve (and are not in this CL):
a) I have set the FPS properly to the desired. I have succeeded to reduce the CPU with 3 % doing this. The current code for setting FPS is commented in webrtc
b) I have removed _rLock from the equation. I don't know if it's good or not but I hadn't understood what exactly we are trying to protect with this. Anyway in the current implementation is never released.
Review URL: https://webrtc-codereview.appspot.com/1097014
Patch from Silviu Caragea <silviu.cpp@gmail.com>.
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3886 4adac7df-926f-26a2-2b94-8c16560cd09d