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
This commit is contained in:
Oliver Woodman
2017-03-29 18:06:46 +01:00
parent 1deac6a106
commit 5f5ec7b8d5

View File

@@ -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;
}
/**