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

Commit 0c67b62e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Enable CONFIGURE_FLAG_USE_CRYPTO_ASYNC for audio" into main am: e5d2d6f8 am: 8fd1236a

parents 293e9410 8fd1236a
Loading
Loading
Loading
Loading
+5 −14
Original line number Original line Diff line number Diff line
@@ -4921,8 +4921,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                if (flags & CONFIGURE_FLAG_USE_CRYPTO_ASYNC) {
                if (flags & CONFIGURE_FLAG_USE_CRYPTO_ASYNC) {
                    mFlags |= kFlagUseCryptoAsync;
                    mFlags |= kFlagUseCryptoAsync;
                    if ((mFlags & kFlagUseBlockModel)) {
                    if ((mFlags & kFlagUseBlockModel)) {
                        ALOGW("CrytoAsync not yet enabled for block model,\
                        ALOGW("CrytoAsync not yet enabled for block model, "
                                falling back to normal");
                                "falling back to normal");
                    }
                    }
                }
                }
            }
            }
@@ -4979,8 +4979,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {


            mDescrambler = static_cast<IDescrambler *>(descrambler);
            mDescrambler = static_cast<IDescrambler *>(descrambler);
            mBufferChannel->setDescrambler(mDescrambler);
            mBufferChannel->setDescrambler(mDescrambler);
            if ((mFlags & kFlagUseCryptoAsync) &&
            if ((mFlags & kFlagUseCryptoAsync) && mCrypto) {
                mCrypto  && (mDomain == DOMAIN_VIDEO)) {
                // set kFlagUseCryptoAsync but do-not use this for block model
                // set kFlagUseCryptoAsync but do-not use this for block model
                // this is to propagate the error in onCryptoError()
                // this is to propagate the error in onCryptoError()
                // TODO (b/274628160): Enable Use of CONFIG_FLAG_USE_CRYPTO_ASYNC
                // TODO (b/274628160): Enable Use of CONFIG_FLAG_USE_CRYPTO_ASYNC
@@ -6278,15 +6277,8 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
        cryptoInfo->setInt32("secure", mFlags & kFlagIsSecure);
        cryptoInfo->setInt32("secure", mFlags & kFlagIsSecure);
        sp<RefBase> obj;
        sp<RefBase> obj;
        if (msg->findObject("cryptoInfos", &obj)) {
        if (msg->findObject("cryptoInfos", &obj)) {
            sp<CryptoInfosWrapper> infos{(CryptoInfosWrapper*)obj.get()};
            // this object is a standalone object when created (no copy requied here)
            sp<CryptoInfosWrapper> asyncInfos{
            buffer->meta()->setObject("cryptoInfos", obj);
                    new CryptoInfosWrapper(std::vector<std::unique_ptr<CodecCryptoInfo>>())};
            for (std::unique_ptr<CodecCryptoInfo> &info : infos->value) {
                if (info) {
                    asyncInfos->value.emplace_back(new CryptoAsync::CryptoAsyncInfo(info));
                }
            }
            buffer->meta()->setObject("cryptoInfos", asyncInfos);
        } else {
        } else {
            size_t key_len = (key != nullptr)? 16 : 0;
            size_t key_len = (key != nullptr)? 16 : 0;
            size_t iv_len = (iv != nullptr)? 16 : 0;
            size_t iv_len = (iv != nullptr)? 16 : 0;
@@ -6425,7 +6417,6 @@ status_t MediaCodec::onQueueInputBuffer(const sp<AMessage> &msg) {
            }
            }
        }
        }
        if (mCryptoAsync) {
        if (mCryptoAsync) {
            // TODO b/316565675 - enable async path for audio
            // prepare a message and enqueue
            // prepare a message and enqueue
            sp<AMessage> cryptoInfo = new AMessage();
            sp<AMessage> cryptoInfo = new AMessage();
            buildCryptoInfoAMessage(cryptoInfo, CryptoAsync::kActionDecrypt);
            buildCryptoInfoAMessage(cryptoInfo, CryptoAsync::kActionDecrypt);