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

Commit 89d40321 authored by Zhijun He's avatar Zhijun He Committed by Android (Google) Code Review
Browse files

Merge "Camera2: implement high speed video APIs" into mnc-dev

parents 374f0f48 1fa8999c
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -190,11 +190,13 @@ public:
        return reply.readInt32();
        return reply.readInt32();
    }
    }


    virtual status_t endConfigure()
    virtual status_t endConfigure(bool isConstrainedHighSpeed)
    {
    {
        ALOGV("endConfigure");
        ALOGV("endConfigure");
        Parcel data, reply;
        Parcel data, reply;
        data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor());
        data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor());
        data.writeInt32(isConstrainedHighSpeed);

        remote()->transact(END_CONFIGURE, data, &reply);
        remote()->transact(END_CONFIGURE, data, &reply);
        reply.readExceptionCode();
        reply.readExceptionCode();
        return reply.readInt32();
        return reply.readInt32();
@@ -556,8 +558,9 @@ status_t BnCameraDeviceUser::onTransact(
        } break;
        } break;
        case END_CONFIGURE: {
        case END_CONFIGURE: {
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            CHECK_INTERFACE(ICameraDeviceUser, data, reply);
            bool isConstrainedHighSpeed = data.readInt32();
            reply->writeNoException();
            reply->writeNoException();
            reply->writeInt32(endConfigure());
            reply->writeInt32(endConfigure(isConstrainedHighSpeed));
            return NO_ERROR;
            return NO_ERROR;
        } break;
        } break;
        case PREPARE: {
        case PREPARE: {
+1 −1
Original line number Original line Diff line number Diff line
@@ -97,7 +97,7 @@ public:
     * must be called before any requests can be submitted.
     * must be called before any requests can be submitted.
     * <p>
     * <p>
     */
     */
    virtual status_t        endConfigure() = 0;
    virtual status_t        endConfigure(bool isConstrainedHighSpeed = false) = 0;


    virtual status_t        deleteStream(int streamId) = 0;
    virtual status_t        deleteStream(int streamId) = 0;


+23 −3
Original line number Original line Diff line number Diff line
@@ -269,14 +269,34 @@ status_t CameraDeviceClient::cancelRequest(int requestId, int64_t* lastFrameNumb


status_t CameraDeviceClient::beginConfigure() {
status_t CameraDeviceClient::beginConfigure() {
    // TODO: Implement this.
    // TODO: Implement this.
    ALOGE("%s: Not implemented yet.", __FUNCTION__);
    ALOGV("%s: Not implemented yet.", __FUNCTION__);
    return OK;
    return OK;
}
}


status_t CameraDeviceClient::endConfigure() {
status_t CameraDeviceClient::endConfigure(bool isConstrainedHighSpeed) {
    ALOGV("%s: ending configure (%d input stream, %zu output streams)",
    ALOGV("%s: ending configure (%d input stream, %zu output streams)",
            __FUNCTION__, mInputStream.configured ? 1 : 0, mStreamMap.size());
            __FUNCTION__, mInputStream.configured ? 1 : 0, mStreamMap.size());


    // Sanitize the high speed session against necessary capability bit.
    if (isConstrainedHighSpeed) {
        CameraMetadata staticInfo = mDevice->info();
        camera_metadata_entry_t entry = staticInfo.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
        bool isConstrainedHighSpeedSupported = false;
        for(size_t i = 0; i < entry.count; ++i) {
            uint8_t capability = entry.data.u8[i];
            if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO) {
                isConstrainedHighSpeedSupported = true;
                break;
            }
        }
        if (!isConstrainedHighSpeedSupported) {
            ALOGE("%s: Camera %d: Try to create a constrained high speed configuration on a device"
                    " that doesn't support it.",
                          __FUNCTION__, mCameraId);
            return INVALID_OPERATION;
        }
    }

    status_t res;
    status_t res;
    if ( (res = checkPid(__FUNCTION__) ) != OK) return res;
    if ( (res = checkPid(__FUNCTION__) ) != OK) return res;


@@ -284,7 +304,7 @@ status_t CameraDeviceClient::endConfigure() {


    if (!mDevice.get()) return DEAD_OBJECT;
    if (!mDevice.get()) return DEAD_OBJECT;


    return mDevice->configureStreams();
    return mDevice->configureStreams(isConstrainedHighSpeed);
}
}


status_t CameraDeviceClient::deleteStream(int streamId) {
status_t CameraDeviceClient::deleteStream(int streamId) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ public:


    virtual status_t beginConfigure();
    virtual status_t beginConfigure();


    virtual status_t endConfigure();
    virtual status_t endConfigure(bool isConstrainedHighSpeed = false);


    // Returns -EBUSY if device is not idle
    // Returns -EBUSY if device is not idle
    virtual status_t      deleteStream(int streamId);
    virtual status_t      deleteStream(int streamId);
+1 −1
Original line number Original line Diff line number Diff line
@@ -157,7 +157,7 @@ class CameraDeviceBase : public virtual RefBase {
     * - BAD_VALUE if the set of streams was invalid (e.g. fmts or sizes)
     * - BAD_VALUE if the set of streams was invalid (e.g. fmts or sizes)
     * - INVALID_OPERATION if the device was in the wrong state
     * - INVALID_OPERATION if the device was in the wrong state
     */
     */
    virtual status_t configureStreams() = 0;
    virtual status_t configureStreams(bool isConstrainedHighSpeed = false) = 0;


    // get the buffer producer of the input stream
    // get the buffer producer of the input stream
    virtual status_t getInputBufferProducer(
    virtual status_t getInputBufferProducer(
Loading