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

Commit d9f1f950 authored by Jeff Tinker's avatar Jeff Tinker
Browse files

Fix protected content playback

bug: 26532678
Change-Id: I402a4b3aef126a0f6b35c1d68d3def12be3789b3
parent 954225da
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line 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
    // We allow the simpler queueInputBuffer API to be used even in
    // secure mode, by fabricating a single unencrypted subSample.
    // secure mode, by fabricating a single unencrypted subSample.
    CryptoPlugin::SubSample ss;
    CryptoPlugin::SubSample ss;
    CryptoPlugin::Pattern pattern;


    if (msg->findSize("size", &size)) {
    if (msg->findSize("size", &size)) {
        if (mCrypto != NULL) {
        if (mCrypto != NULL) {
@@ -2398,6 +2399,8 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
            numSubSamples = 1;
            numSubSamples = 1;
            key = NULL;
            key = NULL;
            iv = NULL;
            iv = NULL;
            pattern.mEncryptBlocks = 0;
            pattern.mSkipBlocks = 0;
        }
        }
    } else {
    } else {
        if (mCrypto == NULL) {
        if (mCrypto == NULL) {
@@ -2408,6 +2411,8 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
        CHECK(msg->findSize("numSubSamples", &numSubSamples));
        CHECK(msg->findSize("numSubSamples", &numSubSamples));
        CHECK(msg->findPointer("key", (void **)&key));
        CHECK(msg->findPointer("key", (void **)&key));
        CHECK(msg->findPointer("iv", (void **)&iv));
        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;
        int32_t tmp;
        CHECK(msg->findInt32("mode", &tmp));
        CHECK(msg->findInt32("mode", &tmp));
@@ -2455,10 +2460,6 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
        AString *errorDetailMsg;
        AString *errorDetailMsg;
        CHECK(msg->findPointer("errorDetailMsg", (void **)&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(
        ssize_t result = mCrypto->decrypt(
                (mFlags & kFlagIsSecure) != 0,
                (mFlags & kFlagIsSecure) != 0,
                key,
                key,