Bug 1188238: [MSE] P1. Don't use Interval::Intersect to find the first frame of an interval. r=gerald a=sledru
With H264, often the first frame of a media segment has no duration ; as such the time interval it represents is empty and will never intersect with anything.
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1593,20 +1593,18 @@ TrackBuffersManager::CheckNextInsertionI
}
if (target.IsEmpty()) {
// No target found, it will be added at the end of the track buffer.
aTrackData.mNextInsertionIndex = Some(data.Length());
return;
}
for (uint32_t i = 0; i < data.Length(); i++) {
const nsRefPtr<MediaRawData>& sample = data[i];
- TimeInterval sampleInterval{
- TimeUnit::FromMicroseconds(sample->mTime),
- TimeUnit::FromMicroseconds(sample->GetEndTime())};
- if (target.Intersects(sampleInterval)) {
+ if (sample->mTime >= target.mStart.ToMicroseconds() ||
+ sample->GetEndTime() > target.mStart.ToMicroseconds()) {
aTrackData.mNextInsertionIndex = Some(size_t(i));
return;
}
}
MOZ_CRASH("Insertion Index Not Found");
}
void