Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac57da3c authored by Lajos Molnar's avatar Lajos Molnar Committed by Android Git Automerger
Browse files

am f4bab345: am a3608e7a: am 4e43a27a: Merge "MediaCodec: revalidate cached...

am f4bab345: am a3608e7a: am 4e43a27a: Merge "MediaCodec: revalidate cached queued input buffers if queue fails (2)" into lmp-dev

* commit 'f4bab345a5ee71031e2d4623705f7cbdc8067edb':
  MediaCodec: revalidate cached queued input buffers if queue fails (2)
parents 644c645a 1f146f40
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -830,8 +830,8 @@ final public class MediaCodec {
        try {
            native_queueInputBuffer(
                    index, offset, size, presentationTimeUs, flags);
        } catch (CryptoException e) {
            validateInputByteBuffer(mCachedInputBuffers, index);
        } catch (CryptoException | IllegalStateException e) {
            revalidateByteBuffer(mCachedInputBuffers, index);
            throw e;
        }
    }
@@ -955,8 +955,8 @@ final public class MediaCodec {
        try {
            native_queueSecureInputBuffer(
                    index, offset, info, presentationTimeUs, flags);
        } catch (CryptoException e) {
            validateInputByteBuffer(mCachedInputBuffers, index);
        } catch (CryptoException | IllegalStateException e) {
            revalidateByteBuffer(mCachedInputBuffers, index);
            throw e;
        }
    }
@@ -1280,6 +1280,18 @@ final public class MediaCodec {
        }
    }

    private final void revalidateByteBuffer(
            ByteBuffer[] buffers, int index) {
        synchronized(mBufferLock) {
            if (buffers != null && index >= 0 && index < buffers.length) {
                ByteBuffer buffer = buffers[index];
                if (buffer != null) {
                    buffer.setAccessible(true);
                }
            }
        }
    }

    private final void validateOutputByteBuffer(
            ByteBuffer[] buffers, int index, BufferInfo info) {
        if (buffers != null && index >= 0 && index < buffers.length) {