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

Commit 07358dfe authored by Wonsik Kim's avatar Wonsik Kim
Browse files

MediaCodec: don't cache buffers until requested

Bug: 189889230
Test: manual & presubmit
Change-Id: I4caca59d6854416cedb6758fe66aefaacb69beb7
parent aca9b26c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2282,10 +2282,6 @@ final public class MediaCodec {
     */
    public final void start() {
        native_start();
        synchronized(mBufferLock) {
            cacheBuffers(true /* input */);
            cacheBuffers(false /* input */);
        }
    }
    private native final void native_start();

@@ -3916,6 +3912,9 @@ final public class MediaCodec {
                        + "Please obtain MediaCodec.LinearBlock or HardwareBuffer "
                        + "objects and attach to QueueRequest objects.");
            }
            if (mCachedInputBuffers == null) {
                cacheBuffers(true /* input */);
            }
            if (mCachedInputBuffers == null) {
                throw new IllegalStateException();
            }
@@ -3954,6 +3953,9 @@ final public class MediaCodec {
                        + "is not compatible with CONFIGURE_FLAG_USE_BLOCK_MODEL. "
                        + "Please use getOutputFrame to get output frames.");
            }
            if (mCachedOutputBuffers == null) {
                cacheBuffers(false /* input */);
            }
            if (mCachedOutputBuffers == null) {
                throw new IllegalStateException();
            }