Page 1 of 1
Handling crashes when using libVLC to decode a stream
Posted: 18 Sep 2015 12:00
by hvz
I've made a program that uses libVLC to receive and decode audio streams.
Sometimes - depending on the stream format - libVLC crashes, usually when for example some packages have been losts. This only happens for certain codecs.
My problem is that - because libVLC is calling my code, and not the other way around - I don't know how I can catch the exception that occurs so I can handle it gracefully instead of having it kill my application. Is there a solution for this?
Re: Handling crashes when using libVLC to decode a stream
Posted: 18 Sep 2015 12:15
by Rémi Denis-Courmont
As you know, the only way to protect your app from actual crashes is to run separate processes.
Re: Handling crashes when using libVLC to decode a stream
Posted: 18 Sep 2015 13:16
by hvz
That's the only way to be 100% safe, but my experience is that you can catch almost any crash and at least shut down gracefully (or restart) and write some logging using try/catch. So that's what I would like to do here as well.
Re: Handling crashes when using libVLC to decode a stream
Posted: 18 Sep 2015 13:29
by Rémi Denis-Courmont
How and how well to catch run-time exceptions is platform/OS dependent, and really out of scope of a LibVLC forum.
Re: Handling crashes when using libVLC to decode a stream
Posted: 21 Sep 2015 23:26
by hvz
Well, sure. But the thing is: If I could call VLC instead of having VLC call me, it would work (at least under Windows). The way things are now I'm going to have to search for a different solution; only a very small percentage of people who use my software use the VLC integration, but the majority of bug reports that I'm getting are in fact VLC bugs.
Re: Handling crashes when using libVLC to decode a stream
Posted: 22 Sep 2015 10:01
by Rémi Denis-Courmont
You're not making much sense. LibVLC being a library, obviously your program calls LibVLC, not the other way around.