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

Commit 273c37d3 authored by Changyeon Jo's avatar Changyeon Jo
Browse files

Fix EVS frame handler for VTS



This change updates FrameHandler to handle and count delivered EVS
frames correctly.

Bug: 142275664
Test: VtsHalEvsV1_1TargetTest
Change-Id: I098bcf8155c9e4211ec0152b2a828520b6c22dc2
Signed-off-by: default avatarChangyeon Jo <changyeon@google.com>
parent 3e80b3b5
Loading
Loading
Loading
Loading
+50 −45
Original line number Diff line number Diff line
@@ -139,7 +139,12 @@ Return<void> FrameHandler::deliverFrame(const BufferDesc_1_0& bufferArg) {


Return<void> FrameHandler::deliverFrame_1_1(const hidl_vec<BufferDesc_1_1>& buffers) {
    for (auto&& buffer : buffers) {
    mLock.lock();
    // For VTS tests, FrameHandler uses a single frame among delivered frames.
    auto bufferIdx = mFramesDisplayed % buffers.size();
    auto buffer = buffers[bufferIdx];
    mLock.unlock();

    const AHardwareBuffer_Desc* pDesc =
        reinterpret_cast<const AHardwareBuffer_Desc *>(&buffer.buffer.description);
    ALOGD("Received a frame from the camera (%p)",
@@ -151,6 +156,7 @@ Return<void> FrameHandler::deliverFrame_1_1(const hidl_vec<BufferDesc_1_1>& buff

    // If we were given an opened display at construction time, then send the received
    // image back down the camera.
    bool displayed = false;
    if (mDisplay.get()) {
        // Get the output buffer we'll use to display the imagery
        BufferDesc_1_0 tgtBuffer = {};
@@ -180,15 +186,11 @@ Return<void> FrameHandler::deliverFrame_1_1(const hidl_vec<BufferDesc_1_1>& buff
            } else {
                // Everything looks good!
                // Keep track so tests or watch dogs can monitor progress
                    mLock.lock();
                    mFramesDisplayed++;
                    mLock.unlock();
                }
                displayed = true;
            }
        }
    }


    switch (mReturnMode) {
    case eAutoReturn:
        // Send the camera buffer back now that the client has seen it
@@ -198,10 +200,13 @@ Return<void> FrameHandler::deliverFrame_1_1(const hidl_vec<BufferDesc_1_1>& buff
    case eNoAutoReturn:
        // Hang onto the buffer handles for now -- the client will return it explicitly later
        mHeldBuffers.push(buffers);
        break;
    }

    mLock.lock();
    // increases counters
    ++mFramesReceived;
    mFramesDisplayed += (int)displayed;
    mLock.unlock();
    mFrameSignal.notify_all();