Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Surface was requested when the Recorder had encountered error androidx.camera.video.internal.encoder.InvalidConfigException: android.media.MediaCodec$CodecException: Error 0xffffec77 #434

Closed
tnt-ndricimh opened this issue Nov 2, 2021 · 9 comments
Assignees

Comments

@tnt-ndricimh
Copy link

tnt-ndricimh commented Nov 2, 2021

This error is happening when I take a video but I discard it and want to take another one. In code I'm just calling the fun bindCameraUseCases() again.

java.lang.IllegalStateException: Surface was requested when the Recorder had encountered error androidx.camera.video.internal.encoder.InvalidConfigException: android.media.MediaCodec$CodecException: Error 0xffffec77
        at androidx.camera.video.Recorder.onSurfaceRequested(Recorder.java:414)
        at androidx.camera.video.VideoCapture.createPipeline(VideoCapture.java:388)
        at androidx.camera.video.VideoCapture.resetPipeline(VideoCapture.java:435)
        at androidx.camera.video.VideoCapture.lambda$createPipeline$0$VideoCapture(VideoCapture.java:403)
        at androidx.camera.video.-$$Lambda$VideoCapture$6BBmhv2eFVUcrkw2nD0ve39oNMM.onError(Unknown Source:10)
        at androidx.camera.camera2.internal.Camera2CameraImpl.lambda$postSurfaceClosedError$13(Camera2CameraImpl.java:1153)
        at androidx.camera.camera2.internal.-$$Lambda$Camera2CameraImpl$EQgjyk5vUNeY9hNKpGr93fYzUDE.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7860)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
@ggfan
Copy link
Contributor

ggfan commented Jan 11, 2022

Need more information: only one capture session is supported. do you unbind the previous one before you bind the new one?

@mayowa-egbewunmi
Copy link

I am having a similar issue on Android 7.0 OS. The crash log below. This crash happens when trying to initialize camera. I am using camerax-video 1.1.0-beta01

androidx.camera.video.internal.encoder.InvalidConfigException: Encoder cannot created: null
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.Recorder.onSurfaceRequested(Recorder.java:414)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.VideoCapture.createPipeline(VideoCapture.java:388)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.VideoCapture.resetPipeline(VideoCapture.java:435)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.VideoCapture.lambda$createPipeline$0(VideoCapture.java:403)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.VideoCapture.a(VideoCapture.java)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.video.z.onError(Unknown Source)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.camera2.internal.Camera2CameraImpl.lambda$postSurfaceClosedError$13(Camera2CameraImpl.java:1153)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.camera2.internal.Camera2CameraImpl.f(Camera2CameraImpl.java)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at androidx.camera.camera2.internal.a0.run(Unknown Source)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:836)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:103)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:203)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6251)
02-12 02:14:21.397 12698 12698 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)

@temcguir
Copy link

Thanks for the reports. This is a known issue and we are currently working on a bug fix. Will keep this thread updated on progress.

@mayowa-egbewunmi That specific issue has been addressed with this change which should be part of the next release.

@mayowa-egbewunmi
Copy link

Thanks @temcguir for the update. I look forward to the fix

@mayowa-egbewunmi
Copy link

Any timeline on when the next release will be out?

@KiemDuong
Copy link

I'm looking forward to the fix too. My app has many crashes related to this issue.

Crash log
Fatal Exception: java.lang.IllegalStateException: Surface was requested when the Recorder had encountered error androidx.camera.video.internal.encoder.InvalidConfigException: android.media.MediaCodec$CodecException: Error 0xffffec77 at androidx.camera.video.Recorder.onSurfaceRequested(Recorder.java:414) at androidx.camera.video.VideoCapture.createPipeline(VideoCapture.java:388) at androidx.camera.video.VideoCapture.resetPipeline(VideoCapture.java:435) at androidx.camera.video.VideoCapture.lambda$createPipeline$0$VideoCapture(VideoCapture.java:403) at androidx.camera.video.-$$Lambda$VideoCapture$OJ2Q9uy4uGZPV5sMTIt1w0HvLW8.onError(:10) at androidx.camera.camera2.internal.Camera2CameraImpl.lambda$postSurfaceClosedError$13(Camera2CameraImpl.java:1153) at androidx.camera.camera2.internal.-$$Lambda$Camera2CameraImpl$4vyTRU0TOPnIyEhQmEEUbqfiRFg.run(:4) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214)

@tailv
Copy link

tailv commented Feb 18, 2022

I have tried with 1.1.0-beta02, but still encounter this issue.
@tnt-ndricimh @mayowa-egbewunmi How about you with 1.1.0-beta02 ?

@mayowa-egbewunmi
Copy link

Hi @temcguir Do you have any update on this issue?

@temcguir
Copy link

Sorry for the delay in updating this bug report. The crash should no longer occur as of 1.1.0-beta03, though an error code might still be present in VideoRecordEvent.Finalize. In 1.1.0-rc01, which was released a few days ago, the root cause of the issue was addressed, so it should no longer occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants