Bug 1128069 - [MSE] P4. Do not adjust duration to what data we may have been seen in the past. r=jwwang, a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 05 Aug 2016 16:03:01 +1000
changeset 349889 1d21ee1349fc3faca03e2db4278728a50d496110
parent 349888 4db9c594a2a1346c47f78dd287d6e31200938c4f
child 349890 5289599089085d1d7e8b8772f7616da483d8b002
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, lizzard
bugs1128069
milestone50.0a2
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
@@ -1104,17 +1104,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