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

Commit 7d70c5e5 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

CameraService: Replace deprecated native_window methods

Change-Id: I3be5a720ac8b488d1e507c606a9146480faeef63
parent f67e23ef
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -1088,25 +1088,33 @@ status_t Camera2Device::StreamAdapter::connectToDevice(
    }

    if (mFormat == HAL_PIXEL_FORMAT_BLOB) {
        res = native_window_set_buffers_geometry(mConsumerInterface.get(),
                mSize, 1, mFormat);
        res = native_window_set_buffers_dimensions(mConsumerInterface.get(),
                mSize, 1);
        if (res != OK) {
            ALOGE("%s: Unable to configure compressed stream buffer geometry"
            ALOGE("%s: Unable to configure compressed stream buffer dimensions"
                    " %d x %d, size %zu for stream %d",
                    __FUNCTION__, mWidth, mHeight, mSize, mId);
            return res;
        }
    } else {
        res = native_window_set_buffers_geometry(mConsumerInterface.get(),
                mWidth, mHeight, mFormat);
        res = native_window_set_buffers_dimensions(mConsumerInterface.get(),
                mWidth, mHeight);
        if (res != OK) {
            ALOGE("%s: Unable to configure stream buffer geometry"
                    " %d x %d, format 0x%x for stream %d",
                    __FUNCTION__, mWidth, mHeight, mFormat, mId);
            ALOGE("%s: Unable to configure stream buffer dimensions"
                    " %d x %d for stream %d",
                    __FUNCTION__, mWidth, mHeight, mId);
            return res;
        }
    }

    res = native_window_set_buffers_format(mConsumerInterface.get(), mFormat);
    if (res != OK) {
        ALOGE("%s: Unable to configure stream buffer format"
                " %#x for stream %d",
                __FUNCTION__, mFormat, mId);
        return res;
    }

    int maxConsumerBuffers;
    res = mConsumerInterface->query(mConsumerInterface.get(),
            NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &maxConsumerBuffers);
+14 −9
Original line number Diff line number Diff line
@@ -289,20 +289,25 @@ status_t Camera3OutputStream::configureQueueLocked() {

    if (mMaxSize == 0) {
        // For buffers of known size
        res = native_window_set_buffers_geometry(mConsumer.get(),
                camera3_stream::width, camera3_stream::height,
                camera3_stream::format);
        res = native_window_set_buffers_dimensions(mConsumer.get(),
                camera3_stream::width, camera3_stream::height);
    } else {
        // For buffers with bounded size
        res = native_window_set_buffers_geometry(mConsumer.get(),
                mMaxSize, 1,
                camera3_stream::format);
        res = native_window_set_buffers_dimensions(mConsumer.get(),
                mMaxSize, 1);
    }
    if (res != OK) {
        ALOGE("%s: Unable to configure stream buffer geometry"
                " %d x %d, format %x for stream %d",
        ALOGE("%s: Unable to configure stream buffer dimensions"
                " %d x %d (maxSize %zu) for stream %d",
                __FUNCTION__, camera3_stream::width, camera3_stream::height,
                camera3_stream::format, mId);
                mMaxSize, mId);
        return res;
    }
    res = native_window_set_buffers_format(mConsumer.get(),
            camera3_stream::format);
    if (res != OK) {
        ALOGE("%s: Unable to configure stream buffer format %#x for stream %d",
                __FUNCTION__, camera3_stream::format, mId);
        return res;
    }