Bug 1008785 - Ensure the last video frame end time is correct on Android MP4 playback. r=kinetik
authorChris Pearce <cpearce@mozilla.com>
Mon, 12 May 2014 14:35:46 +1200
changeset 182541 81f84748793bfd022db5c583a58a680cf5877877
parent 182540 0276c57cffba7814152b8f0e65ddf4b8f744620d
child 182542 b6199c0049c1e260c381ea8bca53f3213b247a70
push id26764
push usercbook@mozilla.com
push dateMon, 12 May 2014 11:35:17 +0000
treeherdermozilla-central@a64ed5aba131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1008785
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1008785 - Ensure the last video frame end time is correct on Android MP4 playback. r=kinetik
content/media/plugins/MediaPluginReader.cpp
--- a/content/media/plugins/MediaPluginReader.cpp
+++ b/content/media/plugins/MediaPluginReader.cpp
@@ -139,19 +139,17 @@ bool MediaPluginReader::DecodeVideoFrame
     MPAPI::VideoFrame frame;
     if (!mPlugin->ReadVideo(mPlugin, &frame, mVideoSeekTimeUs, &bufferCallback)) {
       // We reached the end of the video stream. If we have a buffered
       // video frame, push it the video queue using the total duration
       // of the video as the end time.
       if (mLastVideoFrame) {
         int64_t durationUs;
         mPlugin->GetDuration(mPlugin, &durationUs);
-        if (durationUs < mLastVideoFrame->mTime) {
-          durationUs = 0;
-        }
+        durationUs = std::max<int64_t>(durationUs - mLastVideoFrame->mTime, 0);
         mVideoQueue.Push(VideoData::ShallowCopyUpdateDuration(mLastVideoFrame,
                                                               durationUs));
         mLastVideoFrame = nullptr;
       }
       return false;
     }
     mVideoSeekTimeUs = -1;