webrtc-java
webrtc-java copied to clipboard
Cannot specify camera and capabilities in Ubuntu
Hi Alex !
Thank you for 702e58c. The application does not crash anymore but I still experience the same bug. The camera refuses to launch if device
and capability
are not null.
There are not much detials about this exception because it remains unhandled:
catch (...) {
// app falls here
env->Throw(jni::JavaError(env, "Unhandled Exception"));
}
Context:
- Ubuntu 20
- variables passed to
VideoDeviceSource
Thank you in advance.
P.S. This bug was introduced in 1029fe. Anterior versions work just exellent.
I'm not sure, maybe you are using the old devices API. Could you please try with:
List<VideoDevice> devices = MediaDevices.getVideoCaptureDevices();
List<VideoCaptureCapability> capabilities = MediaDevices.getVideoCaptureCapabilities(device);
VideoDevice cameraDevice = devices.get(0); // Or any device retrieved with MediaDevices.getVideoCaptureDevices()
VideoCaptureCapability cameraCapability = capabilities.get(0);
VideoDeviceSource cameraSource = new VideoDeviceSource();
cameraSource.setVideoCaptureDevice(cameraDevice);
// Optionally
cameraSource.setVideoCaptureCapability(cameraCapability);
try {
cameraSource.start();
}
catch (Throwable e) {
e.printStackTrace();
cameraSource.dispose();
}
Thanks for your suggestion. This is precisely the problem. When cameraDevice
is not null and when it is passed to setVideoCaptureDevice
this error occurs :
backtrace: unhandled exception type: jni::Exception*
java.lang.Error: Unhandled Exception
at webrtc.java/dev.onvoid.webrtc.media.video.VideoDeviceSource.start(Native Method)
What do you mean by "Old devices API" ? Is this related to Ubuntu libs like udev
or v4l2
?
P.S.
libv4l-dev is already the newest version (1.18.0-2build1).
Late, but should be fixed now.