summaryrefslogtreecommitdiffstats
path: root/camera/ProCamera.cpp
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-02-28 11:21:00 -0800
committerIgor Murashkin <iam@google.com>2013-02-28 16:25:55 -0800
commitba5ca4ee770fa0fe9e14990fd13b23f1010f5c98 (patch)
tree435f4462759de475b36d98f9f893fbfb8a8b7e41 /camera/ProCamera.cpp
parentbfc9915f482520eb9676c6d2dbf7f1ac078d937d (diff)
downloadframeworks_av-ba5ca4ee770fa0fe9e14990fd13b23f1010f5c98.zip
frameworks_av-ba5ca4ee770fa0fe9e14990fd13b23f1010f5c98.tar.gz
frameworks_av-ba5ca4ee770fa0fe9e14990fd13b23f1010f5c98.tar.bz2
ProCamera: Add CpuConsumer asynchronous mode support
Bug: 8290146 Bug: 8291751 Change-Id: I25423a2b8a70ac7169911b1c7b482aa17190fe0f
Diffstat (limited to 'camera/ProCamera.cpp')
-rw-r--r--camera/ProCamera.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/camera/ProCamera.cpp b/camera/ProCamera.cpp
index 13ba07c..3cfabf6 100644
--- a/camera/ProCamera.cpp
+++ b/camera/ProCamera.cpp
@@ -241,6 +241,17 @@ status_t ProCamera::createStreamCpu(int width, int height, int format,
int heapCount,
/*out*/
sp<CpuConsumer>* cpuConsumer,
+ int* streamId) {
+ return createStreamCpu(width, height, format, heapCount,
+ /*synchronousMode*/true,
+ cpuConsumer, streamId);
+}
+
+status_t ProCamera::createStreamCpu(int width, int height, int format,
+ int heapCount,
+ bool synchronousMode,
+ /*out*/
+ sp<CpuConsumer>* cpuConsumer,
int* streamId)
{
ALOGV("%s: createStreamW %dx%d (fmt=0x%x)", __FUNCTION__, width, height,
@@ -251,7 +262,7 @@ status_t ProCamera::createStreamCpu(int width, int height, int format,
sp <IProCameraUser> c = mCamera;
if (c == 0) return NO_INIT;
- sp<CpuConsumer> cc = new CpuConsumer(heapCount);
+ sp<CpuConsumer> cc = new CpuConsumer(heapCount, synchronousMode);
cc->setName(String8("ProCamera::mCpuConsumer"));
sp<Surface> stc = new Surface(
@@ -272,6 +283,7 @@ status_t ProCamera::createStreamCpu(int width, int height, int format,
getStreamInfo(*streamId).cpuStream = true;
getStreamInfo(*streamId).cpuConsumer = cc;
+ getStreamInfo(*streamId).synchronousMode = synchronousMode;
getStreamInfo(*streamId).stc = stc;
// for lifetime management
getStreamInfo(*streamId).frameAvailableListener = frameAvailableListener;
@@ -373,6 +385,13 @@ int ProCamera::dropFrameBuffer(int streamId, int count) {
return BAD_VALUE;
}
+ if (!si.synchronousMode) {
+ ALOGW("%s: No need to drop frames on asynchronous streams,"
+ " as asynchronous mode only keeps 1 latest frame around.",
+ __FUNCTION__);
+ return BAD_VALUE;
+ }
+
int numDropped = 0;
for (int i = 0; i < count; ++i) {
CpuConsumer::LockedBuffer buffer;