Bug 1142433: Properly scale duration found in movie extend header box. r=k17e
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 18 Mar 2015 14:10:57 +1100
changeset 234192 a7425df3572a0fb47ee4ee1a649cbbdfd7e72c12
parent 234191 2be7cfd01d8b6cac8a7b57f89a084ac2d36871dd
child 234193 864a62ab35004fc398b41a7cd13bdda942bccc1c
push id28436
push usercbook@mozilla.com
push dateWed, 18 Mar 2015 12:52:36 +0000
treeherdermozilla-central@41a61514461e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersk17e
bugs1142433
milestone39.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 1142433: Properly scale duration found in movie extend header box. r=k17e
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
@@ -1784,18 +1784,19 @@ status_t MPEG4Extractor::parseChunk(off6
                 uint32_t duration32;
                 if (mDataSource->readAt(
                             data_offset + 4, &duration32, sizeof(duration32))
                         < (ssize_t)sizeof(duration32)) {
                     return ERROR_IO;
                 }
                 duration = ntohl(duration32);
             }
-            if (duration) {
-              mFileMetaData->setInt64(kKeyMovieDuration, duration * 1000LL);
+            if (duration && mHeaderTimescale) {
+                mFileMetaData->setInt64(
+                        kKeyMovieDuration, (duration * 1000000) / mHeaderTimescale);
             }
 
             *offset += chunk_size;
             break;
         }
 
         case FOURCC('m', 'd', 'a', 't'):
         {