[libcamera-devel] [PATCH v2 8/9] android: camera_device: Remove single buffer restriction.

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jul 3 13:07:57 CEST 2020


Hi Laurent,

On 03/07/2020 01:41, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Thu, Jul 02, 2020 at 10:36:53PM +0100, Kieran Bingham wrote:
>> A capture request is no longer limited to a single output buffer.
>> Remove the limitation, but (for now) keep the check to ensure that
>> at least one buffer is always provided.
>>
>> This 'should never happen' so could be a LOG(Fatal) or removed.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>> ---
>>  src/android/camera_device.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
>> index eea8c8c50352..4681fd8af90b 100644
>> --- a/src/android/camera_device.cpp
>> +++ b/src/android/camera_device.cpp
>> @@ -1046,7 +1046,7 @@ static FrameBuffer *newFrameBuffer(const buffer_handle_t camera3buffer)
>>  
>>  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request)
>>  {
>> -	if (camera3Request->num_output_buffers != 1) {
>> +	if (camera3Request->num_output_buffers < 1) {
>>  		LOG(HAL, Error) << "Invalid number of output buffers: "
>>  				<< camera3Request->num_output_buffers;
> 
> As num_output_buffers is unsigned, it can only be 0 here. I'd write
> 
>  		LOG(HAL, Error) << "No output buffers provided";


Good point, would you also change the conditional to:

  if (!camera3Request->num_output_buffers) {

or
  if (camera3Request->num_output_buffers == 0) {

in that case?



> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
>>  		return -EINVAL;
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list