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

Failed to configure CameraSession! Error: Invalid pixel format 35 🐛 #2540

Closed
4 of 5 tasks
IvanByRool opened this issue Feb 12, 2024 · 5 comments · Fixed by #2547
Closed
4 of 5 tasks

Failed to configure CameraSession! Error: Invalid pixel format 35 🐛 #2540

IvanByRool opened this issue Feb 12, 2024 · 5 comments · Fixed by #2547
Labels
🐛 bug Something isn't working

Comments

@IvanByRool
Copy link

IvanByRool commented Feb 12, 2024

What's happening?

After updating to 3.9.0-beta.3 the camera preview shows a black screen when I set pixelFormat = yuv
The error displayed below

Reproduceable Code

<Camera
        frameProcessor={frameProcessor}
        onInitialized={() => {
          setIsCameraReady(true);
        }}
        device={device}
        pixelFormat={'yuv'}
        format={format}
        video={true}
        isActive={true}
      />

Relevant log output

Creating outputs for Camera #0...
2024-02-12 10:47:43.185  1969-27694 CameraSession           com.carooltruck.dev                  I  Adding 720x480 Video Output in YUV_420_888...
2024-02-12 10:47:43.185  1969-27694 VideoPipeline           com.carooltruck.dev                  I  Initializing 720 x 480 Video Pipeline (format: YUV)
2024-02-12 10:47:43.185  1969-27694 VideoPipeline           com.carooltruck.dev                  I  Using ImageReader round-trip (format: #35)
2024-02-12 10:47:43.186  1969-27694 VideoPipeline           com.carooltruck.dev                  I  Using API 29 for GPU ImageReader...
2024-02-12 10:47:43.186  1969-27694 CameraSession           com.carooltruck.dev                  E  Failed to configure CameraSession! Error: Invalid pixel format 35, isRunning: false, Config-Diff: Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
                                                                                                    java.lang.IllegalArgumentException: Invalid pixel format 35
                                                                                                    	at android.hardware.HardwareBuffer.isSupported(HardwareBuffer.java:202)
                                                                                                    	at com.mrousavy.camera.core.VideoPipeline.supportsHardwareBufferFlags(VideoPipeline.kt:231)
                                                                                                    	at com.mrousavy.camera.core.VideoPipeline.getRecommendedHardwareBufferFlags(VideoPipeline.kt:213)
                                                                                                    	at com.mrousavy.camera.core.VideoPipeline.<init>(VideoPipeline.kt:84)
                                                                                                    	at com.mrousavy.camera.core.CameraSession.configureOutputs(CameraSession.kt:285)
                                                                                                    	at com.mrousavy.camera.core.CameraSession.access$configureOutputs(CameraSession.kt:44)
                                                                                                    	at com.mrousavy.camera.core.CameraSession$configure$2$1.invokeSuspend(CameraSession.kt:135)
                                                                                                    	at com.mrousavy.camera.core.CameraSession$configure$2$1.invoke(Unknown Source:8)
                                                                                                    	at com.mrousavy.camera.core.CameraSession$configure$2$1.invoke(Unknown Source:2)
                                                                                                    	at com.mrousavy.camera.core.PersistentCameraCaptureSession.withConfiguration(PersistentCameraCaptureSession.kt:79)
                                                                                                    	at com.mrousavy.camera.core.CameraSession.configure(CameraSession.kt:127)
                                                                                                    	at com.mrousavy.camera.core.CameraSession$createPreviewOutput$1.invokeSuspend(CameraSession.kt:205)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                                                                                                    	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.os.HandlerThread.run(HandlerThread.java:67)
2024-02-12 10:47:43.186  1969-27694 CameraView              com.carooltruck.dev                  E  invokeOnError(...):
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  java.lang.IllegalArgumentException: Invalid pixel format 35
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at android.hardware.HardwareBuffer.isSupported(HardwareBuffer.java:202)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.VideoPipeline.supportsHardwareBufferFlags(VideoPipeline.kt:231)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.VideoPipeline.getRecommendedHardwareBufferFlags(VideoPipeline.kt:213)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.VideoPipeline.<init>(VideoPipeline.kt:84)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession.configureOutputs(CameraSession.kt:285)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession.access$configureOutputs(CameraSession.kt:44)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession$configure$2$1.invokeSuspend(CameraSession.kt:135)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession$configure$2$1.invoke(Unknown Source:8)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession$configure$2$1.invoke(Unknown Source:2)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.PersistentCameraCaptureSession.withConfiguration(PersistentCameraCaptureSession.kt:79)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession.configure(CameraSession.kt:127)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at com.mrousavy.camera.core.CameraSession$createPreviewOutput$1.invokeSuspend(CameraSession.kt:205)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at android.os.Handler.handleCallback(Handler.java:883)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at android.os.Handler.dispatchMessage(Handler.java:100)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at android.os.Looper.loop(Looper.java:237)
2024-02-12 10:47:43.186  1969-27694 System.err              com.carooltruck.dev                  W  	at android.os.HandlerThread.run(HandlerThread.java:67)
2024-02-12 10:47:43.200  1969-1969  VisionCameraProxy       com.carooltruck.dev                  D  Finding view 943...
2024-02-12 10:47:43.200  1969-1969  VisionCameraProxy       com.carooltruck.dev                  D  Found view 943!
2024-02-12 10:47:43.201  1969-32559 ReactNativeJS           com.carooltruck.dev                  I  camera has error
2024-02-12 10:47:43.245  1969-32559 ReactNativeJS           com.carooltruck.dev                  I  camera has error

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 8,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": true,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Samsung SM-G960U1

VisionCamera Version

3.9.0-beta.3

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

@IvanByRool IvanByRool added the 🐛 bug Something isn't working label Feb 12, 2024
@IvanByRool
Copy link
Author

I've been testing this on several old Samsung S9 / S8 and always getting the same error. Thx

@mrousavy
Copy link
Owner

Which Android version is your Samsung SM-G960U1?

@IvanByRool
Copy link
Author

Version android : 10

@mrousavy
Copy link
Owner

Found a fix for this issue! #2547 :) 💪

@IvanByRool
Copy link
Author

Thanks, I appreciate, as always.
It was my last fix to migrate from 2.x to 3.x 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants