Loading media/codec2/hal/common/MultiAccessUnitHelper.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,7 @@ c2_status_t MultiAccessUnitHelper::error( std::list<std::unique_ptr<C2Work>> * const worklist) { if (worklist == nullptr) { LOG(ERROR) << "Provided null worklist for error()"; mFrameHolder.clear(); return C2_OK; } std::unique_lock<std::mutex> l(mLock); Loading Loading @@ -277,6 +278,7 @@ c2_status_t MultiAccessUnitHelper::scatter( LOG(ERROR) << "ERROR: Work has Large frame info but has no linear blocks."; return C2_CORRUPTED; } frameInfo.mInputC2Ref = inBuffers; const std::vector<C2ConstLinearBlock>& multiAU = inBuffers.front()->data().linearBlocks(); std::shared_ptr<const C2AccessUnitInfos::input> auInfo = Loading media/codec2/hal/common/include/codec2/common/MultiAccessUnitHelper.h +5 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,11 @@ protected: */ std::unique_ptr<C2Work> mLargeWork; /* * For holding a reference to the incoming buffer */ std::vector<std::shared_ptr<C2Buffer>> mInputC2Ref; MultiAccessUnitInfo(C2WorkOrdinalStruct ordinal):inOrdinal(ordinal) { } Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +13 −10 Original line number Diff line number Diff line Loading @@ -552,8 +552,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( } ssize_t result = -1; ssize_t codecDataOffset = 0; size_t inBufferOffset = 0; size_t srcOffset = offset; size_t outBufferSize = 0; uint32_t cryptoInfoIdx = 0; int32_t heapSeqNum = getHeapSeqNum(memory); Loading @@ -565,18 +564,20 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( for (int i = 0; i < bufferInfos->value.size(); i++) { if (bufferInfos->value[i].mSize > 0) { std::unique_ptr<CodecCryptoInfo> info = std::move(cryptoInfos->value[cryptoInfoIdx++]); src.offset = srcOffset; src.size = bufferInfos->value[i].mSize; result = mCrypto->decrypt( (uint8_t*)info->mKey, (uint8_t*)info->mIv, info->mMode, info->mPattern, src, inBufferOffset, 0, info->mSubSamples, info->mNumSubSamples, dst, errorDetailMsg); inBufferOffset += bufferInfos->value[i].mSize; srcOffset += bufferInfos->value[i].mSize; if (result < 0) { ALOGI("[%s] attachEncryptedBuffers: decrypt failed: result = %zd", mName, result); Loading @@ -599,7 +600,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( wView.setOffset(0); } std::shared_ptr<C2Buffer> c2Buffer{C2Buffer::CreateLinearBuffer( block->share(codecDataOffset, outBufferSize - codecDataOffset, C2Fence{}))}; block->share(0, outBufferSize, C2Fence{}))}; if (!buffer->copy(c2Buffer)) { ALOGI("[%s] attachEncryptedBuffers: buffer copy failed", mName); return -ENOSYS; Loading Loading @@ -980,8 +981,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( } // size of cryptoInfo and accessUnitInfo should be the same? ssize_t result = -1; ssize_t codecDataOffset = 0; size_t inBufferOffset = 0; size_t srcOffset = 0; size_t outBufferSize = 0; uint32_t cryptoInfoIdx = 0; { Loading @@ -994,6 +994,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( encryptedBuffer->getMappedBlock(&mappedBlock); hardware::drm::V1_0::SharedBuffer source; encryptedBuffer->fillSourceBuffer(&source); srcOffset = source.offset; for (int i = 0 ; i < bufferInfos->value.size(); i++) { if (bufferInfos->value[i].mSize > 0) { std::unique_ptr<CodecCryptoInfo> info = Loading @@ -1004,18 +1005,20 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( // no data so we only populate the bufferInfo result = 0; } else { source.offset = srcOffset; source.size = bufferInfos->value[i].mSize; result = mCrypto->decrypt( (uint8_t*)info->mKey, (uint8_t*)info->mIv, info->mMode, info->mPattern, source, inBufferOffset, buffer->offset(), info->mSubSamples, info->mNumSubSamples, destination, errorDetailMsg); inBufferOffset += bufferInfos->value[i].mSize; srcOffset += bufferInfos->value[i].mSize; if (result < 0) { ALOGI("[%s] decrypt failed: result=%zd", mName, result); return result; Loading @@ -1028,7 +1031,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( } } } buffer->setRange(codecDataOffset, outBufferSize - codecDataOffset); buffer->setRange(0, outBufferSize); } return queueInputBufferInternal(buffer, block, bufferSize); } Loading media/libstagefright/MediaCodec.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -3397,9 +3397,6 @@ status_t MediaCodec::queueEncryptedBuffer( if (bufferInfos == nullptr || bufferInfos->value.empty()) { return BAD_VALUE; } if (cryptoInfos == nullptr || cryptoInfos->value.empty()) { return BAD_VALUE; } status_t err = OK; sp<AMessage> msg = new AMessage(kWhatQueueInputBuffer, this); msg->setSize("index", index); Loading @@ -3407,8 +3404,12 @@ status_t MediaCodec::queueEncryptedBuffer( new WrapperObject<sp<hardware::HidlMemory>>{buffer}}; msg->setObject("memory", memory); msg->setSize("offset", offset); if (cryptoInfos != nullptr) { msg->setSize("ssize", size); msg->setObject("cryptoInfos", cryptoInfos); } else { msg->setSize("size", size); } msg->setObject("accessUnitInfo", bufferInfos); if (OK != (err = generateFlagsFromAccessUnitInfo(msg, bufferInfos))) { return err; Loading Loading
media/codec2/hal/common/MultiAccessUnitHelper.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,7 @@ c2_status_t MultiAccessUnitHelper::error( std::list<std::unique_ptr<C2Work>> * const worklist) { if (worklist == nullptr) { LOG(ERROR) << "Provided null worklist for error()"; mFrameHolder.clear(); return C2_OK; } std::unique_lock<std::mutex> l(mLock); Loading Loading @@ -277,6 +278,7 @@ c2_status_t MultiAccessUnitHelper::scatter( LOG(ERROR) << "ERROR: Work has Large frame info but has no linear blocks."; return C2_CORRUPTED; } frameInfo.mInputC2Ref = inBuffers; const std::vector<C2ConstLinearBlock>& multiAU = inBuffers.front()->data().linearBlocks(); std::shared_ptr<const C2AccessUnitInfos::input> auInfo = Loading
media/codec2/hal/common/include/codec2/common/MultiAccessUnitHelper.h +5 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,11 @@ protected: */ std::unique_ptr<C2Work> mLargeWork; /* * For holding a reference to the incoming buffer */ std::vector<std::shared_ptr<C2Buffer>> mInputC2Ref; MultiAccessUnitInfo(C2WorkOrdinalStruct ordinal):inOrdinal(ordinal) { } Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +13 −10 Original line number Diff line number Diff line Loading @@ -552,8 +552,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( } ssize_t result = -1; ssize_t codecDataOffset = 0; size_t inBufferOffset = 0; size_t srcOffset = offset; size_t outBufferSize = 0; uint32_t cryptoInfoIdx = 0; int32_t heapSeqNum = getHeapSeqNum(memory); Loading @@ -565,18 +564,20 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( for (int i = 0; i < bufferInfos->value.size(); i++) { if (bufferInfos->value[i].mSize > 0) { std::unique_ptr<CodecCryptoInfo> info = std::move(cryptoInfos->value[cryptoInfoIdx++]); src.offset = srcOffset; src.size = bufferInfos->value[i].mSize; result = mCrypto->decrypt( (uint8_t*)info->mKey, (uint8_t*)info->mIv, info->mMode, info->mPattern, src, inBufferOffset, 0, info->mSubSamples, info->mNumSubSamples, dst, errorDetailMsg); inBufferOffset += bufferInfos->value[i].mSize; srcOffset += bufferInfos->value[i].mSize; if (result < 0) { ALOGI("[%s] attachEncryptedBuffers: decrypt failed: result = %zd", mName, result); Loading @@ -599,7 +600,7 @@ status_t CCodecBufferChannel::attachEncryptedBuffers( wView.setOffset(0); } std::shared_ptr<C2Buffer> c2Buffer{C2Buffer::CreateLinearBuffer( block->share(codecDataOffset, outBufferSize - codecDataOffset, C2Fence{}))}; block->share(0, outBufferSize, C2Fence{}))}; if (!buffer->copy(c2Buffer)) { ALOGI("[%s] attachEncryptedBuffers: buffer copy failed", mName); return -ENOSYS; Loading Loading @@ -980,8 +981,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( } // size of cryptoInfo and accessUnitInfo should be the same? ssize_t result = -1; ssize_t codecDataOffset = 0; size_t inBufferOffset = 0; size_t srcOffset = 0; size_t outBufferSize = 0; uint32_t cryptoInfoIdx = 0; { Loading @@ -994,6 +994,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( encryptedBuffer->getMappedBlock(&mappedBlock); hardware::drm::V1_0::SharedBuffer source; encryptedBuffer->fillSourceBuffer(&source); srcOffset = source.offset; for (int i = 0 ; i < bufferInfos->value.size(); i++) { if (bufferInfos->value[i].mSize > 0) { std::unique_ptr<CodecCryptoInfo> info = Loading @@ -1004,18 +1005,20 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( // no data so we only populate the bufferInfo result = 0; } else { source.offset = srcOffset; source.size = bufferInfos->value[i].mSize; result = mCrypto->decrypt( (uint8_t*)info->mKey, (uint8_t*)info->mIv, info->mMode, info->mPattern, source, inBufferOffset, buffer->offset(), info->mSubSamples, info->mNumSubSamples, destination, errorDetailMsg); inBufferOffset += bufferInfos->value[i].mSize; srcOffset += bufferInfos->value[i].mSize; if (result < 0) { ALOGI("[%s] decrypt failed: result=%zd", mName, result); return result; Loading @@ -1028,7 +1031,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffers( } } } buffer->setRange(codecDataOffset, outBufferSize - codecDataOffset); buffer->setRange(0, outBufferSize); } return queueInputBufferInternal(buffer, block, bufferSize); } Loading
media/libstagefright/MediaCodec.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -3397,9 +3397,6 @@ status_t MediaCodec::queueEncryptedBuffer( if (bufferInfos == nullptr || bufferInfos->value.empty()) { return BAD_VALUE; } if (cryptoInfos == nullptr || cryptoInfos->value.empty()) { return BAD_VALUE; } status_t err = OK; sp<AMessage> msg = new AMessage(kWhatQueueInputBuffer, this); msg->setSize("index", index); Loading @@ -3407,8 +3404,12 @@ status_t MediaCodec::queueEncryptedBuffer( new WrapperObject<sp<hardware::HidlMemory>>{buffer}}; msg->setObject("memory", memory); msg->setSize("offset", offset); if (cryptoInfos != nullptr) { msg->setSize("ssize", size); msg->setObject("cryptoInfos", cryptoInfos); } else { msg->setSize("size", size); } msg->setObject("accessUnitInfo", bufferInfos); if (OK != (err = generateFlagsFromAccessUnitInfo(msg, bufferInfos))) { return err; Loading