summaryrefslogtreecommitdiffstats
path: root/include/camera
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-02-20 13:36:17 -0800
committerIgor Murashkin <iam@google.com>2013-02-22 10:50:15 -0800
commit4bc4a3845e456fd464556d79d20650a107e873e5 (patch)
treef077296572f972d21a7a54c2334fb6a6fd36308e /include/camera
parenta140a6efea1db7837984b3578755cfa4eaa8d92d (diff)
downloadframeworks_av-4bc4a3845e456fd464556d79d20650a107e873e5.zip
frameworks_av-4bc4a3845e456fd464556d79d20650a107e873e5.tar.gz
frameworks_av-4bc4a3845e456fd464556d79d20650a107e873e5.tar.bz2
ProCamera: Fix waitForFrameBuffer not handling multiple outstanding frames
If the CpuConsumer triggered multiple onFrameAvailable callbacks in between a single waitForFrameBuffer call, the old code would only handle 1 callback. This meant on two subsequent waitForFrameBuffer calls the second would always timeout when two buffers were already available to be unlocked. Bug: 8238112 Change-Id: Ibefca35005ac5c408e5ada97ec4a4344a9e3e497
Diffstat (limited to 'include/camera')
-rw-r--r--include/camera/ProCamera.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/camera/ProCamera.h b/include/camera/ProCamera.h
index f813c1c..cd2772c 100644
--- a/include/camera/ProCamera.h
+++ b/include/camera/ProCamera.h
@@ -196,9 +196,12 @@ public:
// Blocks until a frame is available (CPU streams only)
// - Obtain the frame data by calling CpuConsumer::lockNextBuffer
// - Release the frame data after use with CpuConsumer::unlockBuffer
+ // Return value:
+ // - >0 - number of frames available to be locked
+ // - <0 - error (refer to error codes)
// Error codes:
// -ETIMEDOUT if it took too long to get a frame
- status_t waitForFrameBuffer(int streamId);
+ int waitForFrameBuffer(int streamId);
// Blocks until a metadata result is available
// - Obtain the metadata by calling consumeFrameMetadata()
@@ -211,6 +214,14 @@ public:
// - Use waitForFrameMetadata to sync until new data is available.
CameraMetadata consumeFrameMetadata();
+ // Convenience method to drop frame buffers (CPU streams only)
+ // Return values:
+ // >=0 - number of frames dropped (up to count)
+ // <0 - error code
+ // Error codes:
+ // BAD_VALUE - invalid streamId or count passed
+ int dropFrameBuffer(int streamId, int count);
+
sp<IProCameraUser> remote();
protected:
@@ -286,7 +297,7 @@ private:
StreamInfo(int streamId) {
this->streamID = streamId;
cpuStream = false;
- frameReady = false;
+ frameReady = 0;
}
StreamInfo() {
@@ -299,7 +310,7 @@ private:
sp<CpuConsumer> cpuConsumer;
sp<ProFrameListener> frameAvailableListener;
sp<Surface> stc;
- bool frameReady;
+ int frameReady;
};
Condition mWaitCondition;