Bug 1382557 - the duration should be finite when we can get one from the metadata. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Tue, 25 Jul 2017 14:34:59 +0800
changeset 422349 52ea7b299388407e5277060e78e945af081a37a8
parent 422348 54f3aaacf9e6064fff4e644d78d40ec9693e5355
child 422350 7462800fd68e207b2fbd2f6ceed92a896d04f4c4
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1382557
milestone56.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 1382557 - the duration should be finite when we can get one from the metadata. r=cpearce This fixes the case where ChannelMediaResource::OnStartRequest() calls mCallback->SetInfinite(true) to report an infinite duration, yet later we get another duratoin from the metadata. http://searchfox.org/mozilla-central/rev/8a61c71153a79cda2e1ae7d477564347c607cc5f/dom/media/MediaDecoder.cpp#1179-1185 Note IsInfinite() is checked before other duration sources. We need to call SetInfinite(false) on the MediaDecoder so we can get the correct duration. MozReview-Commit-ID: 3BlFNJzlgXo
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -758,16 +758,21 @@ MediaDecoder::MetadataLoaded(UniquePtr<M
   // Invalidate() will end up calling GetOwner()->UpdateMediaSize with the last
   // dimensions retrieved from the video frame container. The video frame
   // container contains more up to date dimensions than aInfo.
   // So we call Invalidate() after calling GetOwner()->MetadataLoaded to ensure
   // the media element has the latest dimensions.
   Invalidate();
 
   EnsureTelemetryReported();
+
+  // The duration is no longer infinite when we get one from the metadata.
+  if (mInfo->mMetadataDuration && IsInfinite()) {
+    SetInfinite(false);
+  }
 }
 
 void
 MediaDecoder::EnsureTelemetryReported()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mTelemetryReported || !mInfo) {