JVLC crash when streaming!
Posted: 25 Sep 2008 18:55
When I reopen a stream the jvlc player crashes with following failure:
this is my implementation:
I use vlc player 0.9.2 on windows vista with java 1.6
Code: Select all
[00000001] main libvlc debug: VLC media player - version 0.9.2 Grishenko - (c) 1996-2008 the VideoLAN team
[00000001] main libvlc debug: libvlc was configured with ./configure '--host=i586-mingw32msvc' '--build=i386-linux' '--enable-mkv' '--enable-release' '--without-contrib' '--enable-nls' '--enable-shared-libvlc' '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-real' '--enable-realrtsp' '--enable-ffmpeg' '--with-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-config-path=/usr/win32/bin' '--with-ffmpeg-zlib' '--enable-live555' '--with-live555-tree=/usr/win32/live.com' '--ena
[00000001] main libvlc debug: translation test: code is "C"
udp://@:12405
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x774db15f, pid=1532, tid=1800
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing windows-x86)
# Problematic frame:
# C [ntdll.dll+0x3b15f]
#
# An error report file with more information is saved as:
# C:\11-eclipseWorkspace\unikluni\hs_err_pid1532.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
*** LibVLC Exception not handled: No active input
Set a breakpoint in 'libvlc_exception_not_handled' to debug.
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 0) for PID 66
Fontconfig error: Cannot load default config file
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 0) for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 0) for PID 66
Fontconfig error: Cannot load default config file
Code: Select all
package at.uniklu.unikluni.client.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.WindowConstants;
import org.videolan.jvlc.Audio;
import org.videolan.jvlc.JVLC;
import org.videolan.jvlc.MediaDescriptor;
import org.videolan.jvlc.MediaPlayer;
import at.uniklu.unikluni.client.listener.ClientMediaPlayerListener;
import at.uniklu.unikluni.client.listener.JVLCPanelComponentAdapter;
import at.uniklu.unikluni.param.client.ParamHandler;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
public class JVLCPanel extends JPanel{
private static final long serialVersionUID = -3316671696374369195L;
private Audio audio;
private MediaDescriptor mediaDescriptor;
private MediaPlayer player;
private JVLC jvlc;
private ParamHandler pm;
private JVLCCanvas jvcc = null;
/**
* Constructor.
* @param source (e.g.: "C:/11-eclipseWorkspace/test-videos/t-en.mpg")
* @param number
*
*/
public JVLCPanel(ParamHandler pm, String source) {
super();
this.pm = pm;
this.jvcc = new JVLCCanvas(this.pm.getVlcArg());
this.add(jvcc);
jvlc = jvcc.getJVLC();
mediaDescriptor = new MediaDescriptor(jvlc, source);
player = mediaDescriptor.getMediaPlayer();
player.addListener(new ClientMediaPlayerListener());
audio = new Audio(jvlc);
addComponentListener(new JVLCPanelComponentAdapter());
}
public MediaPlayer getMediaPlayer() {
return player;
}
/**
* Set new source to play.
* @param source
*/
public void setSource(String source) {
mediaDescriptor = new MediaDescriptor(jvlc, source);
stop();
player = null;
player = mediaDescriptor.getMediaPlayer();
}
/**
* Start player.
*/
public void play() {
jvlc.setVideoOutput(jvcc);
player.play();
}
/**
* Stop player.
*/
public void stop() {
player.stop();
}
public void stopAndDelete() {
//jvlc.getVLM().stopMedia(player.getMediaDescriptor().getMrl());
jvlc.getVLM().release();
jvlc.release();
System.out.println(player.getMediaDescriptor().getMrl());
// System.out.println(jvlc.getMediaList().getMediaDescriptorAtIndex(0));
}
/**
* Set mute.
* @param mute
*/
public void setMute(boolean mute) {
audio.setMute(mute);
}
/**
* Set volume.
* @param volume
*/
public void setVolume(int volume) {
audio.setVolume(volume);
}
/**
* Return JVLC.
* @return
*/
public JVLC getJVLCObject() {
return jvlc;
}
/**
* Set window size.
*/
public void setSize(int width, int height) {
this.jvcc.setSize(width - 10, height - 10);
}
/**
* Set window size.
*/
public void setSize(Dimension dim) {
this.jvcc.setSize(dim.width - 10, dim.height - 10);
}
/**
* From this point all methods and classes are used only for test purposes.
* @param args
*/
public static void main(String[] args) {
//JVLCPanel jp = new JVLCPanel(new ParamHandler(), "C:/11-eclipseWorkspace/test-videos/t-en.mpg");
JVLCPanel jp = new JVLCPanel(new ParamHandler(), "udp://@:12405");
JFrame jf = new JFrame();
jf.setLayout(new FormLayout("fill:pref:grow","fill:pref:grow,fill:pref:grow"));
jf.add(jp, new CellConstraints(1, 1));
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jf.addWindowListener(jp.new MyWindowListener(jp));
JToggleButton onOffButton = new JToggleButton("off");
onOffButton.setSelected(true);
jf.add(onOffButton, new CellConstraints(1, 2));
onOffButton.addActionListener(jp.new OnOffButtonListener(jp.getJVLCObject(), jp.getMediaPlayer(), jp));
jf.setSize(320, 240);
jf.setVisible(true);
jp.play();
}
private class MyWindowListener implements WindowListener{
private JVLCPanel jp;
public MyWindowListener(JVLCPanel jp) {
this.jp = jp;
}
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent e) {
System.out.println("window closing");
JVLC jvlc = jp.getJVLCObject();
jvlc.getVLM().release();
jvlc.release();
((JFrame)e.getSource()).dispose();
}
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
}
private class OnOffButtonListener implements ActionListener {
private JVLC jvlc;
private MediaPlayer player;
private JVLCPanel jp;
public OnOffButtonListener(JVLC jvlc, MediaPlayer player, JVLCPanel jp) {
this.jvlc = jvlc;
this.player = player;
this.jp = jp;
}
public void actionPerformed(ActionEvent e) {
JToggleButton button = ((JToggleButton)e.getSource());
if (button.isSelected()) {
button.setText("off");
player.play();
} else {
button.setText("on");
player.stop();
jp.stopAndDelete();
jvlc.release();
}
}
}
}