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

Commit 4a9ab2a3 authored by Dongwon Kang's avatar Dongwon Kang
Browse files

Revert "Throw IAE when crypto or descrambler is not given for secure codec"

This reverts commit aaa5e640.

Test: revert change
Bug: 62570231
Change-Id: Ic1d8b67616a3ac8f491e367d91b3a70d7d22ffa0
parent 17d79b7d
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1039,10 +1039,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) {
        array[i] = {mBuffers[portIndex][i].mData, mBuffers[portIndex][i].mBufferID};
    }
    if (portIndex == kPortIndexInput) {
        err = mBufferChannel->setInputBufferArray(array);
        if (err != OK) {
            return err;
        }
        mBufferChannel->setInputBufferArray(array);
    } else if (portIndex == kPortIndexOutput) {
        mBufferChannel->setOutputBufferArray(array);
    } else {
+1 −5
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ sp<MemoryDealer> ACodecBufferChannel::makeMemoryDealer(size_t heapSize) {
    return dealer;
}

status_t ACodecBufferChannel::setInputBufferArray(const std::vector<BufferAndId> &array) {
void ACodecBufferChannel::setInputBufferArray(const std::vector<BufferAndId> &array) {
    if (hasCryptoOrDescrambler()) {
        size_t totalSize = std::accumulate(
                array.begin(), array.end(), 0u,
@@ -311,15 +311,11 @@ status_t ACodecBufferChannel::setInputBufferArray(const std::vector<BufferAndId>
        if (hasCryptoOrDescrambler()) {
            sharedEncryptedBuffer = mDealer->allocate(elem.mBuffer->capacity());
        }
        if (elem.mBuffer->data() == NULL && sharedEncryptedBuffer == NULL) {
            return BAD_VALUE;
        }
        inputBuffers.emplace_back(elem.mBuffer, elem.mBufferId, sharedEncryptedBuffer);
    }
    std::atomic_store(
            &mInputBuffers,
            std::make_shared<const std::vector<const BufferInfo>>(inputBuffers));
    return OK;
}

void ACodecBufferChannel::setOutputBufferArray(const std::vector<BufferAndId> &array) {
+0 −3
Original line number Diff line number Diff line
@@ -734,9 +734,6 @@ status_t MediaCodec::configure(
            // XXX: save indication that it's crypto in some way...
            mAnalyticsItem->setInt32(kCodecCrypto, 1);
        }
    } else if (mFlags & kFlagIsSecure) {
        ALOGE("Crypto or descrambler should be given for secure codec");
        return BAD_VALUE;
    }

    // save msg for reset
+1 −2
Original line number Diff line number Diff line
@@ -87,9 +87,8 @@ public:
     *
     * @param array     Newly allocated buffers. Empty if buffers are
     *                  deallocated.
     * @return OK if no error.
     */
    status_t setInputBufferArray(const std::vector<BufferAndId> &array);
    void setInputBufferArray(const std::vector<BufferAndId> &array);
    /**
     * Set output buffer array.
     *