diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2019-10-27 02:01:08 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-10-30 02:37:37 +0200 |
commit | 53eab996809e826bc914e4c34c78fe74d86f8dc4 (patch) | |
tree | 26442c7a7115f4d42f82fbb0c6bc3c6c61e79b30 /src/android/camera_device.cpp | |
parent | 1f1d27cc14bb1ed7b74c541e523d8f77b0a98dbb (diff) |
android: Replace ThreadRPC with blocking method call
Use the newly introduced InvocationTypeBlocking message type to replace
the blocking message delivery implemented with the ThreadRPC class in the
Android camera HAL.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r-- | src/android/camera_device.cpp | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index c7c9b3fd..897f5458 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -11,7 +11,6 @@ #include "utils.h" #include "camera_metadata.h" -#include "thread_rpc.h" using namespace libcamera; @@ -64,25 +63,6 @@ CameraDevice::~CameraDevice() delete it.second; } -/* - * Handle RPC request received from the associated proxy. - */ -void CameraDevice::call(ThreadRpc *rpc) -{ - switch (rpc->tag) { - case ThreadRpc::ProcessCaptureRequest: - processCaptureRequest(rpc->request); - break; - case ThreadRpc::Close: - close(); - break; - default: - LOG(HAL, Error) << "Unknown RPC operation: " << rpc->tag; - } - - rpc->notifyReception(); -} - int CameraDevice::open() { int ret = camera_->acquire(); @@ -698,7 +678,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) return 0; } -int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request) +void CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request) { StreamConfiguration *streamConfiguration = &config_->at(0); Stream *stream = streamConfiguration->stream(); @@ -706,7 +686,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques if (camera3Request->num_output_buffers != 1) { LOG(HAL, Error) << "Invalid number of output buffers: " << camera3Request->num_output_buffers; - return -EINVAL; + return; } /* Start the camera if that's the first request we handle. */ @@ -714,14 +694,14 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques int ret = camera_->allocateBuffers(); if (ret) { LOG(HAL, Error) << "Failed to allocate buffers"; - return ret; + return; } ret = camera_->start(); if (ret) { LOG(HAL, Error) << "Failed to start camera"; camera_->freeBuffers(); - return ret; + return; } running_ = true; @@ -769,7 +749,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques if (!buffer) { LOG(HAL, Error) << "Failed to create buffer"; delete descriptor; - return -EINVAL; + return; } Request *request = @@ -782,13 +762,11 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques goto error; } - return 0; + return; error: delete request; delete descriptor; - - return ret; } void CameraDevice::requestComplete(Request *request, |