Bug 1008785 - Ensure the last video frame end time is correct on Android MP4 playback. r=kinetik, a=lsblakk
authorChris Pearce <cpearce@mozilla.com>
Mon, 12 May 2014 14:35:46 +1200
changeset 192279 e9cfd7705824
parent 192278 a713e6bd540d
child 192280 1c2c267a019f
push id3557
push userryanvm@gmail.com
push date2014-05-14 16:23 +0000
Treeherderresults
reviewerskinetik, lsblakk
bugs1008785
milestone30.0
Bug 1008785 - Ensure the last video frame end time is correct on Android MP4 playback. r=kinetik, a=lsblakk
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;