Page 1 of 1

[SOLVED]DetachCurrentThread not called

Posted: 04 May 2015 16:12
by valentin J
Hi everyone,

I am developping an App that use libVLC to display MP4 videos. I recompile libVLC two weeks ago in order to get le lastest version.

To manage libVLC, I have created a customView that inherits from SurfaceView. When the customView is attached to the Window (onAttachedToWindow() method), I initialize libVLC with that code :

Code: Select all

private void initVlcPlayer() throws LibVlcException { libVLC = new LibVLC(); libVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DISABLED); libVLC.setSubtitlesEncoding(""); libVLC.setTimeStretching(false); libVLC.setFrameSkip(false); libVLC.setAout(LibVLC.AOUT_OPENSLES); libVLC.setVout(LibVLC.VOUT_ANDROID_SURFACE); libVLC.setChroma("RV32"); libVLC.setDevHardwareDecoder(LibVLC.DEV_HW_DECODER_AUTOMATIC); libVLC.setVerboseMode(true); EventHandler.getInstance().addHandler(videoPlayerHandler); libVLC.init(getContext()); }
When the customView is detached (onDetachedFromWindow() method), I try to deallocate libVLC resources like that. (I don't find any doc on how to use the last LibVLC version so I analysed the VLC for Android app source code, but they never release libVLC. They only stop the video).

Code: Select all

private void release() { if (libVLC != null) { if (libVLC.isPlaying()) { stopVideo(); } EventHandler.getInstance().removeHandler(videoPlayerHandler); videoPlayerHandler.removeCallbacksAndMessages(null); libVLC.detachSurface(); libVLC.destroy(); videoPlayerHandler = null; libVLC = null; videoHeight = 0; videoWidth = 0; Log.i(LOG_TAG, " VLC Player instance released"); } }
The problem is that I regularly have in my log that line :

Code: Select all

W/art﹕ Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[29,tid=1382,Native,Thread*=0xaee7a400,peer=0x135270e0,"libvlcjni"]
It appears everytime a video begins or ends.

I don't think it is a normal behavior, so I post here.

Do you have any ideas?

Maybe I make a bad init/release of libVLC. Dealing with libVLC without real doc is hard...

Thanks in advance for your answers and for all the work you have made and you are still making!

Valentin

Re: DetachCurrentThread not called

Posted: 04 May 2015 16:41
by tguillem
Hello,

This warning is normal, we use a pthread_key_create destructor to detach the Java thread, and there is no way to hide this warning.

Thanks for reporting it anyway.

Re: DetachCurrentThread not called

Posted: 04 May 2015 18:24
by valentin J
Ok, thanks for the quick answer!

I guess it is the same thing for this one ?

Code: Select all

linker﹕ libvlcjni.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

Re: DetachCurrentThread not called

Posted: 04 May 2015 23:05
by Jean-Baptiste Kempf
This is of no matter :)