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

Commit be71a5e7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'preview_video_surface_share'

* changes:
  Camera: Do not crash if detachNextBuffer fails
  Camera: Allow different kinds of IMPLEMENTATION_DEFINED surfaces to share
parents 58207fea afa8a910
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -867,6 +867,7 @@ binder::Status CameraDeviceClient::createSurfaceFromGbp(
        ALOGE("%s: %s", __FUNCTION__, msg.string());
        return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
    }
    if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
        if (dataSpace != streamInfo.dataSpace) {
            String8 msg = String8::format("Camera %s:Surface dataSpace doesn't match: %d vs %d",
                    mCameraIdStr.string(), dataSpace, streamInfo.dataSpace);
@@ -874,17 +875,15 @@ binder::Status CameraDeviceClient::createSurfaceFromGbp(
            return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
        }
        //At the native side, there isn't a way to check whether 2 surfaces come from the same
    //surface class type. Use usage flag to approximate the comparison. Treat
    //different preview surface usage flags as the same.
    int32_t previewUsageMask =
            GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_HW_COMPOSER;
    if ((consumerUsage & ~previewUsageMask) != (streamInfo.consumerUsage & ~previewUsageMask)) {
        //surface class type. Use usage flag to approximate the comparison.
        if (consumerUsage != streamInfo.consumerUsage) {
            String8 msg = String8::format(
                    "Camera %s:Surface usage flag doesn't match 0x%x vs 0x%x",
                    mCameraIdStr.string(), consumerUsage, streamInfo.consumerUsage);
            ALOGE("%s: %s", __FUNCTION__, msg.string());
            return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
        }
    }
    return binder::Status::ok();
}

+3 −3
Original line number Diff line number Diff line
@@ -461,9 +461,9 @@ void Camera3StreamSplitter::onBufferReleasedByOutputLocked(
    } else if (res == NO_MEMORY) {
        SP_LOGV("%s: No free buffers", __FUNCTION__);
        return;
    } else {
        LOG_ALWAYS_FATAL_IF(res != NO_ERROR,
                "detaching buffer from output failed (%d)", res);
    } else if (res != OK) {
        SP_LOGE("%s: detaching buffer from output failed (%d)", __FUNCTION__, res);
        return;
    }

    BufferTracker& tracker = *(mBuffers[buffer->getId()]);