@Override public void close(FilterContext context) { if (mLogVerbose) Log.v(TAG, "SurfaceTextureSource closed"); mSourceListener.onSurfaceTextureSourceReady(null); mSurfaceTexture.release(); mSurfaceTexture = null; }
public void destroy() { stopPlayback(); mIsNewFrameArrival.set(false); if (mSurfaceTexture != null) { mSurfaceTexture.release(); mSurfaceTexture = null; } }
public void releaseSurfaceTexture() { synchronized (this) { mHasTexture = false; } mExtTexture.recycle(); mExtTexture = null; mSurfaceTexture.release(); mSurfaceTexture = null; }
public void release() { if (textureName > 0) { GLES20.glDeleteTextures(0, new int[] {textureName}, 0); textureName = -1; } if (surfaceTexture != null) { surfaceTexture.release(); surfaceTexture = null; } }
/** * Set the {@link SurfaceTexture} for this view to use. If a {@link SurfaceTexture} is already * being used by this view, it is immediately released and not be usable any more. The {@link * SurfaceTextureListener#onSurfaceTextureDestroyed} callback is <b>not</b> called for the * previous {@link SurfaceTexture}. Similarly, the {@link * SurfaceTextureListener#onSurfaceTextureAvailable} callback is <b>not</b> called for the {@link * SurfaceTexture} passed to setSurfaceTexture. * * <p>The {@link SurfaceTexture} object must be detached from all OpenGL ES contexts prior to * calling this method. * * @param surfaceTexture The {@link SurfaceTexture} that the view should use. * @see SurfaceTexture#detachFromGLContext() */ public void setSurfaceTexture(SurfaceTexture surfaceTexture) { if (surfaceTexture == null) { throw new NullPointerException("surfaceTexture must not be null"); } if (mSurface != null) { mSurface.release(); } mSurface = surfaceTexture; mUpdateSurface = true; invalidateParentIfNeeded(); }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public void release() { if (textureRender != null) { textureRender.release(); textureRender = null; } if (surfaceTexture != null) { surfaceTexture.release(); surfaceTexture = null; } }
/** * Notifies the renderer thread that the activity is pausing. * * <p>For best results, call this *after* disabling Camera preview. */ public void notifyPausing() { if (mSurfaceTexture != null) { Log.d(TAG, "renderer pausing -- releasing SurfaceTexture"); mSurfaceTexture.release(); mSurfaceTexture = null; } if (mFullScreen != null) { mFullScreen.release(false); // assume the GLSurfaceView EGL context is about mFullScreen = null; // to be destroyed } mIncomingWidth = mIncomingHeight = -1; }
/** * Notifies the renderer thread that the activity is pausing. * * <p>For best results, call this *after* disabling Camera preview. */ public void notifyPausing() { if (mSurfaceTexture != null) { Log.d(TAG, "renderer pausing -- releasing SurfaceTexture"); mSurfaceTexture.release(); mSurfaceTexture = null; } if (mFullScreen != null) { mFullScreen.release(); mFullScreen = null; } mIncomingWidth = mIncomingHeight = -1; }
public void initialize(int textureName) { if (mSurfaceTexture != null) { mSurfaceTexture.release(); mSurfaceTexture = null; } mSurfaceTexture = new SurfaceTexture(textureName); mSurfaceTexture.setOnFrameAvailableListener( new SurfaceTexture.OnFrameAvailableListener() { public void onFrameAvailable(SurfaceTexture surfaceTexture) { mIsNewFrameArrival.compareAndSet(false, true); } }); mSurface = new Surface(mSurfaceTexture); prepareVideo(); start(); }
private void teardownTorch() { setListenForScreenOff(false); dispatchStateChange(false); if (mCameraDevice != null) { mCameraDevice.close(); mCameraDevice = null; } mOpeningCamera = false; mSession = null; mFlashlightRequest = null; if (mSurface != null) { mSurface.release(); } mSurface = null; if (mSurfaceTexture != null) { mSurfaceTexture.release(); } mSurfaceTexture = null; mTorchCameraId = -1; }
public void onSurfaceTextureAvailable(SurfaceTexture surfacetexture, int j, int k) { d = new Surface(surfacetexture); surfacetexture = new MediaPlayer(); try { surfacetexture.setDataSource(getContext(), b); surfacetexture.setSurface(d); surfacetexture.setOnPreparedListener(this); surfacetexture.setOnInfoListener(new c(a)); surfacetexture.setOnBufferingUpdateListener(this); surfacetexture.setLooping(false); surfacetexture.prepareAsync(); e = surfacetexture; return; } catch (Exception exception) { surfacetexture.release(); Log.e( i, (new StringBuilder("Cannot prepare media player with SurfaceTexture: ")) .append(exception) .toString()); return; } }
private void destroySurface() { if (mLayer != null) { mSurface.detachFromGLContext(); // SurfaceTexture owns the texture name and detachFromGLContext // should have deleted it mLayer.clearStorage(); boolean shouldRelease = true; if (mListener != null) { shouldRelease = mListener.onSurfaceTextureDestroyed(mSurface); } synchronized (mNativeWindowLock) { nDestroyNativeWindow(); } mLayer.destroy(); if (shouldRelease) mSurface.release(); mSurface = null; mLayer = null; mHadSurface = true; } }