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

Commit 2e264b11 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix propagating CryptoInfos during decryption error" into main

parents 4327262c b9fe9da0
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -649,7 +649,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers(
            return -ENOSYS;
            return -ENOSYS;
        }
        }
        // we are dealing with just one cryptoInfo or descrambler.
        // we are dealing with just one cryptoInfo or descrambler.
        std::unique_ptr<CodecCryptoInfo> info = std::move(cryptoInfos->value[0]);
        std::unique_ptr<CodecCryptoInfo> &info = cryptoInfos->value[0];
        if (info == nullptr) {
        if (info == nullptr) {
            ALOGE("Cannot decrypt, CryptoInfos are null.");
            ALOGE("Cannot decrypt, CryptoInfos are null.");
            return -ENOSYS;
            return -ENOSYS;
@@ -698,7 +698,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers(
            mDecryptDestination, mHeapSeqNum, &dst.nonsecureMemory);
            mDecryptDestination, mHeapSeqNum, &dst.nonsecureMemory);
    for (int i = 0; i < bufferInfos->value.size(); i++) {
    for (int i = 0; i < bufferInfos->value.size(); i++) {
        if (bufferInfos->value[i].mSize > 0) {
        if (bufferInfos->value[i].mSize > 0) {
            std::unique_ptr<CodecCryptoInfo> info = std::move(cryptoInfos->value[cryptoInfoIdx++]);
            std::unique_ptr<CodecCryptoInfo> &info = cryptoInfos->value[cryptoInfoIdx++];
            src.offset = srcOffset;
            src.offset = srcOffset;
            src.size = bufferInfos->value[i].mSize;
            src.size = bufferInfos->value[i].mSize;
            result = mCrypto->decrypt(
            result = mCrypto->decrypt(
+3 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,9 @@ status_t CryptoAsync::decryptAndQueue(sp<AMessage> & msg) {
    }
    }
    if (err != OK) {
    if (err != OK) {
        std::list<sp<AMessage>> errorList;
        std::list<sp<AMessage>> errorList;
        if (buffer->meta()->findObject("cryptoInfos", &obj)) {
            msg->setObject("cryptoInfos", obj);
        }
        msg->removeEntryByName("buffer");
        msg->removeEntryByName("buffer");
        msg->setInt32("err", err);
        msg->setInt32("err", err);
        msg->setInt32("actionCode", ACTION_CODE_FATAL);
        msg->setInt32("actionCode", ACTION_CODE_FATAL);
+5 −1
Original line number Original line Diff line number Diff line
@@ -6631,7 +6631,11 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
                    && (mFlags & kFlagUseCryptoAsync)) {
                    && (mFlags & kFlagUseCryptoAsync)) {
                // create error detail
                // create error detail
                sp<AMessage> cryptoErrorInfo = new AMessage();
                sp<AMessage> cryptoErrorInfo = new AMessage();
                if (msg->findObject("cryptoInfos", &obj)) {
                    cryptoErrorInfo->setObject("cryptoInfos", obj);
                } else {
                    buildCryptoInfoAMessage(cryptoErrorInfo, CryptoAsync::kActionDecrypt);
                    buildCryptoInfoAMessage(cryptoErrorInfo, CryptoAsync::kActionDecrypt);
                }
                cryptoErrorInfo->setInt32("err", err);
                cryptoErrorInfo->setInt32("err", err);
                cryptoErrorInfo->setInt32("actionCode", ACTION_CODE_FATAL);
                cryptoErrorInfo->setInt32("actionCode", ACTION_CODE_FATAL);
                cryptoErrorInfo->setString("errorDetail", errorDetailMsg);
                cryptoErrorInfo->setString("errorDetail", errorDetailMsg);