Bug 1347538 - Don't reject seeks with EOS. r=kinetik a=jcristau
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 24 Mar 2017 18:36:50 +0100
changeset 395578 697d237e3c00c7b3b10c0fe5f7b533949add518c
parent 395577 9503d9bfaf28536092a899467be1edb3cac4090a
child 395579 cb1ffcc22ab1333d8e0d586e1854aa414cdb3e84
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, jcristau
bugs1347538
milestone54.0a2
Bug 1347538 - Don't reject seeks with EOS. r=kinetik a=jcristau The MediaDecoderStateMachine treat seek's EOS as fatal errors, so instead we always resolve the seek promise, and let the next GetSample return EOS. MozReview-Commit-ID: 6MGaJ3C8xrH
dom/media/webm/WebMDemuxer.cpp
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -1068,16 +1068,20 @@ WebMTrackDemuxer::Seek(const media::Time
   // Seeks to aTime. Upon success, SeekPromise will be resolved with the
   // actual time seeked to. Typically the random access point time
 
   media::TimeUnit seekTime = aTime;
   mSamples.Reset();
   mParent->SeekInternal(mType, aTime);
   nsresult rv = mParent->GetNextPacket(mType, &mSamples);
   if (NS_FAILED(rv)) {
+    if (rv == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
+      // Ignore the error for now, the next GetSample will be rejected with EOS.
+      return SeekPromise::CreateAndResolve(media::TimeUnit(), __func__);
+    }
     return SeekPromise::CreateAndReject(rv, __func__);
   }
   mNeedKeyframe = true;
 
   // Check what time we actually seeked to.
   if (mSamples.GetSize() > 0) {
     const RefPtr<MediaRawData>& sample = mSamples.First();
     seekTime = media::TimeUnit::FromMicroseconds(sample->mTime);