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

Commit 557c88c6 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

CCodec: bypass crypto / descrambler if input is empty

Bug: 150188155
Test: atest GtsExoPlayerTestCases
Change-Id: I5bd565dcfcfe539a3dec4e8f0a5b10a0ee0d815b
parent 9c4bc394
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -604,7 +604,12 @@ status_t CCodecBufferChannel::queueSecureInputBuffer(

    ssize_t result = -1;
    ssize_t codecDataOffset = 0;
    if (mCrypto != nullptr) {
    if (numSubSamples == 1
            && subSamples[0].mNumBytesOfClearData == 0
            && subSamples[0].mNumBytesOfEncryptedData == 0) {
        // We don't need to go through crypto or descrambler if the input is empty.
        result = 0;
    } else if (mCrypto != nullptr) {
        hardware::drm::V1_0::DestinationBuffer destination;
        if (secure) {
            destination.type = DrmBufferType::NATIVE_HANDLE;
@@ -620,6 +625,7 @@ status_t CCodecBufferChannel::queueSecureInputBuffer(
                key, iv, mode, pattern, source, buffer->offset(),
                subSamples, numSubSamples, destination, errorDetailMsg);
        if (result < 0) {
            ALOGI("[%s] decrypt failed: result=%zd", mName, result);
            return result;
        }
        if (destination.type == DrmBufferType::SHARED_MEMORY) {