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 342513 3b547cfd26daf05198c74df56f8e1ff551aecd80
parent 342512 0e9efc640f7d4a31037bc4115d43148e23583851
child 342514 2b74ae0b004a7ae96e24087647e810937e15f205
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [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