Bug 1128069 - [MSE] P4. Do not adjust duration to what data we may have been seen in the past. r=jwwang, a=lizzard
☠☠ backed out by e441403ef6a8 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 05 Aug 2016 16:03:01 +1000
changeset 340439 b6a0e932239c9fae2ac8913a18487b2e410d0661
parent 340438 54443c52eafe3847f0d3cf5539489a43dafd4152
child 340440 59249959e5918499c190bea0f9984bd32a617caa
push id6337
push userryanvm@gmail.com
push dateThu, 25 Aug 2016 03:33:50 +0000
treeherdermozilla-beta@901d8d3d4597 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, lizzard
bugs1128069
milestone49.0
Bug 1128069 - [MSE] P4. Do not adjust duration to what data we may have been seen in the past. r=jwwang, a=lizzard With MediaSource, the duration is always known and exact. It is entirely possible that we have played data at some point, then removed that data and adjusted the duration. MozReview-Commit-ID: HZe2yXtQfIL
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1118,17 +1118,22 @@ void MediaDecoderStateMachine::Recompute
   } else if (mEstimatedDuration.Ref().isSome()) {
     duration = mEstimatedDuration.Ref().ref();
   } else if (mInfo.mMetadataDuration.isSome()) {
     duration = mInfo.mMetadataDuration.ref();
   } else {
     return;
   }
 
-  if (duration < mObservedDuration.Ref()) {
+  // Only adjust the duration when an explicit duration isn't set (MSE).
+  // The duration is always exactly known with MSE and there's no need to adjust
+  // it based on what may have been seen in the past; in particular as this data
+  // may no longer exist such as when the mediasource duration was reduced.
+  if (mExplicitDuration.Ref().isNothing() &&
+      duration < mObservedDuration.Ref()) {
     duration = mObservedDuration;
   }
 
   MOZ_ASSERT(duration.ToMicroseconds() >= 0);
   mDuration = Some(duration);
 }
 
 void