Android VideoPlayer leak


#1

Hi,

I found a massive leak in the VideoPlayer, initially I thought it was the MediaPlayer and Texture not being released so I’ve implemented the java VideoPlayer::destroy() method as follow and ensured it gets called:

public void destroy() {
Log.i(TAG, “VideoPlayer destroy()” );

if ( mMediaPlayer != null )
{
    mMediaPlayer.stop();
    mMediaPlayer.release();
    mMediaPlayer = null;
}

if ( mSurfaceTexture != null )
{
    mSurfaceTexture.release();
    mSurfaceTexture = null;
}

if ( mHandlerThread != null )
{
    mHandlerThread.quit();
    mHandlerThread = null;
}

mHandler        = null;
mFrameAvailable = null;

Log.i(TAG, "VideoPlayer resources released" );
}

That seems to reduce the leak, but the app is still leaking.
Because I ran out of ideas, I’ve implemented a new method loadVideo() to replace the data source inside the media player instead of destroy and create a new one all the time I want to load the video. Again this seems to reduce the leak, but it doesn’t completely fix the issue.

Does anybody have the same problem or knows how to fix it?

thanks
Andrea