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

Commit b63a28ff authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use libhidl function to convert to hidl IMemory."

parents fa7b99dd 6536606c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ cc_library_shared {
        "libstagefright_foundation",
        "libutils",
        "android.hardware.drm@1.0",
        "libhidlallocatorutils",
        "libhidlbase",
        "libhidlmemory",
        "libhidltransport",
    ],

+6 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/MediaErrors.h>
#include <hidlmemory/FrameworkUtils.h>

using ::android::hardware::drm::V1_0::BufferType;
using ::android::hardware::drm::V1_0::DestinationBuffer;
@@ -227,6 +228,9 @@ bool CryptoHal::requiresSecureDecoderComponent(const char *mime) const {
 * are sent by providing an offset into the heap and a buffer size.
 */
int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    using ::android::hardware::fromHeap;
    using ::android::hardware::HidlMemory;

    if (heap == NULL) {
        ALOGE("setHeapBase(): heap is NULL");
        return -1;
@@ -240,12 +244,9 @@ int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
    Mutex::Autolock autoLock(mLock);

    int32_t seqNum = mHeapSeqNum++;
    int fd = heap->getHeapID();
    nativeHandle->data[0] = fd;
    auto hidlHandle = hidl_handle(nativeHandle);
    auto hidlMemory = hidl_memory("ashmem", hidlHandle, heap->getSize());
    sp<HidlMemory> hidlMemory = fromHeap(heap);
    mHeapBases.add(seqNum, mNextBufferId);
    Return<void> hResult = mPlugin->setSharedBufferBase(hidlMemory, mNextBufferId++);
    Return<void> hResult = mPlugin->setSharedBufferBase(*hidlMemory, mNextBufferId++);
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");
    return seqNum;
}