Discussion:
[vlc] android, issue while subclassing surfaceview with libvlc
Benoît Rouits
2013-09-28 08:23:15 UTC
Permalink
Hello vlc people,

I am trying to use libvlcjni and the few LibVLC java classes on Android,
and i get some troubles on displaying a video. Eveyrthing goes okay
until libVLC tries to display a frame, then it sefaults.

Oh, and would like to know if libvlc lisence will allow me to release a
closed-source java application embedding it.

If someone is interested, the issue i encounter:

I am subclassing a SurfaceView in the same idea as Android's 4.x
VideoView class, embedding libvlc inside, instead of Android's
MediaPlayer. I have carefully read VLC's VideoPlayerActivity but i am
stuck with a libvlc segfault while trying to display frames. I guess i
am doing something in the wrong thread, but i'm getting a bit lost :-p
Here is the process:

- on surface creation, i initialize libVLC.

- libvlc inited, i open the media url if any.

- on surface changed, i attach libVLC to it with a small IVideoPlayer
implementation.

- on IVideoPlayer setSurfaceSize, i send a Message to the view,
forwarding params.

- when the view receives the message, it reset the size of the surfaceholder

Then, libvlc segfaults..

Beside, an EventHandler handles libVLC's events and notifes the
surfaceview state to the parent (activity),no problem here.first,

That said, i am pretty shure the segfault occurs because i of my bad.

If someone is interested in this SurfaceView subclass, i would be happy
to share the code on a repo for further usage.

With my thanks for your VLC port on Android,
- Ben
Jean-Baptiste Kempf
2013-09-28 08:56:15 UTC
Permalink
Post by Benoît Rouits
Oh, and would like to know if libvlc lisence will allow me to
release a closed-source java application embedding it.
Should be.
Post by Benoît Rouits
Beside, an EventHandler handles libVLC's events and notifes the
surfaceview state to the parent (activity),no problem here.first,
Did you check the example of the libVLC sdk for android?

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Benoît Rouits
2013-09-28 10:05:05 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Benoît Rouits
Oh, and would like to know if libvlc lisence will allow me to
release a closed-source java application embedding it.
Should be.
Post by Benoît Rouits
Beside, an EventHandler handles libVLC's events and notifes the
surfaceview state to the parent (activity),no problem here.first,
Did you check the example of the libVLC sdk for android?
Best regards,
Oh, no. Only the sources of vlc-android helped me until now. is there
actually a libVLC sdk ? for now, i just used vlc-android's libvlcjni.so
and borrowed some classes from LibVLC seen in vlc-android. but i must
have been wrong if there is an sdk somewhere else... any link ? googling
did not help.

Thanks,
- Ben
Jean-Baptiste Kempf
2013-09-28 15:33:49 UTC
Permalink
Post by Benoît Rouits
Post by Jean-Baptiste Kempf
Post by Benoît Rouits
Oh, and would like to know if libvlc lisence will allow me to
release a closed-source java application embedding it.
Should be.
Post by Benoît Rouits
Beside, an EventHandler handles libVLC's events and notifes the
surfaceview state to the parent (activity),no problem here.first,
Did you check the example of the libVLC sdk for android?
Best regards,
Oh, no. Only the sources of vlc-android helped me until now. is
there actually a libVLC sdk ? for now, i just used vlc-android's
libvlcjni.so and borrowed some classes from LibVLC seen in
vlc-android. but i must have been wrong if there is an sdk somewhere
else... any link ? googling did not help.
It is a bit new, and untested, which is the issue...

See make .sdk.
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
ben
2013-10-02 14:22:37 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Benoît Rouits
Oh, no. Only the sources of vlc-android helped me until now. is
there actually a libVLC sdk ? for now, i just used vlc-android's
libvlcjni.so and borrowed some classes from LibVLC seen in
vlc-android. but i must have been wrong if there is an sdk somewhere
else... any link ? googling did not help.
It is a bit new, and untested, which is the issue...
See make .sdk.
Thanks.
Well now i got LibVLC working nice (video+audio) on an armeabi-v7a with
an android 4.2.2. I actually don't understand why it works now :-p a few
cosmetics added in my SurfaceView subclass made it fall into working :-)

However, with armeabi (and NO_FPU=1) on an older hardware and android
2.3.7, only the audio is working. the screen remains empty. Log lines:
W/VLC ( 1774): swscale filter: can't get output picture
W/VLC ( 1774): swscale filter: can't get output picture
...

I'm going to digg in the issue, and may put the class file online if
anybody is interested of such a class (subclassing SurfaceView).

Anyway, i'm happy it could run fine on a recent hardware+android.

Thanks for this nice piece of software.
ben
2013-10-02 14:22:45 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Benoît Rouits
Oh, no. Only the sources of vlc-android helped me until now. is
there actually a libVLC sdk ? for now, i just used vlc-android's
libvlcjni.so and borrowed some classes from LibVLC seen in
vlc-android. but i must have been wrong if there is an sdk somewhere
else... any link ? googling did not help.
It is a bit new, and untested, which is the issue...
See make .sdk.
Thanks.
Well now i got LibVLC working nice (video+audio) on an armeabi-v7a with
an android 4.2.2. I actually don't understand why it works now :-p a few
cosmetics added in my SurfaceView subclass made it fall into working :-)

However, with armeabi (and NO_FPU=1) on an older hardware and android
2.3.7, only the audio is working. the screen remains empty. Log lines:
W/VLC ( 1774): swscale filter: can't get output picture
W/VLC ( 1774): swscale filter: can't get output picture
...

I'm going to digg in the issue, and may put the java file online if
anybody is interested of such a class (subclassing SurfaceView).

Anyway, i'm happy it could run fine on a recent hardware+android.

Thanks for this nice piece of software.
ben
2013-10-31 16:21:10 UTC
Permalink
Post by ben
Post by Jean-Baptiste Kempf
Post by Benoît Rouits
Oh, no. Only the sources of vlc-android helped me until now. is
there actually a libVLC sdk ? for now, i just used vlc-android's
libvlcjni.so and borrowed some classes from LibVLC seen in
vlc-android. but i must have been wrong if there is an sdk somewhere
else... any link ? googling did not help.
It is a bit new, and untested, which is the issue...
See make .sdk.
Thanks.
Well now i got LibVLC working nice (video+audio) on an armeabi-v7a with
an android 4.2.2. I actually don't understand why it works now :-p a few
cosmetics added in my SurfaceView subclass made it fall into working :-)
However, with armeabi (and NO_FPU=1) on an older hardware and android
W/VLC ( 1774): swscale filter: can't get output picture
W/VLC ( 1774): swscale filter: can't get output picture
...
I'm going to digg in the issue, and may put the java file online if
anybody is interested of such a class (subclassing SurfaceView).
Anyway, i'm happy it could run fine on a recent hardware+android.
Thanks for this nice piece of software.
Okay, i found the issue:

mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

is a bad idea in some pre-3 android version, this leads to an always
invalid surface: holder.getSurface().isValid() is always false in the
surfaceChanged() callback.

Well, removing this line now, video works, but although displaying, it
is so slow/freezing that it is unusable. I tried also a vanilla VLC on
old phones (with NO_FPU=1) and the result is the same almost frozen
video, while Android's MediaPlayer displays the same video flawlessly.
Has this issue been considered already in armeabi no_fpu phones ?
Thanks,
- Ben

Loading...