Bug 1304254 - Use fragment_duration as track duration. r=rillian
authorAlfredo.Yang <ayang@mozilla.com>
Thu, 22 Sep 2016 19:30:11 +0800
changeset 316158 431dacf6e97764813f21caf71b94b9579572b79d
parent 316157 3b0e8c0d02fbb42c01f0372a531d343c4bda0d3c
child 316159 b65e4cc8e326a0cfaf51cafe7e99893bc2d6e929
push id30765
push userphilringnalda@gmail.com
push dateTue, 04 Oct 2016 03:06:46 +0000
treeherdermozilla-central@adb484f84dec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1304254
milestone52.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 1304254 - Use fragment_duration as track duration. r=rillian MozReview-Commit-ID: 6Y8kFiDmE1y
media/libstagefright/binding/MP4Metadata.cpp
--- a/media/libstagefright/binding/MP4Metadata.cpp
+++ b/media/libstagefright/binding/MP4Metadata.cpp
@@ -800,16 +800,25 @@ MP4MetadataRust::GetTrackInfo(mozilla::T
     }
     break;
     default:
       MOZ_LOG(sLog, LogLevel::Warning, ("unhandled track type %d", aType));
       return nullptr;
       break;
   }
 
+  // No duration in track, use fragment_duration.
+  if (e && !e->mDuration) {
+    mp4parse_fragment_info info;
+    auto rv = mp4parse_get_fragment_info(mRustParser.get(), &info);
+    if (rv == MP4PARSE_OK) {
+      e->mDuration = info.fragment_duration;
+    }
+  }
+
   if (e && e->IsValid()) {
     return e;
   }
   MOZ_LOG(sLog, LogLevel::Debug, ("TrackInfo didn't validate"));
 
   return nullptr;
 }