eduramiba / webcam-capture-driver-native

Native driver for Webcam Capture API
25 stars 8 forks source link

feat: display actual frame rate #22

Closed akexorcist closed 5 months ago

akexorcist commented 5 months ago

Add FPS counter in AVFVideoDevice and CaptureManagerVideoDevice

Use the calculation logic from GStreamerDevice [sarxos/webcam-capture]

eduramiba commented 5 months ago

Thanks for this PR. Unfortunately, the logic would be tied to the consumer, and would only work when calling the getImage function. What I would like to do is to return the natively reported FPS by the device, which should be possible with native driver, but I never got to do it. I think it won't be very difficult but needs some research.

Note: for AVF driver, changing the source code is quite straightforward as it's minimal. For CaptureManager SDK it's not so simple, and actually I would like to create a native DLL that exports simple functions for this driver in the style of AVF driver and stop relying in the java proxy DLL (for latest release 1.24.0 it does not work correctly for some cameras and the problem is definitely caused by the java proxy DLL, so that's why I have not been able to update it yet).

akexorcist commented 5 months ago

@eduramiba That's make sense. I apologize for my incorrect implementation.

As I tested, my video input device has maximum frame rate at 60 FPS but measured FPS can be more than 60 depends on consumer which is not what I also expected.

But as my knowledge field. I'm just Android Dev who try to build desktop app with Kotlin Multiplatform. So I have no idea to help you research on Windows stuff. Sorry about that 🥲.