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 Diff line number Diff line
@@ -228,11 +228,11 @@ bool CryptoHal::requiresSecureDecoderComponent(const char *mime) const {
void CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    native_handle_t* nativeHandle = native_handle_create(1, 0);
    if (!nativeHandle) {
        ALOGE("setHeapBase(), failed to create native handle");
        ALOGE("setSharedBufferBase(), failed to create native handle");
        return;
    }
    if (heap == NULL) {
        ALOGE("setHeapBase(): heap is NULL");
        ALOGE("setSharedBufferBase(): heap is NULL");
        return;
    }
    int fd = heap->getHeapID();
@@ -244,10 +244,6 @@ void CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    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) {
    ssize_t offset;
    size_t size;
@@ -261,8 +257,9 @@ status_t CryptoHal::toSharedBuffer(const sp<IMemory>& memory, ::SharedBuffer* bu
        return UNEXPECTED_NULL;
    }

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

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

struct BpCrypto : public BpInterface<ICrypto> {
@@ -179,23 +177,6 @@ struct BpCrypto : public BpInterface<ICrypto> {
        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:
    void readVector(Parcel &reply, Vector<uint8_t> &vector) const {
        uint32_t size = reply.readInt32();
@@ -423,24 +404,6 @@ status_t BnCrypto::onTransact(
            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:
            return BBinder::onTransact(code, data, reply, flags);
    }
+0 −3
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ struct Crypto : public BnCrypto {
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            const DestinationBuffer &destination, AString *errorDetailMsg);

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

private:
    mutable Mutex mLock;

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

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

private:
    mutable Mutex mLock;

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

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

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

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

struct AString;
class IMemory;
class IMemoryHeap;

struct ICrypto : public IInterface {
    DECLARE_META_INTERFACE(Crypto);
@@ -65,13 +64,6 @@ struct ICrypto : public IInterface {
            const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
            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:
    DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
};
Loading