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

Commit 08851323 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-a41f1f54-b764-45d4-b9ce-16ae3001be88-for-git_oc-mr1-release-43...

release-request-a41f1f54-b764-45d4-b9ce-16ae3001be88-for-git_oc-mr1-release-4362737 snap-temp-L87100000106492125

Change-Id: I8a08badd77c813141342916f6d7d3d2e6e2a8b73
parents 73f3a4a5 60b25e9b
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@ LOCAL_MODULE_TAGS := optional

LOCAL_MODULE:= stagefright

# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts

include $(BUILD_EXECUTABLE)

################################################################################
+56 −41
Original line number Diff line number Diff line
@@ -103,57 +103,72 @@ hardware::Return<uint32_t> CameraHardwareInterface::registerMemory(
}

hardware::Return<void> CameraHardwareInterface::unregisterMemory(uint32_t memId) {
    camera_memory_t* mem = nullptr;
    {
        std::lock_guard<std::mutex> lock(mHidlMemPoolMapLock);
        if (mHidlMemPoolMap.count(memId) == 0) {
            ALOGE("%s: memory pool ID %d not found", __FUNCTION__, memId);
            return hardware::Void();
        }
    camera_memory_t* mem = mHidlMemPoolMap.at(memId);
    sPutMemory(mem);
        mem = mHidlMemPoolMap.at(memId);
        mHidlMemPoolMap.erase(memId);
    }
    sPutMemory(mem);
    return hardware::Void();
}

hardware::Return<void> CameraHardwareInterface::dataCallback(
        DataCallbackMsg msgType, uint32_t data, uint32_t bufferIndex,
        const hardware::camera::device::V1_0::CameraFrameMetadata& metadata) {
    camera_memory_t* mem = nullptr;
    {
        std::lock_guard<std::mutex> lock(mHidlMemPoolMapLock);
        if (mHidlMemPoolMap.count(data) == 0) {
            ALOGE("%s: memory pool ID %d not found", __FUNCTION__, data);
            return hardware::Void();
        }
        mem = mHidlMemPoolMap.at(data);
    }
    camera_frame_metadata_t md;
    md.number_of_faces = metadata.faces.size();
    md.faces = (camera_face_t*) metadata.faces.data();
    sDataCb((int32_t) msgType, mHidlMemPoolMap.at(data), bufferIndex, &md, this);
    sDataCb((int32_t) msgType, mem, bufferIndex, &md, this);
    return hardware::Void();
}

hardware::Return<void> CameraHardwareInterface::dataCallbackTimestamp(
        DataCallbackMsg msgType, uint32_t data,
        uint32_t bufferIndex, int64_t timestamp) {
    camera_memory_t* mem = nullptr;
    {
        std::lock_guard<std::mutex> lock(mHidlMemPoolMapLock);
        if (mHidlMemPoolMap.count(data) == 0) {
            ALOGE("%s: memory pool ID %d not found", __FUNCTION__, data);
            return hardware::Void();
        }
    sDataCbTimestamp(timestamp, (int32_t) msgType, mHidlMemPoolMap.at(data), bufferIndex, this);
        mem = mHidlMemPoolMap.at(data);
    }
    sDataCbTimestamp(timestamp, (int32_t) msgType, mem, bufferIndex, this);
    return hardware::Void();
}

hardware::Return<void> CameraHardwareInterface::handleCallbackTimestamp(
        DataCallbackMsg msgType, const hidl_handle& frameData, uint32_t data,
        uint32_t bufferIndex, int64_t timestamp) {
    camera_memory_t* mem = nullptr;
    {
        std::lock_guard<std::mutex> lock(mHidlMemPoolMapLock);
        if (mHidlMemPoolMap.count(data) == 0) {
            ALOGE("%s: memory pool ID %d not found", __FUNCTION__, data);
            return hardware::Void();
        }
    sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(mHidlMemPoolMap.at(data)->handle));
        mem = mHidlMemPoolMap.at(data);
    }
    sp<CameraHeapMemory> heapMem(static_cast<CameraHeapMemory *>(mem->handle));
    VideoNativeHandleMetadata* md = (VideoNativeHandleMetadata*)
            mem->mBuffers[bufferIndex]->pointer();
            heapMem->mBuffers[bufferIndex]->pointer();
    md->pHandle = const_cast<native_handle_t*>(frameData.getNativeHandle());
    sDataCbTimestamp(timestamp, (int32_t) msgType, mHidlMemPoolMap.at(data), bufferIndex, this);
    sDataCbTimestamp(timestamp, (int32_t) msgType, mem, bufferIndex, this);
    return hardware::Void();
}

@@ -162,7 +177,7 @@ hardware::Return<void> CameraHardwareInterface::handleCallbackTimestampBatch(
        const hardware::hidl_vec<hardware::camera::device::V1_0::HandleTimestampMessage>& messages) {
    std::vector<android::HandleTimestampMessage> msgs;
    msgs.reserve(messages.size());

    {
        std::lock_guard<std::mutex> lock(mHidlMemPoolMapLock);
        for (const auto& hidl_msg : messages) {
            if (mHidlMemPoolMap.count(hidl_msg.data) == 0) {
@@ -183,7 +198,7 @@ hardware::Return<void> CameraHardwareInterface::handleCallbackTimestampBatch(

            msgs.push_back({hidl_msg.timestamp, mem->mBuffers[hidl_msg.bufferIndex]});
        }

    }
    mDataCbTimestampBatch((int32_t) msgType, msgs, mCbUser);
    return hardware::Void();
}