@@ -87,8 +87,10 @@ int PostProcessorJpeg::process(const FrameBuffer *source,
const CameraMetadata &requestMetadata,
CameraMetadata *resultMetadata)
{
- if (!encoder_)
+ if (!encoder_) {
+ processComplete.emit(PostProcessor::Status::Failed);
return 0;
+ }
ASSERT(destination->numPlanes() == 1);
@@ -181,6 +183,7 @@ int PostProcessorJpeg::process(const FrameBuffer *source,
exif.data(), quality);
if (jpeg_size < 0) {
LOG(JPEG, Error) << "Failed to encode stream image";
+ processComplete.emit(PostProcessor::Status::Failed);
return jpeg_size;
}
@@ -195,5 +198,7 @@ int PostProcessorJpeg::process(const FrameBuffer *source,
/* Update the JPEG result Metadata. */
resultMetadata->addEntry(ANDROID_JPEG_SIZE, jpeg_size);
+ processComplete.emit(PostProcessor::Status::Success);
+
return 0;
}
@@ -7,6 +7,8 @@
#ifndef __ANDROID_POST_PROCESSOR_H__
#define __ANDROID_POST_PROCESSOR_H__
+#include <libcamera/base/signal.h>
+
#include <libcamera/framebuffer.h>
#include <libcamera/stream.h>
@@ -25,6 +27,12 @@ public:
CameraBuffer *destination,
const CameraMetadata &requestMetadata,
CameraMetadata *resultMetadata) = 0;
+
+ enum Status {
+ Success,
+ Failed,
+ };
+ libcamera::Signal<Status> processComplete;
};
#endif /* __ANDROID_POST_PROCESSOR_H__ */
@@ -60,6 +60,7 @@ int PostProcessorYuv::process(const FrameBuffer *source,
const MappedFrameBuffer sourceMapped(source, MappedFrameBuffer::MapFlag::Read);
if (!sourceMapped.isValid()) {
LOG(YUV, Error) << "Failed to mmap camera frame buffer";
+ processComplete.emit(PostProcessor::Status::Failed);
return -EINVAL;
}
@@ -77,9 +78,12 @@ int PostProcessorYuv::process(const FrameBuffer *source,
libyuv::FilterMode::kFilterBilinear);
if (ret) {
LOG(YUV, Error) << "Failed NV12 scaling: " << ret;
+ processComplete.emit(PostProcessor::Status::Failed);
return -EINVAL;
}
+ processComplete.emit(PostProcessor::Status::Success);
+
return 0;
}
We should be able to know if post-processing has been completed successfully or encountered some errors. This commit introduces a Signal<> which when connected, will notify that the post-processing has been completed. The status of PostProcessor::process() will be passed as a PostProcessor::Status argument. The signal will be required when the post-processor is meant to run asynchronously (in subsequent commits). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- src/android/jpeg/post_processor_jpeg.cpp | 7 ++++++- src/android/post_processor.h | 8 ++++++++ src/android/yuv/post_processor_yuv.cpp | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-)