Camera2: Move frame processing to its own thread.
To avoid blocking the HAL on possibly long-running binder calls,
move frame receiption and processing to its own thread.
Bug: 6243944
Change-Id: I6385be4410b2f68e2331755027afc10c342187cf
diff --git a/services/camera/libcameraservice/Camera2Device.h b/services/camera/libcameraservice/Camera2Device.h
index 06047b8..223d77a 100644
--- a/services/camera/libcameraservice/Camera2Device.h
+++ b/services/camera/libcameraservice/Camera2Device.h
@@ -129,19 +129,10 @@
status_t setNotifyCallback(NotificationListener *listener);
/**
- * Abstract class for HAL frame available notifications
+ * Wait for a new frame to be produced, with timeout in nanoseconds.
+ * Returns TIMED_OUT when no frame produced within the specified duration
*/
- class FrameListener {
- public:
- virtual void onNewFrameAvailable() = 0;
- protected:
- virtual ~FrameListener();
- };
-
- /**
- * Set a frame listener to be notified about new frames.
- */
- status_t setFrameListener(FrameListener *listener);
+ status_t waitForNextFrame(nsecs_t timeout);
/**
* Get next metadata frame from the frame queue. Returns NULL if the queue
@@ -206,7 +197,6 @@
status_t dequeue(camera_metadata_t **buf, bool incrementCount = true);
int getBufferCount();
status_t waitForBuffer(nsecs_t timeout);
- status_t setListener(FrameListener *listener);
// Set repeating buffer(s); if the queue is empty on a dequeue call, the
// queue copies the contents of the stream slot into the queue, and then
@@ -235,7 +225,6 @@
List<camera_metadata_t*> mStreamSlot;
bool mSignalConsumer;
- FrameListener *mListener;
static MetadataQueue* getInstance(
const camera2_frame_queue_dst_ops_t *q);