Backed out changeset fe9ac1176159 (bug 1359058)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 05 May 2017 00:32:36 +0200
changeset 356555 895836bd8d07e4086dcd02e5b392dfac8ad8d3e4
parent 356554 d51433601f47f6b54f8d12197e2142ddc674c70d
child 356556 833e53da0e82242faa11ab1e672de2cd83fb1979
push id42076
push userarchaeopteryx@coole-files.de
push dateThu, 04 May 2017 22:34:25 +0000
treeherderautoland@833e53da0e82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1359058
milestone55.0a1
backs outfe9ac117615975149ba6f33a6e68593e0396f863
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
Backed out changeset fe9ac1176159 (bug 1359058)
dom/media/fmp4/MP4Demuxer.cpp
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -412,20 +412,32 @@ 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.
-  mQueuedSample = mIterator->GetNext();
-  if (mQueuedSample) {
-    seekTime = mQueuedSample->mTime;
-  }
+  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);
 
   SetNextKeyFrameTime();
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 already_AddRefed<MediaRawData>
 MP4TrackDemuxer::GetNextSample()