Handling crashes when using libVLC to decode a stream

This forum is about all development around libVLC.
hvz
New Cone
New Cone
Posts: 6
Joined: 30 May 2014 10:31

Handling crashes when using libVLC to decode a stream

Postby hvz » 18 Sep 2015 12:00

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Handling crashes when using libVLC to decode a stream

Postby Rémi Denis-Courmont » 18 Sep 2015 12:15

As you know, the only way to protect your app from actual crashes is to run separate processes.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

hvz
New Cone
New Cone
Posts: 6
Joined: 30 May 2014 10:31

Re: Handling crashes when using libVLC to decode a stream

Postby hvz » 18 Sep 2015 13:16

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Handling crashes when using libVLC to decode a stream

Postby Rémi Denis-Courmont » 18 Sep 2015 13:29

How and how well to catch run-time exceptions is platform/OS dependent, and really out of scope of a LibVLC forum.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

hvz
New Cone
New Cone
Posts: 6
Joined: 30 May 2014 10:31

Re: Handling crashes when using libVLC to decode a stream

Postby hvz » 21 Sep 2015 23:26

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Handling crashes when using libVLC to decode a stream

Postby Rémi Denis-Courmont » 22 Sep 2015 10:01

You're not making much sense. LibVLC being a library, obviously your program calls LibVLC, not the other way around.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 31 guests