From 51b3174ac272f146f7a4fb502103d8130b6f4703 Mon Sep 17 00:00:00 2001 From: Surajit Podder Date: Thu, 25 Feb 2016 20:23:24 +0530 Subject: video: Use boot clock for recording start time Camera HAL3 uses boot time for buffer timestamp, rather than system monotonic time. This leads to issues as framework uses system monotonic time as reference start time for timestamp adjustment. Add change to use boot time for reference start time. CRs-Fixed: 946735 Change-Id: Id0af9c8aed1a983095275ac03f7f59abc31594cc --- media/libstagefright/MediaCodecSource.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'media/libstagefright/MediaCodecSource.cpp') diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp index adbde54..b15ee64 100644 --- a/media/libstagefright/MediaCodecSource.cpp +++ b/media/libstagefright/MediaCodecSource.cpp @@ -38,6 +38,7 @@ #include #include #include +#include namespace android { @@ -663,8 +664,15 @@ status_t MediaCodecSource::onStart(MetaData *params) { status_t err = OK; if (mFlags & FLAG_USE_SURFACE_INPUT) { + auto key = kKeyTimeBoot; + char value[PROPERTY_VALUE_MAX]; + if (property_get("media.camera.ts.monotonic", value, "0") && + atoi(value)) { + key = kKeyTime; + } + int64_t startTimeUs; - if (!params || !params->findInt64(kKeyTime, &startTimeUs)) { + if (!params || !params->findInt64(key, &startTimeUs)) { startTimeUs = -1ll; } resume(startTimeUs); -- cgit v1.1