Bug 1332619 - Fix missed duration when skipping a frame in VP8TrackEncoder. r=jesup
☠☠ backed out by bda52b71f8f4 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 20 Jan 2017 15:47:04 +0100
changeset 377786 9ea8e4f2edae49b3e46b71130f2c4303eafdf1bc
parent 377785 123099d23df567ffb963b9fc5d56b9fa6bd1098a
child 377787 cd23e1fc730bb549e4a227e3616a730aab1907f3
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1332619
milestone53.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 1332619 - Fix missed duration when skipping a frame in VP8TrackEncoder. r=jesup MozReview-Commit-ID: GpXUHfUj5v2
dom/media/encoder/VP8TrackEncoder.cpp
--- a/dom/media/encoder/VP8TrackEncoder.cpp
+++ b/dom/media/encoder/VP8TrackEncoder.cpp
@@ -548,21 +548,25 @@ VP8TrackEncoder::GetEncodedTrack(Encoded
                            VPX_DL_REALTIME)) {
         return NS_ERROR_FAILURE;
       }
       // Get the encoded data from VP8 encoder.
       GetEncodedPartitions(aData);
     } else {
       // SKIP_FRAME
       // Extend the duration of the last encoded data in aData
-      // because this frame will be skip.
+      // because this frame will be skipped.
       VP8LOG(LogLevel::Warning, "MediaRecorder lagging behind. Skipping a frame.");
       RefPtr<EncodedFrame> last = aData.GetEncodedFrames().LastElement();
       if (last) {
-        last->SetDuration(last->GetDuration() + chunk.GetDuration());
+        CheckedInt64 skippedDuration = FramesToUsecs(chunk.mDuration, mTrackRate);
+        if (skippedDuration.isValid() && skippedDuration.value() > 0) {
+          last->SetDuration(last->GetDuration() +
+                            (static_cast<uint64_t>(skippedDuration.value())));
+        }
       }
     }
 
     // Move forward the mEncodedTimestamp.
     mEncodedTimestamp += chunk.GetDuration();
     totalProcessedDuration += chunk.GetDuration();
 
     // Check what to do next.