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

Commit 727d1721 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

CameraService: Add consumer name to output stream dumpsys

Also switch use of ANativeWindow to Surface, to get to the
getConsumerName() method where necessary.

Surface can always be cast to ANativeWindow, but not the other way
around, so it's a better option anyway.

Change-Id: Ie5c2d30821c1a754f9e382699ff50b4b328288b3
parent 9a17941f
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@ CameraDeviceClientFlashControl::~CameraDeviceClientFlashControl() {
        delete mMetadata;
    }

    mAnw.clear();
    mSurface.clear();
    mSurfaceTexture.clear();
    mProducer.clear();
    mConsumer.clear();
@@ -395,11 +395,11 @@ status_t CameraDeviceClientFlashControl::initializeSurface(
        return res;
    }

    mAnw = new Surface(mProducer, /*useAsync*/ true);
    if (mAnw == NULL) {
    mSurface = new Surface(mProducer, /*useAsync*/ true);
    if (mSurface == NULL) {
        return NO_MEMORY;
    }
    res = device->createStream(mAnw, width, height, format,
    res = device->createStream(mSurface, width, height, format,
            HAL_DATASPACE_UNKNOWN, CAMERA3_STREAM_ROTATION_0, &mStreamId);
    if (res) {
        return res;
@@ -653,7 +653,7 @@ CameraHardwareInterfaceFlashControl::CameraHardwareInterfaceFlashControl(
CameraHardwareInterfaceFlashControl::~CameraHardwareInterfaceFlashControl() {
    disconnectCameraDevice();

    mAnw.clear();
    mSurface.clear();
    mSurfaceTexture.clear();
    mProducer.clear();
    mConsumer.clear();
@@ -810,18 +810,18 @@ status_t CameraHardwareInterfaceFlashControl::initializePreviewWindow(
        return res;
    }

    mAnw = new Surface(mProducer, /*useAsync*/ true);
    if (mAnw == NULL) {
    mSurface = new Surface(mProducer, /*useAsync*/ true);
    if (mSurface == NULL) {
        return NO_MEMORY;
    }

    res = native_window_api_connect(mAnw.get(), NATIVE_WINDOW_API_CAMERA);
    res = native_window_api_connect(mSurface.get(), NATIVE_WINDOW_API_CAMERA);
    if (res) {
        ALOGE("%s: Unable to connect to native window", __FUNCTION__);
        return res;
    }

    return device->setPreviewWindow(mAnw);
    return device->setPreviewWindow(mSurface);
}

status_t CameraHardwareInterfaceFlashControl::connectCameraDevice(
@@ -870,7 +870,7 @@ status_t CameraHardwareInterfaceFlashControl::disconnectCameraDevice() {
            CameraParameters::FLASH_MODE_OFF);
    mDevice->setParameters(mParameters);
    mDevice->stopPreview();
    status_t res = native_window_api_disconnect(mAnw.get(),
    status_t res = native_window_api_disconnect(mSurface.get(),
            NATIVE_WINDOW_API_CAMERA);
    if (res) {
        ALOGW("%s: native_window_api_disconnect failed: %s (%d)",
+2 −2
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ class CameraDeviceClientFlashControl : public FlashControlBase {
        sp<IGraphicBufferProducer> mProducer;
        sp<IGraphicBufferConsumer>  mConsumer;
        sp<GLConsumer> mSurfaceTexture;
        sp<ANativeWindow> mAnw;
        sp<Surface> mSurface;
        int32_t mStreamId;

        Mutex mLock;
@@ -215,7 +215,7 @@ class CameraHardwareInterfaceFlashControl : public FlashControlBase {
        sp<IGraphicBufferProducer> mProducer;
        sp<IGraphicBufferConsumer>  mConsumer;
        sp<GLConsumer> mSurfaceTexture;
        sp<ANativeWindow> mAnw;
        sp<Surface> mSurface;

        Mutex mLock;
};
+3 −3
Original line number Diff line number Diff line
@@ -529,7 +529,7 @@ status_t Camera2Client::setPreviewTarget(
    if ( (res = checkPid(__FUNCTION__) ) != OK) return res;

    sp<IBinder> binder;
    sp<ANativeWindow> window;
    sp<Surface> window;
    if (bufferProducer != 0) {
        binder = IInterface::asBinder(bufferProducer);
        // Using controlledByApp flag to ensure that the buffer queue remains in
@@ -541,7 +541,7 @@ status_t Camera2Client::setPreviewTarget(
}

status_t Camera2Client::setPreviewWindowL(const sp<IBinder>& binder,
        sp<ANativeWindow> window) {
        sp<Surface> window) {
    ATRACE_CALL();
    status_t res;

@@ -666,7 +666,7 @@ status_t Camera2Client::setPreviewCallbackTarget(
    status_t res;
    if ( (res = checkPid(__FUNCTION__) ) != OK) return res;

    sp<ANativeWindow> window;
    sp<Surface> window;
    if (callbackProducer != 0) {
        window = new Surface(callbackProducer);
    }
+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ private:
    typedef camera2::Parameters Parameters;

    status_t setPreviewWindowL(const sp<IBinder>& binder,
            sp<ANativeWindow> window);
            sp<Surface> window);
    status_t startPreviewL(Parameters &params, bool restart);
    void     stopPreviewL();
    status_t startRecordingL(Parameters &params, bool restart);
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ void CallbackProcessor::onFrameAvailable(const BufferItem& /*item*/) {
}

status_t CallbackProcessor::setCallbackWindow(
        sp<ANativeWindow> callbackWindow) {
        sp<Surface> callbackWindow) {
    ATRACE_CALL();
    status_t res;

@@ -115,7 +115,7 @@ status_t CallbackProcessor::updateStream(const Parameters &params) {
        BufferQueue::createBufferQueue(&producer, &consumer);
        mCallbackConsumer = new CpuConsumer(consumer, kCallbackHeapCount);
        mCallbackConsumer->setFrameAvailableListener(this);
        mCallbackConsumer->setName(String8("Camera2Client::CallbackConsumer"));
        mCallbackConsumer->setName(String8("Camera2-CallbackConsumer"));
        mCallbackWindow = new Surface(producer);
    }

Loading