Coder Social home page Coder Social logo

chenyeju295 / flutter_uvc_camera Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 2.0 11.46 MB

Flutter package

Home Page: https://pub.dev/packages/flutter_uvc_camera

License: MIT License

Kotlin 72.07% Swift 1.89% Objective-C 0.06% Dart 23.66% Ruby 2.32%
android flutter uvc-camera

flutter_uvc_camera's Issues

Not find pid & vid

It does not find the device after passing the pid and vid parameters to it.

app quits unexpectedly(Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR))

I/flutter (23403): ------> UVCCameraController init
I/PlatformViewsController(23403): Hosting view in view hierarchy for platform view: 0
I/PlatformViewsController(23403): PlatformView is using SurfaceProducer backend
D/OpenGLRenderer(23403): makeCurrent grContext:0xb40000744b4b3060 reset mTextureAvailable
E/FrameEvents(23403): updateAcquireFence: Did not find frame.
V/USBMonitor(23403): USBMonitor:Constructor
V/USBMonitor(23403): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@52093d
I/MultiCameraClient(23403): register...
I/USBMonitor(23403): register:
E/FrameEvents(23403): updateAcquireFence: Did not find frame.
E/FrameEvents(23403): updateAcquireFence: Did not find frame.
I/MultiCameraClient(23403): attach device name/pid/vid:/dev/bus/usb/002/002&1&5396
I/USBMonitor(23403): request permission, has permission: true
V/USBMonitor(23403): processConnect:device=/dev/bus/usb/002/002
I/USBMonitor(23403): UsbControlBlock:constructor
W/BpBinder(23403): PerfMonitor binderTransact: time=239ms interface=android.hardware.usb.IUsbManager code=2
D/UsbDeviceConnectionJNI(23403): close
I/USBMonitor(23403): name=/dev/bus/usb/002/002,desc=168,busnum=2,devnum=2,rawDesc=
I/MultiCameraClient(23403): connect device name/pid/vid:/dev/bus/usb/002/002&1&5396
I/CameraView(23403): camera connection. pid: 1, vid: 5396
I/AspectRatioTextureView(23403): AspectRatio = 1.3333333333333333
I/MultiCameraClient(23403): surface measure size (825, 618)
E/FrameEvents(23403): updateAcquireFence: Did not find frame.
I/RenderManager(23403): create RenderManager, Open ES version is 3.2
I/EGLEvn (23403): Init EGL Success!
I/EGLEvn (23403): setupSurface Success!
I/AbstractRender(23403): init surface texture render success!
I/AbstractRender(23403): create external texture, id = 1
I/AbstractRender(23403): init surface texture render success!
I/AbstractRender(23403): init surface texture render success!
D/UsbDeviceConnectionJNI(23403): close
I/libusb/core(23403): [23692core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs(23403): [23692
android_usbfs.c:504:op_init2]:start up hotplug event handler
I/libusb/usbfs(23403): [23692android_usbfs.c:512:op_init2]:call android_scan_devices
E/libuvc/device(23403): [23692
device.c:330:uvc_open]:internal_devh->info->ctrl_if.bEndpointAddress is null
I/UVCCamera(23403): open camera status: -5476376649152016512, size: {"formats":[{"index":1,"type":4,"default":1,"size":["384x292"]}]}
I/CameraUVC(23403): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=384, height=292)],
I/CameraUVC(23403): getSuitableSize: PreviewSize(width=384, height=292)
I/CameraUVC(23403): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=384, height=292)],
I/MultiCameraClient(23403): Audio record by using system mic
I/CameraUVC(23403): start preview, name = /dev/bus/usb/002/002, preview=PreviewSize(width=384, height=292)
I/RenderManager(23403): create camera SurfaceTexture: android.graphics.SurfaceTexture@31b8e63
I/CameraView(23403): ------>CameraState: OPENED
I/AbstractRender(23403): create texture, id = 2
I/AbstractFboRender(23403): load fbo, textures: [I@baffa60, buffers: [I@e770b19
I/AbstractRender(23403): create texture, id = 3
I/AbstractFboRender(23403): load fbo, textures: [I@c6787de, buffers: [I@72eadbf
I/flutter (23403): Camera: OPENED
I/libUVCCamera(23403): [23697UVCPreview.cpp:509:prepare_preview]:frameSize=(384,292)@yuyv
I/libUVCCamera(23403): [23699
UVCPreview.cpp:267:callbackPixelFormatChanged]:PIXEL_FORMAT_RAW:
W/libUVCCamera(23403): [23698UVCPreview.cpp:128:get_frame]:allocate new frame
W/libUVCCamera(23403): [23697
UVCPreview.cpp:128:get_frame]:allocate new frame
I/libc (23403): handling signal: 11
F/libc (23403): Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x746608f000 in tid 23697 (camera-17188244), pid 23403 (_camera_example)


Build fingerprint: 'Xiaomi/cupid/cupid:14/UKQ1.230917.001/V816.0.5.0.ULCCNXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-06-20 03:13:56.677532571+0800
Process uptime: 44s
Cmdline: com.example.flutter_uvc_camera_example
pid: 23403, tid: 23697, name: camera-17188244 >>> com.example.flutter_uvc_camera_example <<<
uid: 10695
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x000000746608f000
x0 000000746608ee00 x1 b400007447d163c0 x2 00000000000003b0 x3 000000746608efc0
x4 b400007447d16800 x5 000000746608f400 x6 00000000000000db x7 00000073ba9eb461
x8 0000000000002a00 x9 0000000000003000 x10 0000000000000124 x11 0000000000001200
x12 0000000000001e00 x13 0000000000000c00 x14 0000000000000000 x15 0000000000000018
x16 000000744d86ce58 x17 0000007518526dc0 x18 000000739e79c000 x19 0000000000000124
x20 000000746608e800 x21 b400007447d15c00 x22 0000000000000600 x23 000000746608ee00
x24 b400007447d16200 x25 0000000000000600 x26 0000000000001200 x27 0000000000000120
x28 0000000000000600 x29 00000073ba9ebb80
lr 000000744d8589d4 sp 00000073ba9eba90 pc 0000007518526ed0 pst 0000000020001000
6 total frames
backtrace:
#00 pc 000000000008ded0 /apex/com.android.runtime/lib64/bionic/libc.so (__memcpy_aarch64_simd+272) (BuildId: 1e3ca19bcae05c01b019c85f3f422e56)
#1 pc 00000000000149d0 /data/app/~~03yXe9mLjLeDLvUmvuTHuA==/com.example.flutter_uvc_camera_example-h4ytK3k-ioVDOkWIuH3Drw==/lib/arm64/libUVCCamera.so (copyToSurface(uvc_frame*, ANativeWindow**)+356) (BuildId: de75f7d09159f97629dd56ea55725acac9e9bfa4)
#2 pc 00000000000145d4 /data/app/~~03yXe9mLjLeDLvUmvuTHuA==/com.example.flutter_uvc_camera_example-h4ytK3k-ioVDOkWIuH3Drw==/lib/arm64/libUVCCamera.so (UVCPreview::do_preview(uvc_stream_ctrl*)+988) (BuildId: de75f7d09159f97629dd56ea55725acac9e9bfa4)
#3 pc 0000000000013b30 /data/app/~~03yXe9mLjLeDLvUmvuTHuA==/com.example.flutter_uvc_camera_example-h4ytK3k-ioVDOkWIuH3Drw==/lib/arm64/libUVCCamera.so (UVCPreview::preview_thread_func(void*)+44) (BuildId: de75f7d09159f97629dd56ea55725acac9e9bfa4)
#4 pc 00000000000fd134 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 1e3ca19bcae05c01b019c85f3f422e56)
#5 pc 0000000000096ae4 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 1e3ca19bcae05c01b019c85f3f422e56)
Lost connection to device.

Exited.

Can't detect the press button event correctly

Hi, I'm using this package to be able to show the output from an external usb camera and to take a picture when the button on the external camera is pressed.
The output of the camera is correct while the button tap doesn't work correctly.

When I press the button for the first time this is the output of the console:

I/CameraView(18813): 点击了设备按钮:button=1 state=1
I/flutter (18813): ------> Received from Android:{msg: 开始拍照, type: msg}
I/flutter (18813): 开始拍照
I/CameraView(18813): 点击了设备按钮:button=1 state=0
I/flutter (18813): ------> Received from Android:{msg: 拍照失败:Failed to save image, type: onError}

Then, if I press the button another time this is what i receive:

I/CameraView(18813): 点击了设备按钮:button=1 state=1
I/CameraView(18813): 点击了设备按钮:button=1 state=0

I'm not a Kotlin dev but I looked in the Kotlin code and seems to me that the path is missing. Isn't it? The function is takePicture:

fun takePicture(callback: UVCPictureCallback) {
        if (!isCameraOpened()) {
            callFlutter("摄像头未打开")
            setCameraERRORState("设备未打开")
            return
        }
        captureImage( object : ICaptureCallBack {
            override fun onBegin() {
                callFlutter("开始拍照")
            }

            override fun onComplete(path: String?) {
                if (path != null) {
                    callback.onPictureTaken(path)
                    MediaScannerConnection.scanFile(view.context, arrayOf(path), null) {
                            mPath, uri ->
                        // 文件已经被扫描到媒体数据库
                        println("Media scan completed for file: $mPath with uri: $uri")
                    }
                } else {
                    callback.onError("拍照失败,未能保存图片")
                }
            }
            override fun onError(error: String?) {
                callback.onError(error ?: "未知错误")
            }

        })
    }

Do you have any suggestion/workaround how to take correctly a image when the camera button is pressed?

Camera stop working after several seconds

Expected Behavior

Continuously transfering frame and logging

Actual Behavior

After several seconds, FPS starts falling until reach 1, and the camera stop working.
Here is the logging

image

Steps to Reproduce the Problem

As same as the guide tells.

Android API > 10 have a issue preview failed?

any one has same issue?

Launching lib\main.dart on TB330FU in debug mode...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:53044/3Il17MPh3I4=/ws
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
I/mali (19229): [DebugProp] GPU Debug-Mechanism Disable !
D/hw-ProcessState(19229): Binder ioctl to enable oneway spam detection failed: Invalid argument
D/BLASTBufferQueue(19229): SurfaceView[com.example.camera_ir2/com.example.camera_ir2.MainActivity]#1 acquireNextBufferLocked size=1920x1177 mFrameNumber=1 applyTransaction=true mTimestamp=5912598863812(auto) mPendingTransactions.size=0 graphicBufferId=82587926134784 transform=7
D/BLASTBufferQueue(19229): VRI[MainActivity]#0 acquireNextBufferLocked size=1920x1200 mFrameNumber=1 applyTransaction=true mTimestamp=5912617517043(auto) mPendingTransactions.size=0 graphicBufferId=82587926134785 transform=7
W/Parcel (19229): Expecting binder but got null!
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
I/flutter (19229): ------> UVCCameraController init
[log] start init
I/PlatformViewsController(19229): Hosting view in view hierarchy for platform view: 0
[log] Permission.storage is grandted
I/PlatformViewsController(19229): PlatformView is using ImageReader backend
D/BufferQueueConsumer(19229): connect: controlledByApp=true
W/OnBackInvokedCallback(19229): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback(19229): Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
I/libPerfCtl(19229): xgfNotifyBufferQuota ret=-1
W/binder:19229_1(19229): type=1400 audit(0.0:3014): avc: denied { ioctl } for path="/proc/perfmgr/perf_ioctl" dev="proc" ino=4026532626 ioctlcmd=0x6718 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:proc_perfmgr:s0 tclass=file permissive=0 app=com.example.camera_ir2
D/Surface (19229): lockHardwareCanvas
E/FrameEvents(19229): updateAcquireFence: Did not find frame.
W/Parcel (19229): Expecting binder but got null!
W/mple.camera_ir2(19229): type=1400 audit(0.0:3015): avc: denied { ioctl } for path="/proc/perfmgr/perf_ioctl" dev="proc" ino=4026532626 ioctlcmd=0x6717 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:proc_perfmgr:s0 tclass=file permissive=0 app=com.example.camera_ir2
[log] Permission.camera is grandted
D/Surface (19229): lockHardwareCanvas
D/TextureView(19229): getHardwareLayer, createNewSurface:true
D/BufferQueueConsumer(19229): connect: controlledByApp=true
V/USBMonitor(19229): USBMonitor:Constructor
V/USBMonitor(19229): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@d3a66c4
I/MultiCameraClient(19229): register...
I/USBMonitor(19229): register:
E/FrameEvents(19229): updateAcquireFence: Did not find frame.
[log] Permission.microphone is grandted
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
D/Surface (19229): lockHardwareCanvas
[log] Permission.audio is grandted
E/FrameEvents(19229): updateAcquireFence: Did not find frame.
E/ImageTextureRegistryEntry(19229): Dropping PlatformView Frame
D/CompatibilityChangeReporter(19229): Compat change id reported: 78294732; UID 10249; state: DISABLED
V/USBMonitor(19229): USBMonitor:Constructor
V/USBMonitor(19229): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@d3a66c4
I/MultiCameraClient(19229): register...
I/USBMonitor(19229): register:
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
I/MultiCameraClient(19229): attach device name/pid/vid:/dev/bus/usb/001/007&8838&7119
I/USBMonitor(19229): request permission, has permission: true
V/USBMonitor(19229): processConnect:device=/dev/bus/usb/001/007
I/USBMonitor(19229): UsbControlBlock:constructor
D/UsbDeviceConnectionJNI(19229): close
I/USBMonitor(19229): name=/dev/bus/usb/001/007,desc=188,busnum=1,devnum=7,rawDesc=
I/MultiCameraClient(19229): connect device name/pid/vid:/dev/bus/usb/001/007&8838&7119
I/CameraView(19229): camera connection. pid: 8838, vid: 7119
I/AspectRatioTextureView(19229): AspectRatio = 1.3333333333333333
I/MultiCameraClient(19229): surface measure size (484, 363)
D/Surface (19229): lockHardwareCanvas
E/FrameEvents(19229): updateAcquireFence: Did not find frame.
I/RenderManager(19229): create RenderManager, Open ES version is 3.2
D/libMEOW (19229): meow new tls: 0x6f32ed2080
D/libMEOW (19229): applied 0 plugin for [com.example.camera_ir2].
D/libMEOW (19229): rebuild call chain: 0x6f32fd1c00
I/EGLEvn (19229): Init EGL Success!
I/EGLEvn (19229): setupSurface Success!
I/AbstractRender(19229): init surface texture render success!
I/AbstractRender(19229): create external texture, id = 1
I/AbstractRender(19229): init surface texture render success!
I/AbstractRender(19229): init surface texture render success!
D/BufferQueueConsumer(19229): connect: controlledByApp=true
D/UsbDeviceConnectionJNI(19229): close
I/libusb/core(19229): [19301core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs(19229): [19301
android_usbfs.c:504:op_init2]:start up hotplug event handler
I/libusb/usbfs(19229): [19301android_usbfs.c:512:op_init2]:call android_scan_devices
I/UVCCamera(19229): open camera status: 477581308544, size: {"formats":[{"index":1,"type":6,"default":1,"size":["1920x1080","1600x896","1280x720","1024x768","1024x576","960x544","864x480","848x480","800x448","640x480","640x360","352x288","320x240"]},{"index":2,"type":4,"default":1,"size":["640x480","1920x1080","1600x896","1280x720","1024x768","960x544","864x480","848x480","800x448","640x360","352x288","320x240"]}]}
I/MultiCameraClient(19229): attach device name/pid/vid:/dev/bus/usb/001/007&8838&7119
I/CameraUVC(19229): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1920, height=1080), PreviewSize(width=1600, height=896), PreviewSize(width=1280, height=720), PreviewSize(width=1024, height=768), PreviewSize(width=1024, height=576), PreviewSize(width=960, height=544), PreviewSize(width=864, height=480), PreviewSize(width=848, height=480), PreviewSize(width=800, height=448), PreviewSize(width=640, height=480), PreviewSize(width=640, height=360), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240)],
I/CameraUVC(19229): getSuitableSize: PreviewSize(width=640, height=480)
I/CameraUVC(19229): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1920, height=1080), PreviewSize(width=1600, height=896), PreviewSize(width=1280, height=720), PreviewSize(width=1024, height=768), PreviewSize(width=1024, height=576), PreviewSize(width=960, height=544), PreviewSize(width=864, height=480), PreviewSize(width=848, height=480), PreviewSize(width=800, height=448), PreviewSize(width=640, height=480), PreviewSize(width=640, height=360), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240)],
I/MultiCameraClient(19229): Audio record by using system mic
I/libUVCCamera(19229): [19304
UVCPreview.cpp:509:prepare_preview]:frameSize=(640,480)@yuyv
I/libUVCCamera(19229): [19306UVCPreview.cpp:267:callbackPixelFormatChanged]:PIXEL_FORMAT_RAW:
I/CameraUVC(19229): start preview, name = /dev/bus/usb/001/007, preview=PreviewSize(width=640, height=480)
I/CameraView(19229): ------>CameraState: OPENED
I/RenderManager(19229): create camera SurfaceTexture: android.graphics.SurfaceTexture@756828c
I/AbstractRender(19229): create texture, id = 2
I/flutter (19229): Camera: OPENED
I/AbstractFboRender(19229): load fbo, textures: [I@fe46dd5, buffers: [I@577d9ea
I/AbstractRender(19229): create texture, id = 3
I/AbstractFboRender(19229): load fbo, textures: [I@d6944db, buffers: [I@52f3b78
I/flutter (19229): openUVCCamera
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
V/USBMonitor(19229): USBMonitor:Constructor
V/USBMonitor(19229): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@d3a66c4
I/MultiCameraClient(19229): register...
I/USBMonitor(19229): register:
D/DecorView(19229): isCts, pkg: com.example.camera_ir2
I/MultiCameraClient(19229): attach device name/pid/vid:/dev/bus/usb/001/007&8838&7119
W/System.err(19229): java.util.concurrent.TimeoutException: Timeout waiting for task.
W/System.err(19229): at com.jiangdg.ausbc.utils.SettableFuture$Sync.get(SettableFuture.kt:85)
W/System.err(19229): at com.jiangdg.ausbc.utils.SettableFuture.get(SettableFuture.kt:47)
W/System.err(19229): at com.jiangdg.ausbc.MultiCameraClient$ICamera.handleMessage(MultiCameraClient.kt:322)
W/System.err(19229): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(19229): at android.os.Looper.loopOnce(Looper.java:201)
W/System.err(19229): at android.os.Looper.loop(Looper.java:288)
W/System.err(19229): at android.os.HandlerThread.run(HandlerThread.java:67)
I/MultiCameraClient(19229): surface measure size null
I/RenderManager(19229): create RenderManager, Open ES version is 3.2
D/libMEOW (19229): meow new tls: 0x6f321cc4c0
D/libMEOW (19229): applied 0 plugin for [com.example.camera_ir2].
D/libMEOW (19229): rebuild call chain: 0x6f321db180
I/EGLEvn (19229): Init EGL Success!
E/BufferQueueProducer(19229): SurfaceTexture-0-19229-0 connect: already connected (cur=1 req=1)
E/libEGL (19229): eglCreateWindowSurface: native_window_api_connect (win=0x6f32e18010) failed (0xffffffea) (already connected to another API?)
E/libEGL (19229): eglCreateWindowSurfaceTmpl:705 error 3003 (EGL_BAD_ALLOC)
E/EGLEvn (19229): Create window failed. error = 12291
I/EGLEvn (19229): setupSurface Success!
I/AbstractRender(19229): init surface texture render success!
I/AbstractRender(19229): create external texture, id = 1
I/AbstractRender(19229): init surface texture render success!
I/AbstractRender(19229): init surface texture render success!
D/BufferQueueConsumer(19229): connect: controlledByApp=true
D/UsbDeviceConnectionJNI(19229): close
I/libusb/core(19229): [19318
core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs(19229): [19318android_usbfs.c:512:op_init2]:call android_scan_devices
E/libusb/usbfs(19229): [19318
android_usbfs.c:1776:release_interface]:release interface failed, error -1 errno 22
E/UVCCamera(19229): [19318*UVCCamera.cpp:172:connect]:could not open camera:err=-99
I/CameraView(19229): ------>CameraState: ERROR
E/CameraUVC(19229): open camera failed.
E/CameraUVC(19229): java.lang.UnsupportedOperationException: open failed:result=-99----->id_camera=477591159808;venderId=7119;productId=8838;fileDescriptor=243;busNum=1;devAddr=7;usbfs=/dev/bus/usb
E/CameraUVC(19229): Exception:调用nativeConnect返回值:-99
E/CameraUVC(19229): at com.jiangdg.uvc.UVCCamera.open(UVCCamera.java:217)
E/CameraUVC(19229): at com.chenyeju.CameraUVC.openCameraInternal(CustomCameraUVC.kt:129)
E/CameraUVC(19229): at com.jiangdg.ausbc.MultiCameraClient$ICamera$handleMessage$1$1.onSurfaceTextureAvailable(MultiCameraClient.kt:345)
E/CameraUVC(19229): at com.jiangdg.ausbc.render.RenderManager.startRenderScreen(RenderManager.kt:269)
E/CameraUVC(19229): at com.jiangdg.ausbc.MultiCameraClient$ICamera.handleMessage(MultiCameraClient.kt:338)
E/CameraUVC(19229): at android.os.Handler.dispatchMessage(Handler.java:102)
E/CameraUVC(19229): at android.os.Looper.loopOnce(Looper.java:201)
E/CameraUVC(19229): at android.os.Looper.loop(Looper.java:288)
E/CameraUVC(19229): at android.os.HandlerThread.run(HandlerThread.java:67)
I/flutter (19229): Camera: ERROR:open camera failed open failed:result=-99----->id_camera=477591159808;venderId=7119;productId=8838;fileDescriptor=243;busNum=1;devAddr=7;usbfs=/dev/bus/usb
I/flutter (19229): Exception:调用nativeConnect返回值:-99
I/CameraUVC(19229): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1920, height=1080), PreviewSize(width=1600, height=896), PreviewSize(width=1280, height=720), PreviewSize(width=1024, height=768), PreviewSize(width=1024, height=576), PreviewSize(width=960, height=544), PreviewSize(width=864, height=480), PreviewSize(width=848, height=480), PreviewSize(width=800, height=448), PreviewSize(width=640, height=480), PreviewSize(width=640, height=360), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240)],
I/CameraUVC(19229): getSuitableSize: PreviewSize(width=640, height=480)
I/CameraUVC(19229): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1920, height=1080), PreviewSize(width=1600, height=896), PreviewSize(width=1280, height=720), PreviewSize(width=1024, height=768), PreviewSize(width=1024, height=576), PreviewSize(width=960, height=544), PreviewSize(width=864, height=480), PreviewSize(width=848, height=480), PreviewSize(width=800, height=448), PreviewSize(width=640, height=480), PreviewSize(width=640, height=360), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240)],
I/MultiCameraClient(19229): Audio record by using system mic
I/CameraUVC(19229): start preview, name = /dev/bus/usb/001/007, preview=PreviewSize(width=640, height=480)
I/CameraView(19229): ------>CameraState: OPENED
I/RenderManager(19229): create camera SurfaceTexture: android.graphics.SurfaceTexture@932919a
I/AbstractRender(19229): create texture, id = 2
W/Looper (19229): Slow dispatch took 2137ms camera-1717406953651 h=android.os.Handler c=null m=1
I/AbstractFboRender(19229): load fbo, textures: [I@a011acb, buffers: [I@ca472a8
I/AbstractRender(19229): create texture, id = 3
I/CameraView(19229): ------>CameraState: CLOSED
I/AbstractFboRender(19229): load fbo, textures: [I@2e431c1, buffers: [I@e982d66
E/ion (19229): ioctl c0044901 failed with code -1: Invalid argument
I/DMABUFHEAPS(19229): Using : Legacy ion heaps
I/USBMonitor(19229): UsbControlBlock#close:
D/UsbDeviceConnectionJNI(19229): close
I/MultiCameraClient(19229): disconnect device name/pid/vid:/dev/bus/usb/001/007&8838&7119
I/CameraUVC(19229): stop preview, name = /dev/bus/usb/001/007
E/libEGL (19229): eglPresentationTimeANDROIDImpl:2226 error 300d (EGL_BAD_SURFACE)
E/EGLEvn (19229): Set Presentation time failed. error = 12301
E/libEGL (19229): eglSwapBuffersWithDamageKHRImpl:1357 error 300d (EGL_BAD_SURFACE)
E/EGLEvn (19229): Swap buffers failed. error = 12301
I/AbstractRender(19229): release surface texture render success!
E/libEGL (19229): eglDestroySurfaceImpl:873 error 300d (EGL_BAD_SURFACE)
I/EGLEvn (19229): Release EGL Success!
I/AbstractRender(19229): release surface texture render success!
E/libEGL (19229): call to OpenGL ES API with no current context (logged once per thread)
I/AbstractRender(19229): release surface texture render success!
D/libMEOW (19229): meow delete tls: 0x6f321cc4c0
I/flutter (19229): Camera: OPENED
I/flutter (19229): Camera: CLOSED

[FLUTTER RELEASE MODE] Error: java.lang.NoSuchMethodError: no static or non-static method "Lcom/jiangdg/uvc/UVCCamera;.

Hey!

When I try to run app on flutter release mode I see this issue and app crashed

I/flutter (31291): ------> UVCCameraController init E/AndroidRuntime(31291): FATAL EXCEPTION: camera-1716391398718 E/AndroidRuntime(31291): Process: com.appName.prod, PID: 31291 E/AndroidRuntime(31291): java.lang.NoSuchMethodError: no static or non-static method "Lcom/jiangdg/uvc/UVCCamera;.nativeSetStatusCallback(JLcom/jiangdg/uvc/IStatusCallback;)I" E/AndroidRuntime(31291): at java.lang.Runtime.nativeLoad(Native Method) E/AndroidRuntime(31291): at java.lang.Runtime.nativeLoad(Runtime.java:1126) E/AndroidRuntime(31291): at java.lang.Runtime.loadLibrary0(Runtime.java:1080) E/AndroidRuntime(31291): at java.lang.Runtime.loadLibrary0(Runtime.java:1003) E/AndroidRuntime(31291): at java.lang.System.loadLibrary(System.java:1661) E/AndroidRuntime(31291): at com.jiangdg.uvc.UVCCamera.<clinit>(SourceFile:5) E/AndroidRuntime(31291): at e2.i.O(SourceFile:9) E/AndroidRuntime(31291): at wa.f$c$b.a(SourceFile:3) E/AndroidRuntime(31291): at cb.f.z(SourceFile:11) E/AndroidRuntime(31291): at wa.f$c.handleMessage(SourceFile:47) E/AndroidRuntime(31291): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(31291): at android.os.Looper.loopOnce(Looper.java:230) E/AndroidRuntime(31291): at android.os.Looper.loop(Looper.java:319) E/AndroidRuntime(31291): at android.os.HandlerThread.run(HandlerThread.java:67)

external_camera_screen dart 2024-05-22 18-30-43

When I run app in flutter dev mode all things work fine, I can see video from external cameras

How to fix it?

Was tested on:
Device: Android 14 - Samsung A55
External cameras: #1 Logitec / #2 Endoscop / #3 no_name

UPD
Both versions: flutter_uvc_camera 0.0.3 and 0.0.2

saving photo directly to a variable

Hello,

I need to save the photo I took with the external camera in a variable, but I couldn't find a way to do it without saving it to the device's path. Is there a way?

does not work on device tablet

Hello, I have tried it on a phone that works fine, but it does not work on the tablet, I have copied the log in case it can be of help:

I/flutter ( 8371): Camera: ERROR:未检测到设备 E/FrameEvents( 8371): updateAcquireFence: Did not find frame. E/ImageTextureRegistryEntry( 8371): Dropping PlatformView Frame D/DecorView( 8371): isCts, pkg: com.example.flutter_uvc_camera_example I/GED ( 8371): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 29, oppidx_max 29, oppidx_min 0

run time error cameraview not initialized issue

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, lateinit property cameraView has not been initialized, null, kotlin.UninitializedPropertyAccessException: lateinit property cameraView has not been initialized.
StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
E/flutter (17930): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
E/flutter (17930):
E/flutter (17930): #2 UVCCameraController.openUVCCamera (package:flutter_uvc_camera/uvc_camera_controller.dart:88:5)
E/flutter (17930):
E/flutter (17930): #3 _CameraTestState.build. (package:usb_camera/main.dart:64:19)
E/flutter (17930):

camera on, but it doesn't show anything

Hello, I have two web cams, one of them works fine, and the other tells me that it is open, but it doesn't show anything.

I leave you the debug, in case it helps:

I/UVCCamera( 6796): open camera status: -5476376628106891136, size: {"formats":[{"index":1,"type":6,"default":1,"size":["1280x720"]}]} I/CameraUVC( 6796): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720)], I/CameraUVC( 6796): getSuitableSize: PreviewSize(width=1280, height=720) I/CameraUVC( 6796): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720)], I/MultiCameraClient( 6796): Audio record by using system mic 2 I/CameraUVC( 6796): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720)], E/CameraUVC( 6796): setPreviewSize failed, try to use yuv format... E/libUVCCamera( 6796): [10190*UVCPreview.cpp:524:prepare_preview]:could not negotiate with camera:err=-51 I/CameraUVC( 6796): start preview, name = /dev/bus/usb/001/003, preview=PreviewSize(width=1280, height=720) I/RenderManager( 6796): create camera SurfaceTexture: android.graphics.SurfaceTexture@4cdbf8 I/CameraView( 6796): ------>CameraState: OPENED I/flutter ( 6796): Camera: OPENED

And a short video:

video5942532878347800676.mp4

Preview error - Frame format / Color space error - could not negotiate with camera:err=-51

While trying to make this package work with a boroscope camera on my phone, I figured that the preview wasn't opening because of a frame format error.

Error: could not negotiate with camera:err=-51.

Related issues in jiangdongguo AndroidUSBCamera:

So my fix was to alter line 154 in the CustomCameraUVC.kt source. The try catch block wasn't working in my wrong frame format case.

CustomCameraUVC.kt:

try {
    Logger.i(TAG, "getSuitableSize: $previewSize")
    if (! isPreviewSizeSupported(previewSize)) {
        closeCamera()
        postStateEvent(ICameraStateCallBack.State.ERROR, "unsupported preview size")
        Logger.e(TAG, "open camera failed, preview size($previewSize) unsupported-> ${mUvcCamera?.supportedSizeList}")
        return
    }
    initEncodeProcessor(previewSize.width, previewSize.height)
    // if give custom minFps or maxFps or unsupported preview size
    // this method will fail
    mUvcCamera?.setPreviewSize(
        previewSize.width,
        previewSize.height,
        MIN_FS,
        MAX_FPS,
        UVCCamera.FRAME_FORMAT_YUYV,                        // ALTERED HERE !!!
        UVCCamera.DEFAULT_BANDWIDTH
    )
} catch (e: Exception) {
    try {
        previewSize = getSuitableSize(request.previewWidth, request.previewHeight).apply {
            mCameraRequest!!.previewWidth = width
            mCameraRequest!!.previewHeight = height
        }
        if (! isPreviewSizeSupported(previewSize)) {
            postStateEvent(ICameraStateCallBack.State.ERROR, "unsupported preview size")
            closeCamera()
            Logger.e(TAG, "open camera failed, preview size($previewSize) unsupported-> ${mUvcCamera?.supportedSizeList}")
            return
        }
        Logger.e(TAG, " setPreviewSize failed, try to use yuv format...")
        mUvcCamera?.setPreviewSize(
            previewSize.width,
            previewSize.height,
            MIN_FS,
            MAX_FPS,
            UVCCamera.FRAME_FORMAT_YUYV,
            UVCCamera.DEFAULT_BANDWIDTH
        )
    } catch (e: Exception) {
        closeCamera()
        postStateEvent(ICameraStateCallBack.State.ERROR, "err: ${e.localizedMessage}")
        Logger.e(TAG, " setPreviewSize failed, even using yuv format", e)
        return
    }
}

It appears that some devices need more configuration options: Frame format, min/max Fps and Bandwidth. I think it would be great to pass these parameters from flutter to android and using them to instantiate the camera.

Could not find com.github.chenyeju295.AndroidUSBCamera:libausbc:3.3.6.

How to take a video?

Hi!

I came across a question, how can I take a video from an external camera?
I only see the takePicture method and I expect the same for video (but with params like duration etc.).
Could you please provide more info about it?

Could not resolve all files for configuration ':app:debugRuntimeClasspath'

Got a gradle error when executing the example:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.chenyeju295.AndroidUSBCamera:libausbc:3.3.6.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/chenyeju295/AndroidUSBCamera/libausbc/3.3.6/libausbc-3.3.6.pom
       - https://repo.maven.apache.org/maven2/com/github/chenyeju295/AndroidUSBCamera/libausbc/3.3.6/libausbc-3.3.6.pom
       - https://storage.googleapis.com/download.flutter.io/com/github/chenyeju295/AndroidUSBCamera/libausbc/3.3.6/libausbc-3.3.6.pom
     Required by:
         project :app > project :flutter_uvc_camera
   > Could not find com.github.chenyeju295.AndroidUSBCamera:libuvc:3.3.6.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/chenyeju295/AndroidUSBCamera/libuvc/3.3.6/libuvc-3.3.6.pom
       - https://repo.maven.apache.org/maven2/com/github/chenyeju295/AndroidUSBCamera/libuvc/3.3.6/libuvc-3.3.6.pom
       - https://storage.googleapis.com/download.flutter.io/com/github/chenyeju295/AndroidUSBCamera/libuvc/3.3.6/libuvc-3.3.6.pom
     Required by:
         project :app > project :flutter_uvc_camera

I suspect it might a problem in my system gradle and jdk version.

flutter doctor -v:

[✓] Flutter (Channel , 3.19.5, on Linux 6.8.1-arch1-1, locale en_US.UTF-8)
    • Flutter version 3.19.5 on channel  at /usr/lib/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision archlinuxaur (unknown (arch linux aur package)), 2038-01-19 03:14:08
    • Engine revision e76c95649884
    • Dart version 3.3.2
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /opt/android-sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /opt/android-sdk
    • ANDROID_SDK_ROOT = /opt/android-sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.2+13)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 2.1.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • ASUS X01AD (mobile) • 192.168.0.101:5555 • android-arm64 • Android 9 (API 28)
    • Linux (desktop)     • linux              • linux-x64     • Linux 6.8.1-arch1-1

[✓] Network resources
    • All expected network resources are available.

Unable to Use USB Webcam with UVCCameraViewParamsEntity

lsusb output:
Bus 001 Device 033: ID 1c4f:3002 SiGma Micro WebCam SiGma Micro

vendorId 1c4f
productId 3002

device_filter.xml:

<?xml version="1.0" encoding="utf-8"?>
<usb>
    <usb-device vendor-id="1c4f" product-id="3002" />
</usb>

the UVCCameraViewParamsEntity takes List of ints for productIds and vendorIds

I tried converting from hex to decimal, but also not working.

Get permission failed in mUsbReceiver

Hi!

I'm trying to use your plugin, but when I give permission for the external USB camera in application I see the log 'get permission failed in mUsbReceiver'.
After that video stream is not working at all.

Here is short demo: demo

How to fix it?

Camera opened, but the preview screen tearing and black screen.

I tried the demo project provided, and it works perfectly fine on my Samsung (Android 12), but I'm facing some issues on my other devices, namely Vivo (Android 12) and Honor (Android 12).

I've tried both frame formats: 0 and 1. With frame format 1, I get a black screen preview, and with frame format 0, I encounter tearing on the screen.

Below are my log messages and some pictures showing the tearing issue. Could you please assist me with this?

Here is the log when using fram formats 1

I/flutter (18399): ------> UVCCameraController init
I/PlatformViewsController(18399): Hosting view in view hierarchy for platform view: 1
I/BufferQueueConsumer(18399): [](id:47df00000004,api:0,p:-1,c:18399) connect: controlledByApp=true
D/Surface (18399): lockHardwareCanvas
I/BufferQueueProducer(18399): [SurfaceTexture-0-18399-2](id:47df00000004,api:1,p:18399,c:18399) connect: api=1 producerControlledByApp=true
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
D/Surface (18399): lockHardwareCanvas
D/TextureView(18399): getHardwareLayer, createNewSurface:true
I/BufferQueueConsumer(18399): [](id:47df00000005,api:0,p:-1,c:18399) connect: controlledByApp=true
V/USBMonitor(18399): USBMonitor:Constructor
V/USBMonitor(18399): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@ba54858
I/MultiCameraClient(18399): register...
I/USBMonitor(18399): register:
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/GED     (18399): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
I/MultiCameraClient(18399): attach device name/pid/vid:/dev/bus/usb/001/008&37187&3034 
I/USBMonitor(18399): request permission, has permission: true
V/USBMonitor(18399): processConnect:device=/dev/bus/usb/001/008
I/USBMonitor(18399): UsbControlBlock:constructor
D/UsbDeviceConnectionJNI(18399): close
I/USBMonitor(18399): name=/dev/bus/usb/001/008,desc=158,busnum=1,devnum=8,rawDesc=
I/MultiCameraClient(18399): connect device name/pid/vid:/dev/bus/usb/001/008&37187&3034 
I/CameraView(18399): camera connection. pid: 37187, vid: 3034
I/AspectRatioTextureView(18399): AspectRatio = 1.3333333333333333
I/MultiCameraClient(18399): surface measure size (825, 618)
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/RenderManager(18399): create RenderManager, Open ES version is 3.2
D/libMEOW (18399): meow new tls: 0xb4000079cd2e6540
D/libMEOW (18399): applied 1 plugins for [com.example.flutter_uvc_camera_example]:
D/libMEOW (18399):   plugin 1: [libMEOW_gift.so]:
I/EGLEvn  (18399): Init EGL Success!
I/BufferQueueProducer(18399): [SurfaceTexture-0-18399-3](id:47df00000005,api:1,p:18399,c:18399) connect: api=1 producerControlledByApp=true
I/EGLEvn  (18399): setupSurface Success!
I/AbstractRender(18399): init surface texture render success!
I/AbstractRender(18399): create external texture, id = 1
I/AbstractRender(18399): init surface texture render success!
I/AbstractRender(18399): init surface texture render success!
I/BufferQueueConsumer(18399): [](id:47df00000006,api:0,p:-1,c:18399) connect: controlledByApp=true
D/UsbDeviceConnectionJNI(18399): close
I/libusb/core(18399): [19133*core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs(18399): [19133*android_usbfs.c:504:op_init2]:start up hotplug event handler
I/libusb/usbfs(18399): [19133*android_usbfs.c:512:op_init2]:call android_scan_devices
I/UVCCamera(18399): open camera status: -5476376623639371264, size: {"formats":[{"index":1,"type":6,"default":1,"size":["1280x720","800x600","640x480","352x288","320x240","176x144","160x120"]},{"index":2,"type":4,"default":1,"size":["1280x720","800x600","640x480","352x288","320x240","176x144","160x120"]}]}
I/CameraUVC(18399): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720), PreviewSize(width=800, height=600), PreviewSize(width=640, height=480), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240), PreviewSize(width=176, height=144), PreviewSize(width=160, height=120)], 
I/CameraUVC(18399): getSuitableSize: PreviewSize(width=640, height=480)
I/CameraUVC(18399): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720), PreviewSize(width=800, height=600), PreviewSize(width=640, height=480), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240), PreviewSize(width=176, height=144), PreviewSize(width=160, height=120)], 
I/MultiCameraClient(18399): Audio record by using system mic
I/libUVCCamera(18399): [19136*UVCPreview.cpp:509:prepare_preview]:frameSize=(640,480)@MJPEG
I/libUVCCamera(18399): [19138*UVCPreview.cpp:267:callbackPixelFormatChanged]:PIXEL_FORMAT_RAW:
I/CameraUVC(18399):  start preview, name = /dev/bus/usb/001/008, preview=PreviewSize(width=640, height=480)
I/RenderManager(18399): create camera SurfaceTexture: android.graphics.SurfaceTexture@4c833f6
I/AbstractRender(18399): create texture, id = 2
I/CameraView(18399): ------>CameraState: OPENED
I/AbstractFboRender(18399): load fbo, textures: [I@f5743f7, buffers: [I@6e76264
I/AbstractRender(18399): create texture, id = 3
I/flutter (18399): Camera: OPENED
I/AbstractFboRender(18399): load fbo, textures: [I@dd78ccd, buffers: [I@53b9982
W/libUVCCamera(18399): [19137*UVCPreview.cpp:128:get_frame]:allocate new frame
W/libUVCCamera(18399): [19136*UVCPreview.cpp:128:get_frame]:allocate new frame
W/libUVCCamera(18399): [19137*UVCPreview.cpp:128:get_frame]:allocate new frame
I/BufferQueueProducer(18399): [SurfaceTexture-1-18399-4](id:47df00000006,api:2,p:18399,c:18399) connect: api=2 producerControlledByApp=true
I/RenderManager(18399): camera render frame rate is 1 fps-->gl_render
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/RenderManager(18399): camera render frame rate is 1 fps-->gl_render
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/RenderManager(18399): camera render frame rate is 2 fps-->gl_render
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/RenderManager(18399): camera render frame rate is 1 fps-->gl_render
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.
I/RenderManager(18399): camera render frame rate is 1 fps-->gl_render
D/Surface (18399): lockHardwareCanvas
E/FrameEvents(18399): updateAcquireFence: Did not find frame.

Here is the log when using frame format 0

I/flutter (26248): ------> UVCCameraController init
I/PlatformViewsController(26248): Hosting view in view hierarchy for platform view: 0
I/BufferQueueConsumer(26248): [](id:668800000012,api:0,p:-1,c:26248) connect(): controlledByApp=true
D/Surface (26248): lockHardwareCanvas
I/BufferQueueProducer(26248): [SurfaceTexture-0-26248-18](id:668800000012,api:1,p:26248,c:26248) connect(): api=1 producerControlledByApp=true
E/FrameEvents(26248): updateAcquireFence: Did not find frame.
D/Surface (26248): lockHardwareCanvas
E/FrameEvents(26248): updateAcquireFence: Did not find frame.
I/flutter (26248): Camera: CLOSED

======== Exception caught by image resource service ================================================
The following PathNotFoundException was thrown resolving an image codec:
Cannot retrieve length of file, path = '' (OS Error: No such file or directory, errno = 2)

When the exception was thrown, this was the stack: 
#0      _checkForErrorResponse (dart:io/common.dart:55:9)
#1      _File.length.<anonymous closure> (dart:io/file_impl.dart:389:7)
<asynchronous suspension>
#2      FileImage._loadAsync (package:flutter/src/painting/image_provider.dart:1481:31)
<asynchronous suspension>
#3      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart:969:3)
<asynchronous suspension>
Path: 
====================================================================================================
D/Surface (26248): lockHardwareCanvas
D/TextureView(26248): getHardwareLayer, createNewSurface:true
I/BufferQueueConsumer(26248): [](id:668800000013,api:0,p:-1,c:26248) connect(): controlledByApp=true
V/USBMonitor(26248): USBMonitor:Constructor
V/USBMonitor(26248): USBMonitor:mUsbManager=android.hardware.usb.UsbManager@973ffb
I/MultiCameraClient(26248): register...
I/USBMonitor(26248): register:
E/FrameEvents(26248): updateAcquireFence: Did not find frame.
D/Surface (26248): lockHardwareCanvas
E/FrameEvents(26248): updateAcquireFence: Did not find frame.
I/MultiCameraClient(26248): attach device name/pid/vid:/dev/bus/usb/001/010&37187&3034 
I/USBMonitor(26248): request permission, has permission: true
V/USBMonitor(26248): processConnect:device=/dev/bus/usb/001/010
I/USBMonitor(26248): UsbControlBlock:constructor
D/UsbDeviceConnectionJNI(26248): close
I/USBMonitor(26248): name=/dev/bus/usb/001/010,desc=138,busnum=1,devnum=10,rawDesc=
I/MultiCameraClient(26248): connect device name/pid/vid:/dev/bus/usb/001/010&37187&3034 
I/CameraView(26248): camera connection. pid: 37187, vid: 3034
I/AspectRatioTextureView(26248): AspectRatio = 1.3333333333333333
W/System.err(26248): java.util.concurrent.TimeoutException: Timeout waiting for task.
W/System.err(26248): 	at com.jiangdg.ausbc.utils.SettableFuture$Sync.get(SettableFuture.kt:85)
W/System.err(26248): 	at com.jiangdg.ausbc.utils.SettableFuture.get(SettableFuture.kt:47)
W/System.err(26248): 	at com.jiangdg.ausbc.MultiCameraClient$ICamera.handleMessage(MultiCameraClient.kt:322)
W/System.err(26248): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(26248): 	at android.os.Looper.loop(Looper.java:223)
W/System.err(26248): 	at android.os.HandlerThread.run(HandlerThread.java:67)
I/MultiCameraClient(26248): surface measure size null
I/RenderManager(26248): create RenderManager, Open ES version is 3.2
I/EGLEvn  (26248): Init EGL Success!
I/BufferQueueProducer(26248): [SurfaceTexture-0-26248-19](id:668800000013,api:1,p:26248,c:26248) connect(): api=1 producerControlledByApp=true
I/EGLEvn  (26248): setupSurface Success!
I/AbstractRender(26248): init surface texture render success!
I/AbstractRender(26248): create external texture, id = 1
I/AbstractRender(26248): init surface texture render success!
I/AbstractRender(26248): init surface texture render success!
I/BufferQueueConsumer(26248): [](id:668800000014,api:0,p:-1,c:26248) connect(): controlledByApp=true
D/UsbDeviceConnectionJNI(26248): close
I/libusb/core(26248): [26467*core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs(26248): [26467*android_usbfs.c:504:op_init2]:start up hotplug event handler
I/libusb/usbfs(26248): [26467*android_usbfs.c:512:op_init2]:call android_scan_devices
I/UVCCamera(26248): open camera status: -5476376651947905088, size: {"formats":[{"index":1,"type":6,"default":1,"size":["1280x720","800x600","640x480","352x288","320x240","176x144","160x120"]},{"index":2,"type":4,"default":1,"size":["1280x720","800x600","640x480","352x288","320x240","176x144","160x120"]}]}
I/CameraUVC(26248): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720), PreviewSize(width=800, height=600), PreviewSize(width=640, height=480), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240), PreviewSize(width=176, height=144), PreviewSize(width=160, height=120)], 
I/CameraUVC(26248): getSuitableSize: PreviewSize(width=640, height=480)
I/CameraUVC(26248): aspect ratio = null, getAllPreviewSizes = [PreviewSize(width=1280, height=720), PreviewSize(width=800, height=600), PreviewSize(width=640, height=480), PreviewSize(width=352, height=288), PreviewSize(width=320, height=240), PreviewSize(width=176, height=144), PreviewSize(width=160, height=120)], 
I/MultiCameraClient(26248): Audio record by using system mic
I/libUVCCamera(26248): [26470*UVCPreview.cpp:509:prepare_preview]:frameSize=(640,480)@YUYV
I/libUVCCamera(26248): [26472*UVCPreview.cpp:267:callbackPixelFormatChanged]:PIXEL_FORMAT_RAW:
I/CameraUVC(26248):  start preview, name = /dev/bus/usb/001/010, preview=PreviewSize(width=640, height=480)
I/RenderManager(26248): create camera SurfaceTexture: android.graphics.SurfaceTexture@77fbd1e
I/AbstractRender(26248): create texture, id = 2
I/CameraView(26248): ------>CameraState: OPENED
I/AbstractFboRender(26248): load fbo, textures: [I@36d9ff, buffers: [I@800b3cc
I/AbstractRender(26248): create texture, id = 3
I/AbstractFboRender(26248): load fbo, textures: [I@adce615, buffers: [I@7668d2a
I/flutter (26248): Camera: OPENED

Untitled

Suggestion for README.md

Hi author,

Thank you for creating such a valuable library. While integrating it into my project, I encountered an issue related to ProGuard. I found the necessary ProGuard settings in your examples, which resolved the issue:

-keep class com.jiangdg.uvc.UVCCamera { native <methods>; long mNativePtr; }
-keep class com.jiangdg.uvc.IStatusCallback { *; }

To help others who might face the same issue, I suggest including this information in your documentation. It would make it easier for users to find and apply the necessary ProGuard rules.

Thank you for your hard work and for providing this great library!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.