Issue with reattaching libvlc to new Surface

VLC for Android and Chrome OS specific usage questions
tylerjroach
New Cone
New Cone
Posts: 7
Joined: 22 Sep 2014 21:01

Issue with reattaching libvlc to new Surface

Postby tylerjroach » 13 Apr 2015 20:33

Hi,

I have been using libvlc 0.9.9 in an Android app for a while now. It has been working well, except for 4.4 devices and below hanging in some scenarios when calling vlc.stop(). It looks like the issue relates to the link here: http://comments.gmane.org/gmane.comp.vi ... evel/96116

I have attempted to upgrade to the newest version and all works well, except during device rotation. Here is the strategy I am using.

I am using a retainedFragment inside an Activity. I am creating the vlc player inside the retainedFragment. On rotation, I allow the activity to be destroyed, and the retainedFragment to be re-attached. The reason I am doing this is because the views are completely different for portrait and landscape. I would much prefer to use this approach rather than not allowing the activity to be destroyed and having to manually add and remove the portrait vs landscape views. I also did this in order to keep the video playing in the background while waiting for the new surface to come available.

In 0.9.9, I was able to call libvlc.detach() in SurfaceDestroyed and libvlc.attachSurface(mSurface, this) in SurfaceChanged(). By doing this, libvlc would attach itself to the newly created surface. However, the new versions of libvlc I have tried, including the most current, will not reattach to the newly created surface. Here's an example of what shows in the logs.

04-13 14:05:18.860 14767-15341/com.sparc.stream E/Surface﹕ dequeueBuffer failed (No such device)
04-13 14:05:18.860 14767-15341/com.sparc.stream W/VLC﹕ [7d8909cc] yuv_rgb_neon filter: can't get output picture

I'm not sure if anyone else is using the retained fragment method, but if so, could you share if you have gotten this working. I can work on posting code examples if that would help.

Thanks!

Tyler

rkrishnan2012
New Cone
New Cone
Posts: 4
Joined: 01 Mar 2015 05:20

Re: Issue with reattaching libvlc to new Surface

Postby rkrishnan2012 » 14 Apr 2015 18:02

I am having the exact same issue on the latest build of VLC as well for android Lollipop. When i say setSurface() its not actually drawing on the new surface.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Issue with reattaching libvlc to new Surface

Postby Jean-Baptiste Kempf » 14 Apr 2015 23:15

You cannot do that, of course, because of hardware decoding. You need to disable the video track first.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

tylerjroach
New Cone
New Cone
Posts: 7
Joined: 22 Sep 2014 21:01

Re: Issue with reattaching libvlc to new Surface

Postby tylerjroach » 20 Apr 2015 16:52

Ahh, okay. Thank you! I'm assuming this will work like the new background playback I see in the recent commits and the ability to call setVideoTrack(). I'll update once I try this in case anyone else was curious.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Issue with reattaching libvlc to new Surface

Postby Jean-Baptiste Kempf » 20 Apr 2015 21:42

in the end, yes, this is the goal.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

tylerjroach
New Cone
New Cone
Posts: 7
Joined: 22 Sep 2014 21:01

Re: Issue with reattaching libvlc to new Surface

Postby tylerjroach » 21 Apr 2015 16:54

The suggestion worked perfectly!

libvlc.setVideoTrack(-1)
libvlc.setVideoTrack(0)

I do have one suggestion, however, unless I am missing something.
There is no getter such as libvlc.getVideoTrack(int track), or libvlc.getVideoTracks(int[] tracks).

On some videos that I have to play, the video track is 0, and others, the track is 1. In order to correctly reset the video track, I have to getAudioTrack() and set the opposite of whichever the audio track is.

Thank you!

Tyler


Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: No registered users and 19 guests