Closed avently closed 1 month ago
Not sure.
For context...
vlcj 4.8.2 uses JNA 5.12.1 which is why you previously needed the explicit JNA dependency to override it to 5.14.0 (the latest as of right now).
vlcj 4.8.3 is the latest release and this version uses JNA 5.14.0.
For the crash on stop...
I can't tell anything from your JVM crashdump tbh. I can only suggest you very carefully check code and make sure you are holding hard references to all vlcj objects. This is something where I've seen the GC on Windows vs Linux work differently and code that worked on one platform would crash on another because the GC was more "aggressive".
There's potentially some issue with JNA on macOS ARM, but I have no real evidence to back that up.
It would be interesting if you have been able to build VLC yourself, that you added some log statements to the libvlc_media_player_stop method to see first if that function is actually called, and where in that function the crash is triggered (or not).
I have no Mac ARM hardware so I can't do any more.
I can't tell anything from your JVM crashdump tbh. I can only suggest you very carefully check code and make sure you are holding hard references to all vlcj objects
I tried to NOT release any player instances and hold references forever, but still the same situation.
It would be interesting if you have been able to build VLC yourself, that you added some log statements to the libvlc_media_player_stop method to see first if that function is actually called, and where in that function the crash is triggered (or not).
I added logs to the VLC sources but I don't see anything in system out. I see that logs should be enabled in VLCJ, so not sure why no logs at all. How to enable them? I mean, libvlc_printerr or printf.
By the way, since the initial problem came from Gradle that couldn't sync dependencies, I fixed the problem with Gradle. I have dependency on jSystemThemeDetector
which has dependencies on JNA libs. And somehow that fact prevented Gradle from sync correctly (after year without other visible factors). So I excluded all dependencies from group "net.java.dev.jna" for jSystemThemeDetector
and included required dependencies by hand, now Gradle is happy and VLC works correctly on Intel and Arm.
Final list of deps:
implementation("com.github.Dansoftowner:jSystemThemeDetector:3.8") {
exclude("net.java.dev.jna")
}
// For jSystemThemeDetector only
implementation("net.java.dev.jna:jna-platform:5.14.0")
implementation("uk.co.caprica:vlcj:4.8.3")
implementation("net.java.dev.jna:jna:5.14.0")
BUT it works only using old build of VLC (3.0.19) and still freezes on Intel Mac with the latest code from 3.0.x branch. So logging would really help in this case:)
So there is no problem with vlcj on macOS on ARM now that you have a correct JNA dependency, right?
Your other problem is for VLC?
So there is no problem with vlcj on macOS on ARM now that you have a correct JNA dependency, right?
At least with old version of VLC, no problem. With the latest code from 3.0.x there is a freeze of thread with unknown reason for now. And it's probably unrelated to VLCJ anyway
So if you want, we can close the issue. But I still need to debug looks like in order to get logs
Feel free to post an update if vlcj is still implicated after your debugging.
Hello. First of all, thank you for the library. Using it in production for around a year.
Couple of weeks ago Gradle started to give an error while building a project because for some reason it couldn't find a jna dependency. This is how it was in build files:
I remember that this JNA dependency was needed to make the player working, so it was left in codebase as is. But since Gradle started to give the error, I removed JNA dependency and the player still worked correctly... but not on Mac Arm. On Mac Arm every call to controls().stop() crashes JVM with the following stacktrace:
I use the same VLC build (build was made by me) from previous year, nothing changed in this aspect. JVM also crashes if I don't stop but .prepare() another media. Not sure what can be the reason for such problem. I also compiled the latest code from 3.0.x branch of VLC on Intet Mac and got a freeze instead of crash.
I think the problem cannot be in the library but since you have a lot of experience, maybe you can give an advice and point into the right direction? What can be the cause and how to make it working again without using that broken JNA dependency?
P.s. all logic around the player is inside this file: https://github.com/simplex-chat/simplex-chat/blob/stable/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/RecAndPlay.desktop.kt#L27