amosyuen / FFmpegVideoRecorder

Customizable Android video recorder library that can combine multiple videos
Other
99 stars 37 forks source link

Camera lock exception #11

Open alcntml opened 6 years ago

alcntml commented 6 years ago

Phone is LgG5 7.0

StackTrace

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)

Here is my code;

FFmpegRecorderActivityParams.Builder paramsBuilder =
        FFmpegRecorderActivityParams.builder(RabonaChooseVideoActivity.this)
                .setVideoOutputFileUri(destFile);

paramsBuilder.recorderParamsBuilder()
        .setVideoSize(new ImageSize(640, 480))
        .setVideoCodec(EncoderParamsI.VideoCodec.H264)
        .setVideoBitrate(100000)
        .setVideoFrameRate(30)
        .setVideoImageFit(ImageFit.FILL)
        .setVideoImageScale(ImageScale.DOWNSCALE)
        .setShouldCropVideo(true)
        .setShouldPadVideo(true)
        .setVideoCameraFacing(CameraControllerI.Facing.BACK)
        .setAudioCodec(EncoderParamsI.AudioCodec.AAC)
        .setAudioSamplingRateHz(44100)
        .setAudioBitrate(100000)
        .setAudioChannelCount(2)
        .setOutputFormat(EncoderParamsI.OutputFormat.MP4);

Intent intent = new Intent(RabonaChooseVideoActivity.this, FFmpegRecorderActivity.class);
intent.putExtra(FFmpegRecorderActivity.REQUEST_PARAMS_KEY, paramsBuilder.build());
startActivityForResult(intent, REQUEST_TAKE_CAMERA_VIDEO);
amosyuen commented 6 years ago

@alcntml When does this happen? Could you describe your interactions with the phone before the error?

heena002 commented 4 years ago

facing the same error right after I stop recording the first clip.