Bug 1359058: P2. Rely on container flags when seeking in plain MP4. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 26 Apr 2017 16:43:54 +0200
changeset 360935 40d98a26598ec6e16e5f93cfd91e3dab28956e59
parent 360934 0cf76b87767d2c47eaff9a0a9c10896e9b20f890
child 360936 cc7b19b52df4b1c25d003d2e6deb2007f780cfa6
push id43552
push userjyavenard@mozilla.com
push dateSat, 27 May 2017 02:42:16 +0000
treeherderautoland@40d98a26598e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1359058, 1300296
milestone55.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 1359058: P2. Rely on container flags when seeking in plain MP4. r=gerald This reverts part of bug 1300296. In the worse case we'll get a decoding error. But we're only trading a bad behaviour for another. MozReview-Commit-ID: H0gF3FqZsU6
dom/media/fmp4/MP4Demuxer.cpp
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -410,32 +410,20 @@ RefPtr<MP4TrackDemuxer::SeekPromise>
 MP4TrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   auto seekTime = aTime;
   mQueuedSample = nullptr;
 
   mIterator->Seek(seekTime.ToMicroseconds());
 
   // Check what time we actually seeked to.
-  RefPtr<MediaRawData> sample;
-  do {
-    sample = GetNextSample();
-    if (!sample) {
-      return SeekPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_END_OF_STREAM,
-                                          __func__);
-    }
-    if (!sample->Size()) {
-      // This sample can't be decoded, continue searching.
-      continue;
-    }
-    if (sample->mKeyframe) {
-      mQueuedSample = sample;
-      seekTime = mQueuedSample->mTime;
-    }
-  } while (!mQueuedSample);
+  mQueuedSample = GetNextSample();
+  if (mQueuedSample) {
+    seekTime = mQueuedSample->mTime;
+  }
 
   SetNextKeyFrameTime();
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 already_AddRefed<MediaRawData>
 MP4TrackDemuxer::GetNextSample()