From 2fe117fe1ed2072b4540b3ddadb47d2d85147780 Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 30 Mar 2017 23:16:10 -0500 Subject: [PATCH] [mp4] Remove parsing of creation date We don't care about it for our use. Additionally, gmtime and strftime are not thread safe at all and are potential crash points. --- .../media/libstagefright/MPEG4Extractor.cpp | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp index 49222100d6..e55c63a8d2 100644 --- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp @@ -40,8 +40,6 @@ #include #include "nsTArray.h" -#include - static const uint32_t kMAX_ALLOCATION = (SIZE_MAX < INT32_MAX ? SIZE_MAX : INT32_MAX) - 128; @@ -728,30 +726,6 @@ static bool underMetaDataPath(const Vector &path) { && path[3] == FOURCC('i', 'l', 's', 't'); } -// Given a time in seconds since Jan 1 1904, produce a human-readable string. -static bool convertTimeToDate(int64_t time_1904, String8 *s) { - int64_t time_1970 = time_1904 - (((66 * 365 + 17) * 24) * 3600); - if (time_1970 < 0) { - return false; - } - if (time_1970 >= std::numeric_limits::max()) { - return false; - } - time_t time_checked = time_1970; - - struct tm* time_gm = gmtime(&time_checked); - if (!time_gm) { - return false; - } - char tmp[32]; - if (!strftime(tmp, sizeof(tmp), "%Y%m%dT%H%M%S.000Z", time_gm)) { - return false; - } - - s->setTo(tmp); - return true; -} - static bool ValidInputSize(int32_t size) { // Reject compressed samples larger than an uncompressed UHD // frame. This is a reasonable cut-off for a lossy codec, @@ -1822,11 +1796,6 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { mHeaderTimescale = U32_AT(&header[12]); } - String8 s; - if (convertTimeToDate(creationTime, &s)) { - mFileMetaData->setCString(kKeyDate, s.string()); - } - *offset += chunk_size; break; }