Code example for ReentrantLock

Methods: lock, unlock

0
    } 
 
    public int StopCapture() { 
        if(DEBUG) Log.d("*WEBRTC*", "StopCapture");
        try { 
            previewBufferLock.lock();
            isRunning = false;
            previewBufferLock.unlock();
 
            camera.stopPreview();
 
            if(android.os.Build.VERSION.SDK_INT > 7) {
                camera.setPreviewCallbackWithBuffer(null);
            } 
            else { 
                camera.setPreviewCallback(null);
            } 
        } 
        catch (Exception ex) {
            Log.e("*WEBRTC*", "Failed to stop camera");
            return -1;