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

Commit 5f5ec7b8 authored by Oliver Woodman's avatar Oliver Woodman
Browse files

Avoid unnecessary object allocation in CryptoInfo.set

This is causing a large number of unnecessary small object allocations
during encrypted playbacks, which presumably all need to be GC'd.

I wasn't sure whether the zero pattern should be static; that might
be objectionable in the platform (unsure?), since it would live
forever from the point of the class being classloaded. It doesn't
make much/any difference in practice in any case.

Test: Safe refactoring CL.
Change-Id: I9ee5fe284b0f854d672d83b97fc51116b0416f91
parent 1deac6a1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2441,6 +2441,8 @@ final public class MediaCodec {
            }
        };

        private final Pattern zeroPattern = new Pattern(0, 0);

        /**
         * The pattern applicable to the protected data in each subsample.
         */
@@ -2463,7 +2465,7 @@ final public class MediaCodec {
            key = newKey;
            iv = newIV;
            mode = newMode;
            pattern = new Pattern(0, 0);
            pattern = zeroPattern;
        }

        /**