Java Code Examples for android.graphics.SurfaceTexture.detachFromGLContext()

The following are Jave code examples for showing how to use detachFromGLContext() of the android.graphics.SurfaceTexture class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: vlc-example-streamplayer   File: AWindow.java   Source Code and License Vote up 6 votes
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}