JVLC Crash

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

JVLC Crash

Postby davidhoyt » 02 Oct 2008 01:19

Okay, using the latest VLC code, I can get JVLC to crash every time I attempt to add a MediaPlayerListener to a MediaDescriptor and then play, stop, play, stop, play, stop.

IOW, after attaching an event listener and then playing and stopping a few times, it crashes. When I don't attach the listener, I can get it to work every time (I can play/stop forever). If there's a way for me to reuse the MediaDescriptor object, then I suppose that wouldn't be a problem.

Make sense?

I need to receive notification when the player is stopped or reaches the end of a stream, etc.

Thanks for any help you can offer! :D

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 02 Oct 2008 12:58

Hi,

Check viewtopic.php?f=2&t=49612&p=159700&hilit=jvlc#p159331. Although these are not the same problems, may be related.

By the way, if you have been able to overcome my issues, please tell me.


Thanks,
Javi

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 02 Oct 2008 18:59

My experience so far has been that the JVLC developers don't monitor these forums all that much or if they do, they don't post responses very often. On their trac site, they're 2 years late on reaching their milestone (http://trac.videolan.org/jvlc/roadmap). Hence this post: viewtopic.php?f=2&t=50688.

I attempted to code up my own solution to the problem, but I'm a bit unfamiliar with JNA so it's slow-going. I know JNI very well and P/Invoke in the .NET world, but JNA is still a bit confusing. But I'm seeing the same crashes which leads me to believe it's on the C/C++ side.

A little more defensive programming would be helpful. Instead of crashing, check the parameters being passed in and return an error code or something we can use to diagnose the problem instead of just dying on us. And then on the java side check the return codes and throw an exception or do whatever. But trying to make sense of Java's output when a native portion of the app crashes is very annoying and time-consuming.

So in the interim, is there another way that I can receive event notifications (e.g. play, stop, backward, forward, etc.)?

Thanks for taking the time to read this. :)

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 02 Oct 2008 21:49

I managed to get it working - but you're not gonna like the solution!

I basically rewrote the entire JVLC MediaDescriptor and MediaPlayer classes. It's rather ugly, quite complicated, and involved. But no more crashes! :D (At least not so far).

If I can get approval to release my changes, I would be happy to do so.

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 02 Oct 2008 21:56

I'm not sure what the exact cause was, but since I've done lots of JNI layers in the past, I figured something wasn't being cleaned up right causing an invalid reference or something of the sort. So in my rewrite I essentially used the JVLC source as a reference and then rewrote it all.

I also have a nice VLCCanvas class for AWT/Swing and another one for SWT that encapsulates all the gory details and provides a very simple interface (for now): MyCanvas.play("C:\...\hello.avi"); MyCanvas.stop(); MyCanvas.play("C\...\hello2.avi"); MyCanvas.play("C:\...\hello3.avi"); etc.

Now if I could only get VLC to forward mouse and keyboard events to the canvas...

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 03 Oct 2008 11:32

I managed to get it working - but you're not gonna like the solution!

I basically rewrote the entire JVLC MediaDescriptor and MediaPlayer classes. It's rather ugly, quite complicated, and involved. But no more crashes! :D (At least not so far).

If I can get approval to release my changes, I would be happy to do so.
Well, I would like whatever makes JVLC work..haha. Anyway, my problems are related to MediaListPlayer, not to MediaPlayer nor MediaDescriptor (AFAIK). Did you rewrote MediaListPlayer class as well? I suppose that what you have done is to rewrite the JVLC classes that didn't work for you using other JVLC objects and your own structures to manage it, haven't you? Could you please tell me a little more about what you have really done to get it working?

If you want your changes to be considered and/or committed refer to JVLC site.

Thanks.

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 03 Oct 2008 17:58

By the way, why do you want to add a MediaPlayerListener to a MediaDescriptor object? I think it doesn't make any sense as listeners should be added to MediaPlayer objects, shouldn't they?

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 03 Oct 2008 21:04

Sorry - you're right, it was the MediaPlayer object.

I'm having yet another problem with hosting multiple jvlc panels in a single dialog. They seem to lock up on me. They start playing, get to the end of the video (it's just a 3 second clip), and then it freezes. Sometimes it gets through just fine. It's a race condition of some kind, but it happens 9 out of 10 times. When I run it w/ just one panel, it seems to be fine.

Any thoughts?

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 06 Oct 2008 13:10

Hi,

As I experienced many issues with JVLC's MediaListPlayer I'm currently trying to create my own CustomMediaListPlayer class. In order to make it work I need to use listeners and events as you have done.

Then, I've experienced a problem with MediaPlayer management when an End Reached event is raised.

My code for this event is:

Code: Select all

public void endReached(MediaPlayer mediaPlayer) { System.out.println("End reached"); int currentItem = mediaList.indexOf(currentMediaDescriptor); if ( currentItem < mediaList.size() - 1 ) { setMedia(mediaList.getMediaDescriptorAtIndex(currentItem + 1)); mediaPlayer.play(); } } public void setMedia (MediaDescriptor mediaDescriptor) { mediaPlayer.setMedia(mediaDescriptor); }
and the output when 2 files are added to the mediaList object and the first one has been finished is this (when setMedia is called):

Code: Select all

End reached LibVLC fatal error destroying mutex in thread 2928491408 at misc/events.c:151: 16 Error message: Device or resource busy at: /usr/lib/libvlccore.so.0(vlc_pthread_fatal+0xb5)[0xb52a9675]
and the program exits (fails).

How did you solve this issue?


Regards,
Javi

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 06 Oct 2008 18:36

If I can, I'll try to get permission to release my code. But I haven't done any work with the MediaListPlayer object. But I did create a custom JVLC, MediaPlayer, and MediaDescriptor class.

I think I got my freeze problem solved. We shall see. :D

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 07 Oct 2008 17:23

Hi again,

Your crashes issues were related to JRE crash with a segmentation fault signal (SIGSEGV)?

Code: Select all

# # An unexpected error has been detected by Java Runtime Environment: # # SIGSEGV (0xb) at pc=0xb5268184, pid=9745, tid=3039714192 # # Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing linux-x86) # Problematic frame: # C [libvlc.so+0xe184] libvlc_media_event_manager+0x4 ...

Gonzalez

Re: JVLC Crash

Postby Gonzalez » 07 Oct 2008 22:52

Anyone try jvlc with vlc 0.9.4?

davidhoyt
Blank Cone
Blank Cone
Posts: 68
Joined: 02 May 2008 03:26

Re: JVLC Crash

Postby davidhoyt » 08 Oct 2008 20:01

I'm doing mine with the latest stable windows/linux releases. :)

othon2000
Blank Cone
Blank Cone
Posts: 15
Joined: 01 Sep 2008 00:26

Re: JVLC Crash

Postby othon2000 » 08 Oct 2008 23:03

Well, I'm happy that you can at least run something with JVLC...

I tried for like a month (you can search for my posts) to make it work under windows and/or linux but had no success.

Now I found a "better" solution so I cant get my P2P streaming project going: I coded a "Player" class which calls VLC through the telnet interface using the TelnetClient class from the commons-net lib.
Not a very pretty solution, but as I can't get support with JVLC that's what I can do!

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 09 Oct 2008 09:56

othon2000,

I've been trying to make JVLC work for a year and, with the latest jar file, it has been possible to use it, although as you can see in this and many other threads, there is an existing lack of programmers and support. The issues with JVLC crashes seem to be related with JNA "translations" from VLC native code to Java's JVLC. JVLC's methods only call libvlc (native code) through a JNA interface and some objects and methods fail (I experienced many problems with MediaListPlayer, deprecated Playlist and MediaPlayer classes). So, it depends on what you want to do with JVLC in your application if you can carry on with JVLC's out-of-the-box capabilities or you need to reprogram or use the available classes. Then, maybe you don't need such telnet interface.


davidhoyt,

Did you take a look at my previous post about the SIGSEGV error when crashing JVLC?


Regards,
Javi

othon2000
Blank Cone
Blank Cone
Posts: 15
Joined: 01 Sep 2008 00:26

Re: JVLC Crash

Postby othon2000 » 09 Oct 2008 21:01

othon2000,

I've been trying to make JVLC work for a year and, with the latest jar file, it has been possible to use it, although as you can see in this and many other threads, there is an existing lack of programmers and support. The issues with JVLC crashes seem to be related with JNA "translations" from VLC native code to Java's JVLC. JVLC's methods only call libvlc (native code) through a JNA interface and some objects and methods fail (I experienced many problems with MediaListPlayer, deprecated Playlist and MediaPlayer classes). So, it depends on what you want to do with JVLC in your application if you can carry on with JVLC's out-of-the-box capabilities or you need to reprogram or use the available classes. Then, maybe you don't need such telnet interface.


davidhoyt,

Did you take a look at my previous post about the SIGSEGV error when crashing JVLC?


Regards,
Javi
dulceangustia,

Can you use the VLM functionalities?
Which versions of VLC/JVLC are you using, and which OS?
Did you build them yourself?

jgg
Cone that earned his stripes
Cone that earned his stripes
Posts: 144
Joined: 03 Nov 2007 15:49

Re: JVLC Crash

Postby jgg » 09 Oct 2008 22:23

1. No, I use VLM through telnet - command line with my own Java front end on the server side and with VLC 0.8.6e. I haven't tried JVLC's VLM object.

2. I have tried many combinations but, basically, I've tried JVLC's site jar file (0.9.0-test3 from 27-7-2008) with VLC 0.9.0 test 3 with the same date and VLC 0.9.3 as well, same results. I've created my own JVLC snapshots but with very slight modifications (adding some native VLC methods that were not available in JVLC's objects, like setMedia(MediaDescriptor) on MediaPlayer class). I'm developing my application on Linux platform, Ubuntu 8.04.1.

3. As said before, I've built some JVLC snapshots and, obviously, VLC itself.

othon2000
Blank Cone
Blank Cone
Posts: 15
Joined: 01 Sep 2008 00:26

Re: JVLC Crash

Postby othon2000 » 09 Oct 2008 22:42

I had like the same enviroment as you when I built VLC/JVLC 0.9.0 also under Ubuntu 8.04.

I could play the media using jvlc, but VLM didn't work.

Orcephrye
Blank Cone
Blank Cone
Posts: 13
Joined: 13 Nov 2008 09:06

Re: JVLC Crash

Postby Orcephrye » 06 Dec 2008 00:21

Hey! I seam to have a similar issue with MediaPlayerListener. I can add a listener to a player once and it will play and the listener listens just happly however the moment I play a different media.. boom! It crashes after about 10 seconds. I will try to post the output here once I get home to run it again.

On another note though I am a little curious as to why use MediaList class at all? I mean it is very small and seams in my opinion to lack all around. So I setup my own MediaListManager class that uses my own MediaInfo class. MediaInfo stores data such as name, directory, lenght of media, and mrl. It also has a method that takes the active JVLC instance as an argument to create a MediaDescriptor based on the info it stores. It is also Serialized so you can easily do biniary IO with it to store on a disk or ship across the network. Then the MediaListManager which doesn't use MediaList at all, manages the MediaInfo classes with a List. I can go back and forth easily save the object to a disk it doesn't require VLC to be running and I dont have to deal with anything but MediaDescriptor, MediaPlayer and MediaPLayerListener which of course I have problems with. :-(
A bad day with Linux is still better then a Good day with Windoz

lec-chr
New Cone
New Cone
Posts: 7
Joined: 03 Feb 2010 15:53

Re: JVLC Crash

Postby lec-chr » 22 Apr 2010 12:36

I think that there is a potential bug in MediaPlayer.java
The Callbacks (Listener) are removed in the finally of that class (so at GC time).
If you create a new MediaPlayer, the application crashes after a few seconds (probably when the first player is GCed).
I have moved the code of finally block in a release() method and call release() whenever I no longer want a MediaPlayer, and it now works fine.

lec-chr
New Cone
New Cone
Posts: 7
Joined: 03 Feb 2010 15:53

Re: JVLC Crash

Postby lec-chr » 23 Apr 2010 14:40

Hum..... I was using JVLC from the code (downloaded 2-3 months ago). I have switched to the binary release and it works fine and MediaPlayer does (now) have a release method.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 36 guests