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 342357 202cbd5602d5c034d791b26e16a6090d01e19a43
parent 342356 a507b6cde54bf184a9ae36e76532e7e947967073
child 342358 77701a10e980d59528381e9e7c49ed966163d2de
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1293646
milestone49.0
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);