Bug 1359058: P2. Rely on container flags when seeking in plain MP4. r=gerald
☠☠ backed out by 895836bd8d07 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 26 Apr 2017 16:43:54 +0200
changeset 356546 fe9ac117615975149ba6f33a6e68593e0396f863
parent 356545 a39a98ffb29ba32478deb842cf7ab3ae57752396
child 356547 6f6704758419f18cd8a53eb0874a0aaca3235074
push id42070
push userjyavenard@mozilla.com
push dateThu, 04 May 2017 19:41:11 +0000
treeherderautoland@fe9ac1176159 [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
@@ -412,32 +412,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 = mIterator->GetNext();
+  if (mQueuedSample) {
+    seekTime = mQueuedSample->mTime;
+  }
 
   SetNextKeyFrameTime();
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 already_AddRefed<MediaRawData>
 MP4TrackDemuxer::GetNextSample()