Bug 1156891: Disable use of stagefright::String8::clear. r=kentuckyfriedtakahe
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 29 Apr 2015 15:38:16 +1000
changeset 241516 d83ea2eed9d8d7b102df564b9cf78b1207ffdead
parent 241515 c99d19bfd6a0e674431b1c805f714f41a9226140
child 241517 34da940cd412cfad9b6db7be1027b2d7c753973b
push id59143
push userjyavenard@mozilla.com
push dateWed, 29 Apr 2015 05:39:01 +0000
treeherdermozilla-inbound@d83ea2eed9d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs1156891
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1156891: Disable use of stagefright::String8::clear. r=kentuckyfriedtakahe Some parts of stagefright::String8 aren't threadsafe as they make use of static shared objects.
media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
@@ -715,28 +715,28 @@ static bool underMetaDataPath(const Vect
     return path.size() >= 5
         && path[0] == FOURCC('m', 'o', 'o', 'v')
         && path[1] == FOURCC('u', 'd', 't', 'a')
         && path[2] == FOURCC('m', 'e', 't', 'a')
         && path[3] == FOURCC('i', 'l', 's', 't');
 }
 
 // Given a time in seconds since Jan 1 1904, produce a human-readable string.
-static void convertTimeToDate(int64_t time_1904, String8 *s) {
+static bool convertTimeToDate(int64_t time_1904, String8 *s) {
     time_t time_1970 = time_1904 - (((66 * 365 + 17) * 24) * 3600);
 
     if (time_1970 < 0) {
-        s->clear();
-        return;
+        return false;
     }
 
     char tmp[32];
     strftime(tmp, sizeof(tmp), "%Y%m%dT%H%M%S.000Z", gmtime(&time_1970));
 
     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,
   // combined with the current Firefox limit to 5k video.
   return (size > 0 && size <= 4 * (1920 * 1080) * 3 / 2);
 }
@@ -1751,18 +1751,17 @@ status_t MPEG4Extractor::parseChunk(off6
             } else if (header[0] != 0) {
                 return ERROR_MALFORMED;
             } else {
                 creationTime = U32_AT(&header[4]);
                 mHeaderTimescale = U32_AT(&header[12]);
             }
 
             String8 s;
-            convertTimeToDate(creationTime, &s);
-            if (s.length()) {
+            if (convertTimeToDate(creationTime, &s)) {
                 mFileMetaData->setCString(kKeyDate, s.string());
             }
 
             *offset += chunk_size;
             break;
         }
 
         case FOURCC('m', 'e', 'h', 'd'):