0

C# console application built in VS2022 using LibVLCSharp 3.6.6 and LibVLC for Windows 3.0.17.4.

I'm stress-testing a RTSP client class that uses libVLCSharp to stream from an IOT camera. In order to check for memory leaks, I've been creating my client object, running the stream for a few seconds, then ending the stream and disposing of the client and all of the VLC components (the VLC instance, the media player and the media) before starting all over again.

I quickly found that around the 60-70th loop, the program inexplicably ends after trying to create the LibVLC() object. No crash, no freezing, no exceptions, just immediately exits the program after this line.

_VlcInstance = new LibVLC();

The only note it gives is this:

RTSPTest.exe exited with code 3.

I couldn't find what VLC's exit code 3 is in the documentation and I don't think this is a memory leak issue. Been watching my memory as this has run and garbage collection appears to be doing its job nicely. Turning on verbosity also doesn't help, it gives no indication that anything is wrong and provides the same lines that comes with creating a LibVLC() object every time, right up until it ends suddenly.

Does anyone have a better idea of what's going on behind the scenes? The end-use for this client requires a lot of client objects to be created and discarded similar to this, so a sudden exit with no warnings or explanation could be a huge issue down the line.

  • Q: Do you have a try/catch block around "new LibVLC()"? Do you get an exception and, if so, what does "ex.Message" say? Q: Have you tried `new LibVLC(enableDebugLogs: true);`, and do the logs show anything? – paulsm4 Sep 16 '22 at 18:19
  • paulsm4 Yes, I have a try/catch block immediately around "new LibVLC()" and up on the console-app level, and the program exits before any potential exception can even be thrown. As I said, greater verbosity doesn't reveal anything. I have *new LibVLC("--verbose=2");*, which gets the same results. – Seth Gibson Sep 16 '22 at 18:55
  • Q: Are you sure the string "--verbose=2" works for the C# library? The example in the documentation uses `new LibVLC(enableDebugLogs: true);`. Q: Have you found any VLS logs anywhere on your hard drive? Q: Have you looked on the [libVLC](https://www.videolan.org/vlc/libvlc.html) site? – paulsm4 Sep 16 '22 at 20:22
  • Share a crash dump, or at least an [MCVE](https://stackoverflow.com/help/minimal-reproducible-example) – mfkl Sep 26 '22 at 00:50
  • How did this go afterwards? I just tried the same process as you with a loop over 1000 times (sleep for 1 second after playing content) and I don't get the issue you have. – LiamJM Jan 27 '23 at 13:44

0 Answers0