Bug 1188238: [MSE] P1. Don't use Interval::Intersect to find the first frame of an interval. r=gerald a=sledru
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 12 Sep 2015 20:49:49 +1000
changeset 289255 e0c5c53a99a9ad69b539b62297393e17743b5403
parent 289254 6fa940a15b9328f1b9d8e8826c45242de0ebccf2
child 289256 a9cc4e966637a4422e2a4f28340d91c5299daed1
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, sledru
bugs1188238
milestone42.0a2
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.
dom/media/mediasource/TrackBuffersManager.cpp
--- 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