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

Commit e3348a25 authored by Robert Shih's avatar Robert Shih Committed by Android (Google) Code Review
Browse files

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

parents e81a27f4 97825a4f
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2545,6 +2545,10 @@ final public class MediaCodec {
            pattern = newPattern;
            pattern = newPattern;
        }
        }


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

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


    jmethodID cryptoInfoSetID;
    jmethodID cryptoInfoSetID;
    jmethodID cryptoInfoSetPatternID;
};
};


static fields_t gFields;
static fields_t gFields;
@@ -654,6 +655,16 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
            ivObj,
            ivObj,
            mode);
            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;
    return JNI_TRUE;
}
}


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


    gFields.cryptoInfoSetID =
    gFields.cryptoInfoSetID =
        env->GetMethodID(clazz, "set", "(I[I[I[B[BI)V");
        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(
static void android_media_MediaExtractor_native_setup(