alejandrorosas / android-uvc-rtmp-stream

UVC Rtmp Stream App for Android
Apache License 2.0
27 stars 13 forks source link

NDK Version #40

Closed ignacioinda closed 3 years ago

ignacioinda commented 3 years ago

Thanks for sharing your code, I am trying to compile the project but when I run it the application stops. Could you tell me what version of NDK you used or what can I do to fix this error?

`I/USBMonitor: name=/dev/bus/usb/001/004,desc=52,busnum=1,devnum=4,rawDesc=[B@a89dfd9
D/UsbDeviceConnectionJNI: close
I/libusb/core: [24501*core.c:2085:libusb_init2]:libusb v1.0.19.10903
I/libusb/usbfs: [24501*android_usbfs.c:504:op_init2]:start up hotplug event handler
    [24501*android_usbfs.c:512:op_init2]:call android_scan_devices
D/UsbDeviceConnectionJNI: close
**E/AndroidRuntime: FATAL EXCEPTION: USBMonitor
    Process: dev.alejandrorosas.apptemplate, PID: 24384
    java.lang.NullPointerException
        at dev.alejandrorosas.streamlib.StreamService.stopStream(StreamService.kt:105)
        at dev.alejandrorosas.streamlib.StreamService$onDeviceConnectListener$1.onDisconnect(StreamService.kt:195)
        at com.serenegiant.usb.USBMonitor$UsbControlBlock.close(USBMonitor.java:1357)
        at com.serenegiant.usb.UVCCamera.close(UVCCamera.java:243)
        at com.serenegiant.usb.UVCCamera.destroy(UVCCamera.java:434)
        at dev.alejandrorosas.streamlib.StreamService$onDeviceConnectListener$1.onConnect(StreamService.kt:181)
        at com.serenegiant.usb.USBMonitor$4.run(USBMonitor.java:600)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)**
I/Process: Sending signal. PID: 24384 SIG: 9`
alejandrorosas commented 3 years ago

Hey @ignacioinda It is working for me with 22.1.7171670

ignacioinda commented 3 years ago

Hey @ignacioinda It is working for me with 22.1.7171670

Thanks Alejandro, it was not a problem with the NDK. My camera did not support the MJPEG format and that is why it produced this error. This setup worked for me: File: StreamService.kt -> camera.setPreviewSize (width, height, UVCCamera.FRAME_FORMAT_YUYV);

I have a question: What RTMP server are you using? I am testing with a NGINX RTMP server and the video / audio lags 2 or 3 seconds. I'm not sure if it's a server or app problem

alejandrorosas commented 3 years ago

@ignacioinda I also use nginx rtmp, I have it mounted with docker together with obs-websockets to chance scenes if there's any problem. And yes, you can have 2 or 3 seconds of lag, but video/audio should be synchronized. You can find my setup here: https://github.com/alejandrorosas/rtmp-server-obs-websockets/blob/master/nginx-rtmp/nginx.conf