googlearchive/android-Camera2Video

crashe when stop recording at xiaomi (redmi 4A 6.0.1 API23)

Closed this issue · 5 comments

07-11 23:17:41.794 4357-4434/com.example.android.camera2video E/HAL: Dawei load: module=/system/lib64/hw/gralloc.msm8937.so
07-11 23:17:43.626 4357-4357/com.example.android.camera2video I/RequestQueue: Repeating capture request cancelled.
07-11 23:17:43.626 4357-4357/com.example.android.camera2video I/RequestThread-0: Flushing all pending requests.
07-11 23:17:43.626 4357-4357/com.example.android.camera2video E/RequestQueue: cancel failed: no repeating request exists.
07-11 23:17:43.626 4357-4357/com.example.android.camera2video W/RequestHolder: Capture failed for request: 1
07-11 23:17:43.632 4357-4431/com.example.android.camera2video I/CameraDeviceState: Legacy camera service transitioning to state IDLE
07-11 23:17:43.776 4357-4357/com.example.android.camera2video E/MediaRecorder: stop failed: -1007
07-11 23:17:43.777 4357-4357/com.example.android.camera2video D/AndroidRuntime: Shutting down VM

                                                                            --------- beginning of crash

07-11 23:17:43.778 4357-4357/com.example.android.camera2video E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.camera2video, PID: 4357
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder.stop(Native Method)
at com.example.android.camera2video.Camera2VideoFragment.stopRecordingVideo(Camera2VideoFragment.java:689)
at com.example.android.camera2video.Camera2VideoFragment.onClick(Camera2VideoFragment.java:312)
at android.view.View.performClick(View.java:5207)
at android.view.View$PerformClick.run(View.java:21177)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5437)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

I modify the code

  try {
           mPreviewSession.abortCaptures();
       } catch (CameraAccessException e) {
           e.printStackTrace();
       }

       Timer timer = new Timer();
       TimerTask timerTask = new TimerTask() {
           @Override
           public void run() {
               mMediaRecorder.stop();
               mMediaRecorder.reset();
           }
       };
       timer.schedule(timerTask,30);

but I get this infomation from android studio logcat:

07-11 23:24:57.560 5032-5285/com.example.android.camera2video E/HAL: Dawei load: module=/system/lib64/hw/gralloc.msm8937.so
07-11 23:25:13.425 5032-5285/com.example.android.camera2video W/Adreno-EGLSUB: DequeueBuffer:726: dequeue native buffer fail: No such device, buffer=0x0, handle=0x0
07-11 23:25:13.426 5032-5285/com.example.android.camera2video W/Adreno-EGL: <qeglDrvAPI_eglSwapBuffers:3802>: EGL_BAD_SURFACE
07-11 23:25:13.438 5032-5285/com.example.android.camera2video E/CameraDeviceGLThread-0: Received exception on GL render thread:
java.lang.IllegalStateException: swapBuffers: EGL error: 0x300d
at android.hardware.camera2.legacy.SurfaceTextureRenderer.checkEglError(SurfaceTextureRenderer.java:530)
at android.hardware.camera2.legacy.SurfaceTextureRenderer.swapBuffers(SurfaceTextureRenderer.java:523)
at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:727)
at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager.java:105)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
07-11 23:25:13.438 5032-5285/com.example.android.camera2video I/CameraDeviceState: Legacy camera service transitioning to state ERROR
07-11 23:25:13.535 5032-5638/com.example.android.camera2video E/MediaRecorder: stop failed: -1007
07-11 23:25:13.537 5032-5638/com.example.android.camera2video E/AndroidRuntime: FATAL EXCEPTION: Timer-0
Process: com.example.android.camera2video, PID: 5032
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder.stop(Native Method)
at com.example.android.camera2video.Camera2VideoFragment$5.run(Camera2VideoFragment.java:694)
at java.util.Timer$TimerImpl.run(Timer.java:284)
07-11 23:25:13.565 5032-5638/com.example.android.camera2video I/Process: Sending signal. PID: 5032 SIG: 9

I restart my device, it's work.

plz reffer to issue #57

well after some time (minutes, hours) issue will meet you again

#86

restarting doesn't help for all devices (for example Redmi 5)

anyway why in earth you would restart your device before each video recording? it will stop working soon after one success recording anyway

This sample has been migrated to a new location where we can accept Pull Requests (check README for more information).

As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.

If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!