OSDN Git Service

Camera: don't dereference timestamp if it is missing
authorZhijun He <zhijunhe@google.com>
Tue, 15 Apr 2014 02:35:04 +0000 (19:35 -0700)
committerZhijun He <zhijunhe@google.com>
Tue, 15 Apr 2014 02:35:04 +0000 (19:35 -0700)
Bug: 14059542
Change-Id: I8b45a98ef4b296db314cab3819d11626ac7211be

services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp

index e5f5064..8268f65 100644 (file)
@@ -584,12 +584,15 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCaptureWait(
         entry = mNewFrame.find(ANDROID_SENSOR_TIMESTAMP);
         if (entry.count == 0) {
             ALOGE("No timestamp field in capture frame!");
-        }
-        if (entry.data.i64[0] != mCaptureTimestamp) {
-            ALOGW("Mismatched capture timestamps: Metadata frame %" PRId64 ","
-                    " captured buffer %" PRId64,
-                    entry.data.i64[0],
-                    mCaptureTimestamp);
+        } else if (entry.count == 1) {
+            if (entry.data.i64[0] != mCaptureTimestamp) {
+                ALOGW("Mismatched capture timestamps: Metadata frame %" PRId64 ","
+                        " captured buffer %" PRId64,
+                        entry.data.i64[0],
+                        mCaptureTimestamp);
+            }
+        } else {
+            ALOGE("Timestamp metadata is malformed!");
         }
         client->removeFrameListener(mCaptureId, mCaptureId + 1, this);