heifwriter/src/main/java/androidx/heifwriter/HeifEncoder.java
private void stopInternal() {
        if (DEBUG) Log.d(TAG, "stopInternal");

        // after start, mEncoder is only accessed on handler, so no need to sync
        if (mEncoder != null) {
            mEncoder.stop();
            mEncoder.release();
            mEncoder = null;
        }

        // unblock the addBuffer() if we're tearing down before EOS is sent.
        synchronized (mEmptyBuffers) {
            mInputEOS = true;
            mEmptyBuffers.notifyAll();
        }

        synchronized(this) {
            if (mRectBlt != null) {
                mRectBlt.release(false);
                mRectBlt = null;
            }

            if (mEncoderEglSurface != null) {
                // Note that this frees mEncoderSurface too. If mEncoderEglSurface is not
                // there, client is responsible to release the input surface it got from us,
                // we don't release mEncoderSurface here.
                mEncoderEglSurface.release();
                mEncoderEglSurface = null;
            }

            if (mInputTexture != null) {
                mInputTexture.release();
                mInputTexture = null;
            }
        }
    }
/**
     * Routine to release all resources. Must be run on the same looper that
     * handles the MediaCodec callbacks.
     */
Routine to release all resources. Must be run on the same looper that
handles the MediaCodec callbacks.
Routine to release all resources . Must be run on the same looper that handles the MediaCodec callbacks .
private void stopInternal() {
        if (DEBUG) Log.d(TAG, "stopInternal");
        if (mEncoder != null) {
            mEncoder.stop();
            mEncoder.release();
            mEncoder = null;
        }
        synchronized (mEmptyBuffers) {
            mInputEOS = true;
            mEmptyBuffers.notifyAll();
        }
        synchronized(this) {
            if (mRectBlt != null) {
                mRectBlt.release(false);
                mRectBlt = null;
            }
            if (mEncoderEglSurface != null) {
                mEncoderEglSurface.release();
                mEncoderEglSurface = null;
            }
            if (mInputTexture != null) {
                mInputTexture.release();
                mInputTexture = null;
            }
        }
    }
private void stopInternal ( ) { if ( DEBUG ) Log . d ( TAG , "stopInternal" ) ; if ( mEncoder != null ) { mEncoder . stop ( ) ; mEncoder . release ( ) ; mEncoder = null ; } synchronized ( mEmptyBuffers ) { mInputEOS = true ; mEmptyBuffers . notifyAll ( ) ; } synchronized ( this ) { if ( mRectBlt != null ) { mRectBlt . release ( false ) ; mRectBlt = null ; } if ( mEncoderEglSurface != null ) { mEncoderEglSurface . release ( ) ; mEncoderEglSurface = null ; } if ( mInputTexture != null ) { mInputTexture . release ( ) ; mInputTexture = null ; } } }
Routine to release all resources.
Routine to release all resources .
// after start, mEncoder is only accessed on handler, so no need to sync // unblock the addBuffer() if we're tearing down before EOS is sent. // Note that this frees mEncoderSurface too. If mEncoderEglSurface is not // there, client is responsible to release the input surface it got from us, // we don't release mEncoderSurface here.