Bug 1536766 - Fix a rounding error in DecodedStream. r=jya
☠☠ backed out by 41f1dcbe9caa ☠ ☠
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 18 Apr 2019 15:27:05 +0000
changeset 470097 36f99fa3c95664b13b4839a0900217debdb74539
parent 470096 000260ba28de8b30791c72a6871d5879b92fe59d
child 470098 87616997f16017b85f463691262261db6490c30b
push id35888
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:47:45 +0000
treeherdermozilla-central@0160424142d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1536766
milestone68.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 1536766 - Fix a rounding error in DecodedStream. r=jya Differential Revision: https://phabricator.services.mozilla.com/D27262
dom/media/mediasink/DecodedStream.cpp
--- a/dom/media/mediasink/DecodedStream.cpp
+++ b/dom/media/mediasink/DecodedStream.cpp
@@ -753,18 +753,20 @@ void DecodedStream::SendVideo(bool aIsSa
       // Force frame to be black
       aIsSameOrigin = false;
       // Override the frame's size (will be 0x0 otherwise)
       mData->mLastVideoImageDisplaySize = mInfo.mVideo.mDisplay;
     }
     if (compensateEOS) {
       VideoSegment endSegment;
       // Calculate the deviation clock time from DecodedStream.
+      // We round the nr of microseconds up, because WriteVideoToMediaStream
+      // will round the conversion from microseconds to StreamTime down.
       auto deviation =
-          FromMicroseconds(sourceStream->StreamTimeToMicroseconds(1));
+          FromMicroseconds(sourceStream->StreamTimeToMicroseconds(1) + 1);
       WriteVideoToMediaStream(
           sourceStream, mData->mLastVideoImage, mData->mNextVideoTime,
           mData->mNextVideoTime + deviation, mData->mLastVideoImageDisplaySize,
           currentTime + (mData->mNextVideoTime + deviation - currentPosition)
                             .ToTimeDuration(),
           &endSegment, aPrincipalHandle);
       mData->mNextVideoTime += deviation;
       MOZ_ASSERT(endSegment.GetDuration() > 0);