Android Question CamEx2 IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!

DonManfred

Expert
Licensed User
Longtime User
I´m getting a problem in using CamEx2.

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (capturevideo) Create, isFirst = true **
FULL
SetState(Open false, Busy false, Video true)
** Activity (capturevideo) Resume **
CaptureVideo.Activity_Resume
CaptureVideo_OpenCamera(false)
SetState(Open false, Busy false, Video true)
PrepareSurface
SetState(Open false, Busy false, Video true)
PrepareSurface VIDEOMODE
(Size) 1280x720 ' PreviewSize
(Size) 1920x1080 ' CaptureSize
PrepareSurface VIDEOMODE
PrepareSurfaceForVideo(2, /storage/emulated/0/Android/data/de.fbdn.videohelper/files/Uploads, temp-AB787_3588_4214_1542279717409.mp4)
CloseSession
Wait For (CreateSurface) Complete (Result As Boolean)
Camera.CreateMediaRecorder
Camera.StartSession
camex2_startpreview (java line: 1417)
java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:582)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:938)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:984)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:238)
at anywheresoftware.b4a.objects.Camera2.SetRepeatingRequest(Camera2.java:359)
at de.fbdn.videohelper.camex2._startpreview(camex2.java:1417)
at de.fbdn.videohelper.capturevideo$ResumableSub_PrepareSurface.resume(capturevideo.java:1338)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1736)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

I can´t find the problem. Any hints?

If it is Relevant: Device is Samsund Note 8, Android 8.0
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Thank you for your Like, @Erel.

I checked the PreviewSize.
- The Default Size IS supported.
- I tried to use other values (from the list of supported sizes). No change
Maybe it was not clear.

I should have written
But unfortunately no change. The Error still happen.

Not solved as of now.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
When exactly does the error happen?
in PrepareSurface resp. in Camera.StartSession

** Activity (capturevideo) Create, isFirst = true **
FULL
SetState(Open false, Busy false, Video true)
** Activity (capturevideo) Resume **
CaptureVideo.Activity_Resume ' Extra log
CaptureVideo_OpenCamera(false) ' Extra log
SetState(Open false, Busy false, Video true) ' Extra log
PrepareSurface ' Extra log
SetState(Open false, Busy false, Video true) ' Extra log
PrepareSurface VIDEOMODE ' Extra log
(Size) 1280x720 ' PreviewSize
(Size) 1920x1080 ' CaptureSize
PrepareSurface VIDEOMODE' Extra log
PrepareSurfaceForVideo(2, /storage/emulated/0/Android/data/de.fbdn.videohelper/files/Uploads, temp-AB787_3588_4214_1542279717409.mp4)
CloseSession
Wait For (CreateSurface) Complete (Result As Boolean)
Camera.CreateMediaRecorder
Camera.StartSession

Are you in still mode?
Erm... I don´t know? What is "Still mode"?

Do you see the preview frames?
No.

What happens if you change line 94 to:
The same error

Camera.StartSession
camex2_startpreview (java line: 1417)
java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:582)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:938)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:984)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:238)
at anywheresoftware.b4a.objects.Camera2.SetRepeatingRequest(Camera2.java:359)
at de.fbdn.videohelper.camex2._startpreview(camex2.java:1417)
at de.fbdn.videohelper.capturevideo$ResumableSub_PrepareSurface.resume(capturevideo.java:1323)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1736)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I ran the example without changes.

After Permissionrequest i took a picture. This was successfully.

Then i clicked on the button to change the mode. It then crashes with the same error.

--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
FULL
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
** Activity (main) Resume **
(Rect)(0, 0, 4032, 3024)
Picture taken: (Bitmap): 1920 x 1080, scale = 1,00
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
** Activity (main) Resume **
camex2_startpreview (java line: 1397)
java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:582)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:938)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:984)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:238)
at anywheresoftware.b4a.objects.Camera2.SetRepeatingRequest(Camera2.java:359)
at b4a.example3.camex2._startpreview(camex2.java:1397)
at b4a.example3.main$ResumableSub_PrepareSurface.resume(main.java:1005)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1736)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Application_Error
(IllegalArgumentException) java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:582)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:938)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:984)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:238)
at anywheresoftware.b4a.objects.Camera2.SetRepeatingRequest(Camera2.java:359)
at b4a.example3.camex2._startpreview(camex2.java:1397)
at b4a.example3.main$ResumableSub_PrepareSurface.resume(main.java:1005)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1736)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

If it is relevant: i am using the Activity in my App in forced Landscape mode using
B4X:
SetActivityAttribute(CaptureVideo, android:screenOrientation, "landscape")
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Thank you!

I did try it with the unchanged camex2 example.
It does work on my Note 8. Picture and Video can be captured. No error happens.

i´ll try it tomorrow in my app when i´m at work again. It is an App for the company and i do not have the source here at my home. So for now i could only test with the camex2. But i can confirm that v1.11 does work with it. I´ll report the result here tomorrow nut i expect it to work as in camex2,
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I´m at work now.
As Expected, it does work in my app at work.

I just updated the internal library, did a new Compile and the Video Record is working even in my App (not in CamEx Source).

Great. Seems like this long time issue is solved.
What was the problem then?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top