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

Commit 56a687d9 authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

Merge "Use libhidl function to convert to hidl IMemory." am: b63a28ff am:...

Merge "Use libhidl function to convert to hidl IMemory." am: b63a28ff am: 86d60a6b am: d818b6f9
am: a3ad5bda

Change-Id: I0210db2cd6cf129d555439ee3eceba211eb05f54
parents a6c08e78 a3ad5bda
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,8 +34,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;
}