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

Commit 93e29c08 authored by Jeff Tinker's avatar Jeff Tinker Committed by Android (Google) Code Review
Browse files

Merge "Revert "Fix decoder instantiation during playback""

parents 4313e1c8 de7268d8
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -228,11 +228,11 @@ bool CryptoHal::requiresSecureDecoderComponent(const char *mime) const {
void CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
void CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    native_handle_t* nativeHandle = native_handle_create(1, 0);
    native_handle_t* nativeHandle = native_handle_create(1, 0);
    if (!nativeHandle) {
    if (!nativeHandle) {
        ALOGE("setHeapBase(), failed to create native handle");
        ALOGE("setSharedBufferBase(), failed to create native handle");
        return;
        return;
    }
    }
    if (heap == NULL) {
    if (heap == NULL) {
        ALOGE("setHeapBase(): heap is NULL");
        ALOGE("setSharedBufferBase(): heap is NULL");
        return;
        return;
    }
    }
    int fd = heap->getHeapID();
    int fd = heap->getHeapID();
@@ -244,10 +244,6 @@ void CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");
}
}


void CryptoHal::clearHeapBase(const sp<IMemoryHeap>& heap) {
    mHeapBases.removeItem(heap->getBase());
}

status_t CryptoHal::toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* buffer) {
status_t CryptoHal::toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* buffer) {
    ssize_t offset;
    ssize_t offset;
    size_t size;
    size_t size;
@@ -261,8 +257,9 @@ status_t CryptoHal::toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* bu
        return UNEXPECTED_NULL;
        return UNEXPECTED_NULL;
    }
    }


    // memory must be in the declared heap
    if (mHeapBases.indexOfKey(heap->getBase()) < 0) {
    CHECK(mHeapBases.indexOfKey(heap->getBase()) >= 0);
        setHeapBase(heap);
    }


    buffer->bufferId = mHeapBases.valueFor(heap->getBase());
    buffer->bufferId = mHeapBases.valueFor(heap->getBase());
    buffer->offset = offset >= 0 ? offset : 0;
    buffer->offset = offset >= 0 ? offset : 0;
+0 −37
Original line number Original line Diff line number Diff line
@@ -36,8 +36,6 @@ enum {
    DECRYPT,
    DECRYPT,
    NOTIFY_RESOLUTION,
    NOTIFY_RESOLUTION,
    SET_MEDIADRM_SESSION,
    SET_MEDIADRM_SESSION,
    SET_HEAP,
    UNSET_HEAP,
};
};


struct BpCrypto : public BpInterface<ICrypto> {
struct BpCrypto : public BpInterface<ICrypto> {
@@ -179,23 +177,6 @@ struct BpCrypto : public BpInterface<ICrypto> {
        return reply.readInt32();
        return reply.readInt32();
    }
    }


    virtual void setHeap(const sp<IMemoryHeap> &heap) {
        Parcel data, reply;
        data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
        data.writeStrongBinder(IInterface::asBinder(heap));
        remote()->transact(SET_HEAP, data, &reply);
        return;
    }

    virtual void unsetHeap(const sp<IMemoryHeap>& heap) {
        Parcel data, reply;
        data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
        data.writeStrongBinder(IInterface::asBinder(heap));
        remote()->transact(UNSET_HEAP, data, &reply);
        return;
    }


private:
private:
    void readVector(Parcel &reply, Vector<uint8_t> &vector) const {
    void readVector(Parcel &reply, Vector<uint8_t> &vector) const {
        uint32_t size = reply.readInt32();
        uint32_t size = reply.readInt32();
@@ -423,24 +404,6 @@ status_t BnCrypto::onTransact(
            return OK;
            return OK;
        }
        }


        case SET_HEAP:
        {
            CHECK_INTERFACE(ICrypto, data, reply);
            sp<IMemoryHeap> heap =
                interface_cast<IMemoryHeap>(data.readStrongBinder());
            setHeap(heap);
            return OK;
        }

        case UNSET_HEAP:
        {
            CHECK_INTERFACE(ICrypto, data, reply);
            sp<IMemoryHeap> heap =
                interface_cast<IMemoryHeap>(data.readStrongBinder());
            unsetHeap(heap);
            return OK;
        }

        default:
        default:
            return BBinder::onTransact(code, data, reply, flags);
            return BBinder::onTransact(code, data, reply, flags);
    }
    }
+0 −3
Original line number Original line Diff line number Diff line
@@ -55,9 +55,6 @@ struct Crypto : public BnCrypto {
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            const DestinationBuffer &destination, AString *errorDetailMsg);
            const DestinationBuffer &destination, AString *errorDetailMsg);


    virtual void setHeap(const sp<IMemoryHeap>&) {}
    virtual void unsetHeap(const sp<IMemoryHeap>&) {}

private:
private:
    mutable Mutex mLock;
    mutable Mutex mLock;


+0 −4
Original line number Original line Diff line number Diff line
@@ -60,9 +60,6 @@ struct CryptoHal : public BnCrypto {
            const ICrypto::DestinationBuffer &destination,
            const ICrypto::DestinationBuffer &destination,
            AString *errorDetailMsg);
            AString *errorDetailMsg);


    virtual void setHeap(const sp<IMemoryHeap>& heap) { setHeapBase(heap); }
    virtual void unsetHeap(const sp<IMemoryHeap>& heap) { clearHeapBase(heap); }

private:
private:
    mutable Mutex mLock;
    mutable Mutex mLock;


@@ -85,7 +82,6 @@ private:
            const uint8_t uuid[16], const void *initData, size_t size);
            const uint8_t uuid[16], const void *initData, size_t size);


    void setHeapBase(const sp<IMemoryHeap>& heap);
    void setHeapBase(const sp<IMemoryHeap>& heap);
    void clearHeapBase(const sp<IMemoryHeap>& heap);


    status_t toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* buffer);
    status_t toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* buffer);


+0 −8
Original line number Original line Diff line number Diff line
@@ -27,7 +27,6 @@ namespace android {


struct AString;
struct AString;
class IMemory;
class IMemory;
class IMemoryHeap;


struct ICrypto : public IInterface {
struct ICrypto : public IInterface {
    DECLARE_META_INTERFACE(Crypto);
    DECLARE_META_INTERFACE(Crypto);
@@ -65,13 +64,6 @@ struct ICrypto : public IInterface {
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            const DestinationBuffer &destination, AString *errorDetailMsg) = 0;
            const DestinationBuffer &destination, AString *errorDetailMsg) = 0;


    /**
     * Declare the heap that the shared memory source buffers passed
     * to decrypt will be allocated from.
     */
    virtual void setHeap(const sp<IMemoryHeap>& heap) = 0;
    virtual void unsetHeap(const sp<IMemoryHeap>& heap) = 0;

private:
private:
    DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
    DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
};
};
Loading