[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.
This commit is contained in:
trav90
2017-03-30 23:16:10 -05:00
committed by roytam1
parent 0e42c5d8c5
commit 2fe117fe1e
@@ -40,8 +40,6 @@
#include <utils/String8.h>
#include "nsTArray.h"
#include <limits>
static const uint32_t kMAX_ALLOCATION =
(SIZE_MAX < INT32_MAX ? SIZE_MAX : INT32_MAX) - 128;
@@ -728,30 +726,6 @@ static bool underMetaDataPath(const Vector<uint32_t> &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<time_t>::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;
}