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

Commit c3c56ad8 authored by Dongwon Kang's avatar Dongwon Kang Committed by android-build-merger
Browse files

Merge "Revert "Throw IAE when crypto or descrambler is not given for secure codec"" into oc-dev

am: 27f6dfc4

Change-Id: Icb791eb1d7bcf9bdb3e0e4614c918a3e1c372a15
parents 95fb5344 27f6dfc4
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.
     *