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
--- 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);