Bug 1293646: [MSE] P1. Reject seeking attempt with EOS when the mediasource is ended. r=gerald, a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 09 Aug 2016 23:09:22 +1000
changeset 349782 252ceee6fee8ee4d525df6707466911e6b6a5f76
parent 349781 3fa9b262d4e54faa7694e6f9bc0827a2b470d64f
child 349783 da5b828c39ceb7dca3fa4e221e62970188599533
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1293646
milestone50.0a2
Bug 1293646: [MSE] P1. Reject seeking attempt with EOS when the mediasource is ended. r=gerald, a=ritu Otherwise, the ended event would never be fired should the decoder have reached the end of the stream prior endOfStream being called. MozReview-Commit-ID: CbWCnzi3nxj
dom/media/mediasource/MediaSourceDemuxer.cpp
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -382,18 +382,19 @@ MediaSourceTrackDemuxer::DoSeek(media::T
 {
   TimeIntervals buffered = mManager->Buffered(mType);
   buffered.SetFuzz(MediaSourceDemuxer::EOS_FUZZ);
   TimeUnit seekTime = std::max(aTime - mPreRoll, TimeUnit::FromMicroseconds(0));
 
   if (!buffered.Contains(seekTime)) {
     if (!buffered.Contains(aTime)) {
       // We don't have the data to seek to.
-      return SeekPromise::CreateAndReject(DemuxerFailureReason::WAITING_FOR_DATA,
-                                          __func__);
+      return SeekPromise::CreateAndReject(
+        mManager->IsEnded() ? DemuxerFailureReason::END_OF_STREAM :
+                              DemuxerFailureReason::WAITING_FOR_DATA, __func__);
     }
     // Theorically we should reject the promise with WAITING_FOR_DATA,
     // however, to avoid unwanted regressions we assume that if at this time
     // we don't have the wanted data it won't come later.
     // Instead of using the pre-rolled time, use the earliest time available in
     // the interval.
     TimeIntervals::IndexType index = buffered.Find(aTime);
     MOZ_ASSERT(index != TimeIntervals::NoIndex);