Segmentation fault on new AudioMediaPlayerComponent()

This forum is about all development around libVLC.
ricar
New Cone
New Cone
Posts: 3
Joined: 18 Mar 2019 15:44

Segmentation fault on new AudioMediaPlayerComponent()

Postby ricar » 18 Mar 2019 15:58

Hi,
I'm trying, in my java application, to use libvlc to play a audio stream.
My environment is this:


vlcj: (Info.java:70) | INFO | vlcj: 2.4.1
vlcj: (Info.java:71) | INFO | java: 1.8.0_181 Oracle Corporation
vlcj: (Info.java:72) | INFO | java home: /usr/lib/jvm/java-8-openjdk-armhf/jre
vlcj: (Info.java:73) | INFO | os: Linux 4.9.88-10179-ga2cc75c7c427-dirty arm

when I call this function:
AudioMediaPlayerComponent mediaPlayerComponent=new AudioMediaPlayerComponent()
my application fails and displays a segmentation fault error.
I reported all output when i run my application:

java -Djna.debug_load.jna=true -Djna.library.path=/usr/lib/arm-linux-gnueabihf -Dvlcj.log=DEBUG -jar player.jar

Mar 18, 2019 2:33:17 PM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from sun.misc.Launcher$AppClassLoader@d93b30 for /com/sun/jna/linux-arm/libjnidispatch.so
Mar 18, 2019 2:33:17 PM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at jar:file:/home/x_user/NetBeansProjects/player/dist/lib/jna-5.2.0.jar!/com/sun/jna/linux-arm/libjnidispatch.so
Mar 18, 2019 2:33:17 PM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to /root/.cache/JNA/temp/jna1853999980795198447.tmp
Mar 18, 2019 2:33:17 PM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Trying /root/.cache/JNA/temp/jna1853999980795198447.tmp
Mar 18, 2019 2:33:17 PM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Found jnidispatch at /root/.cache/JNA/temp/jna1853999980795198447.tmp
vlcj: (MediaPlayerFactory.java:131) | DEBUG | Trying workaround for Java7 on Linux
vlcj: (MediaPlayerFactory.java:137) | DEBUG | Attempting to load jawt...
vlcj: (MediaPlayerFactory.java:139) | DEBUG | ...loaded jawt
vlcj: (MediaPlayerFactory.java:147) | DEBUG | Java7 on Linux workaround complete.
vlcj: (Info.java:70) | INFO | vlcj: 2.4.1
vlcj: (Info.java:71) | INFO | java: 1.8.0_181 Oracle Corporation
vlcj: (Info.java:72) | INFO | java home: /usr/lib/jvm/java-8-openjdk-armhf/jre
vlcj: (Info.java:73) | INFO | os: Linux 4.9.88-10179-ga2cc75c7c427-dirty arm
vlcj: (LibVlcFactory.java:164) | INFO | vlc: 3.0.6 Vetinari, changeset 3.0.6-0-g5803e85f73
vlcj: (LibVlcFactory.java:165) | INFO | libvlc: /usr/lib/arm-linux-gnueabihf/libvlc.so
vlcj: (MediaPlayerFactory.java:236) | DEBUG | MediaPlayerFactory(libvlc=Proxy interface to Native Library </usr/lib/arm-linux-gnueabihf/libvlc.so@1646186488>,libvlcArgs=[--ignore-config, --no-plugins-cache, --quiet, --quiet-synchro, --intf=dummy])
vlcj: (MediaPlayerFactory.java:238) | DEBUG | jna.library.path=/usr/lib/arm-linux-gnueabihf
Segmentation fault

How can I resolve this issue?

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Segmentation fault on new AudioMediaPlayerComponent()

Postby unidan » 18 Mar 2019 16:09

Hi, can you provide some code / a calltrace ?

ricar
New Cone
New Cone
Posts: 3
Joined: 18 Mar 2019 15:44

Re: Segmentation fault on new AudioMediaPlayerComponent()

Postby ricar » 18 Mar 2019 16:22

Hi,
my main class is this:

Code: Select all

package player; /** * * @author x_user */ public class Player { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here PlayerInstance pl_Instance = new PlayerInstance("http://shoutcast.rtl.it:3010/"); pl_Instance.start(); while (true) { } } }

new PlayerInstance("http://shoutcast.rtl.it:3010/") calls the constructor of this class:

Code: Select all

package player; import uk.co.caprica.vlcj.binding.internal.libvlc_media_t; import uk.co.caprica.vlcj.component.AudioMediaPlayerComponent; import uk.co.caprica.vlcj.player.MediaPlayer; import uk.co.caprica.vlcj.player.MediaPlayerEventAdapter; /** * A single player instance. */ public class PlayerInstance extends MediaPlayerEventAdapter { private AudioMediaPlayerComponent mediaPlayerComponent; private final String url; public PlayerInstance(String stringUrl) { url=stringUrl; try{ mediaPlayerComponent = new AudioMediaPlayerComponent(); //when execute this I have segmentation fault mediaPlayerComponent.getMediaPlayer().addMediaPlayerEventListener(new MediaPlayerEventAdapter() { @Override public void stopped(MediaPlayer mediaPlayer) { // LOGGER.error("Evento Vlcj: Stopped"); start(); } @Override public void finished(MediaPlayer mediaPlayer) { // LOGGER.error("Evento Vlcj: Finished"); mediaPlayer.stop(); start(); } @Override public void error(MediaPlayer mediaPlayer) { // LOGGER.error("Evento Vlcj: Error"); mediaPlayer.stop(); start(); } @Override public void playing(MediaPlayer mediaPlayer) { // LOGGER.debug("Evento Vlcj: Playing"); } @Override public void paused(MediaPlayer mediaPlayer) { // LOGGER.debug("Evento Vlcj: Paused"); } @Override public void opening(MediaPlayer mediaPlayer) { // LOGGER.debug("Evento Vlcj: Opening..."); } @Override public void mediaChanged(MediaPlayer mediaPlayer, libvlc_media_t media, String mrl) { // LOGGER.debug("Evento Vlcj: mediaChanged"); } @Override public void buffering(MediaPlayer mediaPlayer, float newCache) { // LOGGER.debug("Evento Vlcj: buffering newCache: " + newCache); } @Override public void lengthChanged(MediaPlayer mediaPlayer, long newLength) { // LOGGER.debug("Evento Vlcj: lengthChanged"); } @Override public void mediaStateChanged(MediaPlayer mediaPlayer, int newCount) { // LOGGER.debug("Evento Vlcj: mediaStateChanged newCount " + newCount); } }); }catch(Exception ex){ ex.getCause(); } } public void start() { mediaPlayerComponent.getMediaPlayer().playMedia(url); } public void exit(int result) { mediaPlayerComponent.release(); System.exit(result); } }

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Segmentation fault on new AudioMediaPlayerComponent()

Postby unidan » 18 Mar 2019 17:36

Hi, it doesn't seem to be libvlc-jni bindings so it's hard to guess.
You should follow the project guidelines https://github.com/caprica/vlcj#support

ricar
New Cone
New Cone
Posts: 3
Joined: 18 Mar 2019 15:44

Re: Segmentation fault on new AudioMediaPlayerComponent()

Postby ricar » 19 Mar 2019 12:06

Thank you,
the issue is the old vlcj jar that I used.
Using vlcj-3.12.1. jar with all dependencies jar that are in directory that I download from this link http://capricasoftware.co.uk/projects/v ... stallation I resolved the problem.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 25 guests