diff --git a/dom/media/MediaDecoderReaderWrapper.cpp b/dom/media/MediaDecoderReaderWrapper.cpp index e5404aac2bd3..137910a18386 100644 --- a/dom/media/MediaDecoderReaderWrapper.cpp +++ b/dom/media/MediaDecoderReaderWrapper.cpp @@ -13,7 +13,11 @@ MediaDecoderReaderWrapper::MediaDecoderReaderWrapper(AbstractThread* aOwnerThrea MediaDecoderReader* aReader) : mOwnerThread(aOwnerThread) , mReader(aReader) -{} +{ + // Must support either heuristic buffering or WaitForData(). + MOZ_ASSERT(mReader->UseBufferingHeuristics() || + mReader->IsWaitForDataSupported()); +} MediaDecoderReaderWrapper::~MediaDecoderReaderWrapper() {} @@ -92,6 +96,7 @@ RefPtr MediaDecoderReaderWrapper::WaitForData(MediaData::Type aType) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); + MOZ_ASSERT(mReader->IsWaitForDataSupported()); return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, &MediaDecoderReader::WaitForData, aType); } diff --git a/dom/media/MediaDecoderReaderWrapper.h b/dom/media/MediaDecoderReaderWrapper.h index e9723ceacd48..01c9bd2edb50 100644 --- a/dom/media/MediaDecoderReaderWrapper.h +++ b/dom/media/MediaDecoderReaderWrapper.h @@ -52,7 +52,6 @@ public: void ResetDecode(TrackSet aTracks); nsresult Init() { return mReader->Init(); } - bool IsWaitForDataSupported() const { return mReader->IsWaitForDataSupported(); } bool IsAsync() const { return mReader->IsAsync(); } bool UseBufferingHeuristics() const { return mReader->UseBufferingHeuristics(); } diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 6c4453f5950e..cbbaac5e667d 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -236,8 +236,8 @@ protected: // We are expecting more data if either the resource states so, or if we // have a waiting promise pending (such as with non-MSE EME). return Resource()->IsExpectingMoreData() || - (Reader()->IsWaitForDataSupported() && - (mMaster->IsWaitingAudioData() || mMaster->IsWaitingVideoData())); + mMaster->IsWaitingAudioData() || + mMaster->IsWaitingVideoData(); } MediaQueue& AudioQueue() const { return mMaster->mAudioQueue; } MediaQueue& VideoQueue() const { return mMaster->mVideoQueue; } @@ -1746,8 +1746,6 @@ StateObject::HandleNotDecoded(MediaData::Type aType, const MediaResult& aError) // If the decoder is waiting for data, we tell it to call us back when the // data arrives. if (aError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) { - MOZ_ASSERT(Reader()->IsWaitForDataSupported(), - "Readers that send WAITING_FOR_DATA need to implement WaitForData"); mMaster->WaitForData(aType); HandleWaitingForData(); return; @@ -2077,7 +2075,6 @@ DecodingState::MaybeStartBuffering() mMaster->HasLowDecodedData() && mMaster->HasLowBufferedData(); } else { - MOZ_ASSERT(Reader()->IsWaitForDataSupported()); shouldBuffer = (mMaster->OutOfDecodedAudio() && mMaster->IsWaitingAudioData()) || (mMaster->OutOfDecodedVideo() && mMaster->IsWaitingVideoData()); @@ -2165,8 +2162,6 @@ BufferingState::Step() return; } } else if (mMaster->OutOfDecodedAudio() || mMaster->OutOfDecodedVideo()) { - MOZ_ASSERT(Reader()->IsWaitForDataSupported(), - "Don't yet have a strategy for non-heuristic + non-WaitForData"); mMaster->DispatchDecodeTasksIfNeeded(); MOZ_ASSERT(mMaster->mMinimizePreroll || !mMaster->OutOfDecodedAudio() ||