@@ -253,7 +253,7 @@ int CIO2Device::stop()
return ret;
}
-int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
+FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
{
FrameBuffer *buffer = rawBuffer;
@@ -261,7 +261,7 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
if (!buffer) {
if (availableBuffers_.empty()) {
LOG(IPU3, Error) << "CIO2 buffer underrun";
- return -EINVAL;
+ return nullptr;
}
buffer = availableBuffers_.front();
@@ -270,7 +270,11 @@ int CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
buffer->setRequest(request);
- return output_->queueBuffer(buffer);
+ int ret = output_->queueBuffer(buffer);
+ if (ret)
+ return nullptr;
+
+ return buffer;
}
void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
@@ -51,7 +51,7 @@ public:
CameraSensor *sensor() { return sensor_.get(); }
const CameraSensor *sensor() const { return sensor_.get(); }
- int queueBuffer(Request *request, FrameBuffer *rawBuffer);
+ FrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer);
void tryReturnBuffer(FrameBuffer *buffer);
Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
@@ -646,10 +646,10 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)
* Queue a buffer on the CIO2, using the raw stream buffer provided in
* the request, if any, or a CIO2 internal buffer otherwise.
*/
- FrameBuffer *rawBuffer = request->findBuffer(&data->rawStream_);
- error = data->cio2_.queueBuffer(request, rawBuffer);
- if (error)
- return error;
+ FrameBuffer *reqRawBuffer = request->findBuffer(&data->rawStream_);
+ FrameBuffer *rawBuffer = data->cio2_.queueBuffer(request, reqRawBuffer);
+ if (!rawBuffer)
+ return -ENOMEM;
/* Queue all buffers from the request aimed for the ImgU. */
for (auto it : request->buffers()) {