FATAL EXCEPTION: main
Process: com.vodafone.arena, PID: 13760
java.lang.RuntimeException: lock failed
at android.hardware.Camera.lock(Native Method)
at com.amosyuen.videorecorder.camera.CameraController.lock(CameraController.java:239)
at com.amosyuen.videorecorder.activity.FFmpegRecorderActivity.stopRecording(FFmpegRecorderActivity.java:494)
at com.amosyuen.videorecorder.activity.FFmpegRecorderActivity.stopRecordingAndPrepareForNext(FFmpegRecorderActivity.java:484)
at com.amosyuen.videorecorder.activity.FFmpegRecorderActivity.onTouch(FFmpegRecorderActivity.java:508)
at android.view.View.dispatchTouchEvent(View.java:9953)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2711)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2400)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:412)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1834)
at android.app.Activity.dispatchTouchEvent(Activity.java:3154)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:374)
at android.view.View.dispatchPointerEvent(View.java:10177)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4628)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4496)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3947)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4000)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3966)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3974)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3947)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4000)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3966)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4095)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3974)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4152)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3947)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4000)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3966)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3974)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3947)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6437)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6411)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6372)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6571)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
12-20 13:32:10.139 13760-13760/com.vodafone.arena E/AndroidRuntime: at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6247)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
Phone is LgG5 7.0
StackTrace
Here is my code;