Bug 1128069 - [MSE] P5. Adjust currentTime to end position in MediaDecoder. r=jwwang, a=lizzard
☠☠ backed out by e441403ef6a8 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 08 Aug 2016 13:49:51 +1000
changeset 342435 59249959e5918499c190bea0f9984bd32a617caa
parent 342434 b6a0e932239c9fae2ac8913a18487b2e410d0661
child 342436 3ab8087d6442cb205e1eafae625a842062a8ae73
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] P5. Adjust currentTime to end position in MediaDecoder. r=jwwang, a=lizzard The duration in the MediaDecoder is the canonical. It has as such a more up to date value than the mirror. Under some circumstances, the MDSM may have reached the end of media playback before the duration mirror had time to update. So perform the currentTime adjustment in the MediaDecoder instead. MozReview-Commit-ID: 1RFr4mT5LpA
dom/media/MediaDecoder.cpp
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -1326,16 +1326,19 @@ void
 MediaDecoder::UpdateLogicalPositionInternal(MediaDecoderEventVisibility aEventVisibility)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mShuttingDown) {
     return;
   }
 
   double currentPosition = static_cast<double>(CurrentPosition()) / static_cast<double>(USECS_PER_S);
+  if (mPlayState == PLAY_STATE_ENDED) {
+    currentPosition = std::max(currentPosition, mDuration);
+  }
   bool logicalPositionChanged = mLogicalPosition != currentPosition;
   mLogicalPosition = currentPosition;
 
   // Invalidate the frame so any video data is displayed.
   // Do this before the timeupdate event so that if that
   // event runs JavaScript that queries the media size, the
   // frame has reflowed and the size updated beforehand.
   Invalidate();