Bug 1285987: Narrow the workaround added in
bug 1276184 to only be effective with webm. r?gerald
Some invalid streams incorrectly tag all frames as keyframes, which cause the frames to be inserted in the wrong order in the trackbuffer.
MozReview-Commit-ID: EZurdiMxmle
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1620,20 +1620,27 @@ TrackBuffersManager::InsertFrames(TrackB
// 15. Remove decoding dependencies of the coded frames removed in the previous step:
// Remove all coded frames between the coded frames removed in the previous step and the next random access point after those removed frames.
TimeIntervals intersection = trackBuffer.mBufferedRanges;
intersection.Intersection(aIntervals);
if (intersection.Length()) {
- if (aSamples[0]->mKeyframe) {
+ if (aSamples[0]->mKeyframe &&
+ (mType.LowerCaseEqualsLiteral("video/webm") ||
+ mType.LowerCaseEqualsLiteral("audio/webm"))) {
// We are starting a new GOP, we do not have to worry about breaking an
// existing current coded frame group. Reset the next insertion index
// so the search for when to start our frames removal can be exhaustive.
+ // This is a workaround for bug 1276184 and only until either bug 1277733
+ // or bug 1209386 is fixed.
+ // With the webm container, we can't always properly determine the
+ // duration of the last frame, which may cause the last frame of a cluster
+ // to overlap the following frame.
trackBuffer.mNextInsertionIndex.reset();
}
size_t index =
RemoveFrames(aIntervals, trackBuffer, trackBuffer.mNextInsertionIndex.refOr(0));
if (index) {
trackBuffer.mNextInsertionIndex = Some(index);
}
}