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

Commit ef157649 authored by Robert Shih's avatar Robert Shih Committed by android-build-merger
Browse files

Merge "MediaCodec.CryptoInfo: expose subsample encryption pattern" into pi-dev

am: e3348a25

Change-Id: I6eaaabc353304ee29aa677bf03d94384ddede51c
parents 82a188f0 e3348a25
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2545,6 +2545,10 @@ final public class MediaCodec {
            pattern = newPattern;
        }

        private void setPattern(int blocksToEncrypt, int blocksToSkip) {
            pattern = new Pattern(blocksToEncrypt, blocksToSkip);
        }

        @Override
        public String toString() {
            StringBuilder builder = new StringBuilder();
+14 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ struct fields_t {
    jfieldID context;

    jmethodID cryptoInfoSetID;
    jmethodID cryptoInfoSetPatternID;
};

static fields_t gFields;
@@ -654,6 +655,16 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
            ivObj,
            mode);

    int32_t encryptedByteBlock = 0, skipByteBlock = 0;
    meta->findInt32(kKeyEncryptedByteBlock, &encryptedByteBlock);
    meta->findInt32(kKeySkipByteBlock, &skipByteBlock);

    env->CallVoidMethod(
            cryptoInfoObj,
            gFields.cryptoInfoSetPatternID,
            encryptedByteBlock,
            skipByteBlock);

    return JNI_TRUE;
}

@@ -669,6 +680,9 @@ static void android_media_MediaExtractor_native_init(JNIEnv *env) {

    gFields.cryptoInfoSetID =
        env->GetMethodID(clazz, "set", "(I[I[I[B[BI)V");

    gFields.cryptoInfoSetPatternID =
        env->GetMethodID(clazz, "setPattern", "(II)V");
}

static void android_media_MediaExtractor_native_setup(