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

Commit 92705fb3 authored by Rachad Alao's avatar Rachad Alao Committed by Android (Google) Code Review
Browse files

Merge "Fix protected content playback"

parents b51b4a65 d9f1f950
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2388,6 +2388,7 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
    // We allow the simpler queueInputBuffer API to be used even in
    // secure mode, by fabricating a single unencrypted subSample.
    CryptoPlugin::SubSample ss;
    CryptoPlugin::Pattern pattern;

    if (msg->findSize("size", &size)) {
        if (mCrypto != NULL) {
@@ -2398,6 +2399,8 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
            numSubSamples = 1;
            key = NULL;
            iv = NULL;
            pattern.mEncryptBlocks = 0;
            pattern.mSkipBlocks = 0;
        }
    } else {
        if (mCrypto == NULL) {
@@ -2408,6 +2411,8 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
        CHECK(msg->findSize("numSubSamples", &numSubSamples));
        CHECK(msg->findPointer("key", (void **)&key));
        CHECK(msg->findPointer("iv", (void **)&iv));
        CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks));
        CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks));

        int32_t tmp;
        CHECK(msg->findInt32("mode", &tmp));
@@ -2455,10 +2460,6 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
        AString *errorDetailMsg;
        CHECK(msg->findPointer("errorDetailMsg", (void **)&errorDetailMsg));

        CryptoPlugin::Pattern pattern;
        CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks));
        CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks));

        ssize_t result = mCrypto->decrypt(
                (mFlags & kFlagIsSecure) != 0,
                key,