Bug 1128069 - [MSE] P5. Adjust currentTime to end position in MediaDecoder. r=jwwang, a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 08 Aug 2016 13:49:51 +1000
changeset 349890 5289599089085d1d7e8b8772f7616da483d8b002
parent 349889 1d21ee1349fc3faca03e2db4278728a50d496110
child 349891 406d8567f67f084a7580e09af60d7f0166b3b4d4
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] 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
@@ -1372,16 +1372,19 @@ void
 MediaDecoder::UpdateLogicalPositionInternal(MediaDecoderEventVisibility aEventVisibility)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (IsShutdown()) {
     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();