Bug 1293646: [MSE] P1. Reject seeking attempt with EOS when the mediasource is ended. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 09 Aug 2016 23:09:22 +1000
changeset 399076 06e083e4d63788324bef400f35f4512a00a2cf6f
parent 398604 6cf0089510fad8deb866136f5b92bbced9498447
child 399077 f0aa316b15750c49bcc03f0f2c2cdc74cadf9e6b
push id25733
push userbmo:jyavenard@mozilla.com
push dateWed, 10 Aug 2016 12:15:21 +0000
reviewersgerald
bugs1293646
milestone51.0a1
Bug 1293646: [MSE] P1. Reject seeking attempt with EOS when the mediasource is ended. r?gerald 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);