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

Commit 72d6d650 authored by Iliyan Malchev's avatar Iliyan Malchev Committed by Android (Google) Code Review
Browse files

Merge "CameraService: Decouple dequeue and lock"

parents 5a99645c ed9bbf27
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -558,15 +558,10 @@ private:
        ANativeWindow *a = anw(w);
        ANativeWindowBuffer* anb;
        rc = a->dequeueBuffer(a, &anb);
        if (!rc) {
            rc = a->lockBuffer(a, anb);
        if (!rc) {
            *buffer = &anb->handle;
            *stride = anb->stride;
        }
            else
                a->cancelBuffer(a, anb);
        }
        return rc;
    }

@@ -576,6 +571,14 @@ private:
        (type *) ((char *) __mptr - (char *)(&((type *)0)->member)); })
#endif

    static int __lock_buffer(struct preview_stream_ops* w,
                      buffer_handle_t* buffer)
    {
        ANativeWindow *a = anw(w);
        return a->lockBuffer(a,
                  container_of(buffer, ANativeWindowBuffer, handle));
    }

    static int __enqueue_buffer(struct preview_stream_ops* w,
                      buffer_handle_t* buffer)
    {
@@ -641,6 +644,7 @@ private:
    void initHalPreviewWindow()
    {
        mHalPreviewWindow.nw.cancel_buffer = __cancel_buffer;
        mHalPreviewWindow.nw.lock_buffer = __lock_buffer;
        mHalPreviewWindow.nw.dequeue_buffer = __dequeue_buffer;
        mHalPreviewWindow.nw.enqueue_buffer = __enqueue_buffer;
        mHalPreviewWindow.nw.set_buffer_count = __set_buffer_count;