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

Commit bbf5959d authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Signal when all Hal requested buffers return

Depending on timing 'waitForBuffersReturned' can be
called before all Hal requested buffer are able to return.
To avoid potential timeout, check for any outstanding buffers
and signal accordingly before returning from 'returnStreamBuffers'.

Bug: 144308932
Test: adb shell /system/bin/VtsHalCameraProviderV2_4TargetTest
--hal_service_instance=android.hardware.camera.provider@2.4::ICameraProvider/internal/0

Change-Id: Idb3d8bd6fdbdfe0798c38a1b83c17f1a8379738e
parent 2b0be27c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1494,7 +1494,7 @@ Return<void> CameraHidlTest::DeviceCb::returnStreamBuffers(
        ADD_FAILURE();
    }

    std::lock_guard<std::mutex> l(mLock);
    std::unique_lock<std::mutex> l(mLock);
    for (const auto& buf : buffers) {
        bool found = false;
        for (size_t idx = 0; idx < mOutstandingBufferIds.size(); idx++) {
@@ -1514,6 +1514,10 @@ Return<void> CameraHidlTest::DeviceCb::returnStreamBuffers(
        ALOGE("%s: unknown buffer ID %" PRIu64, __FUNCTION__, buf.bufferId);
        ADD_FAILURE();
    }
    if (!hasOutstandingBuffersLocked()) {
        l.unlock();
        mFlushedCondition.notify_one();
    }
    return Void();
}