本文整理汇总了Java中android.graphics.SurfaceTexture.release方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceTexture.release方法的具体用法?Java SurfaceTexture.release怎么用?Java SurfaceTexture.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.SurfaceTexture
的用法示例。
在下文中一共展示了SurfaceTexture.release方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetPresentationTime
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
/**
* Test for {@link GLTools#setPresentationTime(EGLDisplay, EGLSurface, long)} .
* @throws Exception by some fails
*/
@Test
public final void testSetPresentationTime() throws Exception {
final EGLDisplay eglDisplay = GLTools.newDisplay();
final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
final EGLSurface eglSurface =
GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);
final int txt = GLTools.newTexture(TEXTURE_LEVEL);
final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
final Surface surface = new Surface(surfaceTexture);
final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);
GLTools.setPresentationTime(eglDisplay, window, PRESENTATION_TIME);
GLTools.closeSurface(eglDisplay, window);
surface.release();
surfaceTexture.release();
GLTools.closeTexture(txt, TEXTURE_LEVEL);
GLTools.closeSurface(eglDisplay, eglSurface);
GLTools.closeContext(eglDisplay, eglContext);
GLTools.closeDisplay(eglDisplay);
}
示例2: releaseSurfaceTexture
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture) {
if (surfaceTexture == null) {
Log.d(TAG, "releaseSurfaceTexture: null");
} else if (mDidDetachFromWindow) {
if (surfaceTexture != mSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release different SurfaceTexture");
surfaceTexture.release();
} else if (!mOwnSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release detached SurfaceTexture");
surfaceTexture.release();
} else {
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): already released by TextureView");
}
} else if (mWillDetachFromWindow) {
if (surfaceTexture != mSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): release different SurfaceTexture");
surfaceTexture.release();
} else if (!mOwnSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): re-attach SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
} else {
Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): will released by TextureView");
}
} else {
if (surfaceTexture != mSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: alive: release different SurfaceTexture");
surfaceTexture.release();
} else if (!mOwnSurfaceTexture) {
Log.d(TAG, "releaseSurfaceTexture: alive: re-attach SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
} else {
Log.d(TAG, "releaseSurfaceTexture: alive: will released by TextureView");
}
}
}
示例3: testSwapBuffers
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
/**
* Test for {@link GLTools#swapBuffers(EGLDisplay, EGLSurface)}.
* @throws Exception by some fails
*/
@Test
public final void testSwapBuffers() throws Exception {
final EGLDisplay eglDisplay = GLTools.newDisplay();
final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
final EGLSurface eglSurface =
GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);
try {
GLTools.swapBuffers(eglDisplay, eglSurface);
} catch (RuntimeException exception) {
final int txt = GLTools.newTexture(TEXTURE_LEVEL);
final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
final Surface surface = new Surface(surfaceTexture);
final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);
GLTools.makeCurrent(eglDisplay, window, eglContext);
GLTools.swapBuffers(eglDisplay, window);
GLTools.closeSurface(eglDisplay, window);
surface.release();
surfaceTexture.release();
GLTools.closeTexture(txt, TEXTURE_LEVEL);
}
GLTools.closeSurface(eglDisplay, eglSurface);
GLTools.closeContext(eglDisplay, eglContext);
GLTools.closeDisplay(eglDisplay);
}
示例4: onDetachedFromWindow
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
protected void onDetachedFromWindow() {
mRenderThread.dispose();
super.onDetachedFromWindow();
final SurfaceTexture surfaceTexture = getSurfaceTexture();
if (surfaceTexture != null) {
surfaceTexture.release();
}
}
示例5: releaseGlSurface
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
private void releaseGlSurface(SurfaceTexture st) {
if (st != null) {
st.release();
}
if (mWindowSurface != null) {
mWindowSurface.release();
mWindowSurface = null;
}
if (mEglCore != null) {
mEglCore.release();
mEglCore = null;
}
}
示例6: onSurfaceTextureDestroyed
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
surface.release();
return true;
}
示例7: run
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void run() {
while (true) {
SurfaceTexture surfaceTexture = null;
// Latch the SurfaceTexture when it becomes available. We have to wait for
// the TextureView to create it.
synchronized (mLock) {
while (!mDone && (surfaceTexture = mSurfaceTexture) == null) {
try {
mLock.wait();
} catch (InterruptedException ie) {
throw new RuntimeException(ie); // not expected
}
}
if (mDone) {
break;
}
}
Log.d(TAG, "Got surfaceTexture=" + surfaceTexture);
// Create an EGL surface for our new SurfaceTexture. We're not on the same
// thread as the SurfaceTexture, which is a concern for the *consumer*, which
// wants to call updateTexImage(). Because we're the *producer*, i.e. the
// one generating the frames, we don't need to worry about being on the same
// thread.
mEglCore = new EglCore(null, EglCore.FLAG_TRY_GLES3);
WindowSurface windowSurface = new WindowSurface(mEglCore, mSurfaceTexture);
windowSurface.makeCurrent();
// Render frames until we're told to stop or the SurfaceTexture is destroyed.
doAnimation(windowSurface);
windowSurface.release();
mEglCore.release();
if (!sReleaseInCallback) {
Log.i(TAG, "Releasing SurfaceTexture in renderer thread");
surfaceTexture.release();
}
}
Log.d(TAG, "Renderer thread exiting");
}
示例8: releaseSurfaceTexture
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture)
{
if (surfaceTexture == null)
{
Log.d(TAG, "releaseSurfaceTexture: null");
}
else if (mDidDetachFromWindow)
{
if (surfaceTexture != mSurfaceTexture)
{
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release different SurfaceTexture");
surfaceTexture.release();
}
else if (!mOwnSurfaceTexture)
{
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release detached SurfaceTexture");
surfaceTexture.release();
}
else
{
Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): already released by TextureView");
}
}
else if (mWillDetachFromWindow)
{
if (surfaceTexture != mSurfaceTexture)
{
Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): release different SurfaceTexture");
surfaceTexture.release();
}
else if (!mOwnSurfaceTexture)
{
Log.d(TAG,
"releaseSurfaceTexture: willDetachFromWindow(): re-attach SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
}
else
{
Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): will released by TextureView");
}
}
else
{
if (surfaceTexture != mSurfaceTexture)
{
Log.d(TAG, "releaseSurfaceTexture: alive: release different SurfaceTexture");
surfaceTexture.release();
}
else if (!mOwnSurfaceTexture)
{
Log.d(TAG, "releaseSurfaceTexture: alive: re-attach SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
}
else
{
Log.d(TAG, "releaseSurfaceTexture: alive: will released by TextureView");
}
}
}
示例9: releaseSurfaceTexture
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture) {
if (surfaceTexture == null) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: null");
} else if (this.mDidDetachFromWindow) {
if (surfaceTexture != this.mSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
"release different SurfaceTexture");
surfaceTexture.release();
} else if (this.mOwnSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
"already released by TextureView");
} else {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
"release detached SurfaceTexture");
surfaceTexture.release();
}
} else if (this.mWillDetachFromWindow) {
if (surfaceTexture != this.mSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
"release different SurfaceTexture");
surfaceTexture.release();
} else if (this.mOwnSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
"will released by TextureView");
} else {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
"re-attach SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
}
} else if (surfaceTexture != this.mSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: release different " +
"SurfaceTexture");
surfaceTexture.release();
} else if (this.mOwnSurfaceTexture) {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: will released by " +
"TextureView");
} else {
Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: re-attach " +
"SurfaceTexture to TextureView");
setOwnSurfaceTexture(true);
}
}
示例10: onSurfaceTextureDestroyed
import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
surface.release();
mSurface = null;
return true;
}