Bug 1323931. Part 3 - remove mIsAudioQueueFinished/mIsVideoQueueFinished and finish queues in place. r?kaku
MozReview-Commit-ID: 2MDZSa3g7cj
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -946,20 +946,20 @@ public:
} else {
RequestVideoData();
}
return;
}
if (aError == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
if (aType == MediaData::AUDIO_DATA) {
- mIsAudioQueueFinished = true;
+ AudioQueue().Finish();
mDoneAudioSeeking = true;
} else {
- mIsVideoQueueFinished = true;
+ VideoQueue().Finish();
mDoneVideoSeeking = true;
if (mFirstVideoFrameAfterSeek) {
// Hit the end of stream. Move mFirstVideoFrameAfterSeek into
// mSeekedVideoData so we have something to display after seeking.
mSeekedVideoData = mFirstVideoFrameAfterSeek.forget();
}
}
MaybeFinishSeek();
@@ -1233,37 +1233,21 @@ private:
}
if (mSeekedVideoData) {
mMaster->Push(mSeekedVideoData);
mMaster->mDecodedVideoEndTime = std::max(
mSeekedVideoData->GetEndTime(), mMaster->mDecodedVideoEndTime);
}
- if (mIsAudioQueueFinished) {
- AudioQueue().Finish();
- }
-
- if (mIsVideoQueueFinished) {
- VideoQueue().Finish();
- }
-
SeekCompleted();
}
void OnSeekTaskRejected(const MediaResult& aError)
{
- if (mIsAudioQueueFinished) {
- AudioQueue().Finish();
- }
-
- if (mIsVideoQueueFinished) {
- VideoQueue().Finish();
- }
-
mMaster->DecodeError(aError);
}
/*
* Track the current seek promise made by the reader.
*/
MozPromiseRequestHolder<MediaDecoderReader::SeekPromise> mSeekRequest;
@@ -1280,18 +1264,16 @@ private:
// last frame in the media.
RefPtr<MediaData> mFirstVideoFrameAfterSeek;
/*
* Information which are going to be returned to MDSM.
*/
RefPtr<MediaData> mSeekedAudioData;
RefPtr<MediaData> mSeekedVideoData;
- bool mIsAudioQueueFinished = false;
- bool mIsVideoQueueFinished = false;
};
/*
* Remove samples from the queue until aCompare() returns false.
* aCompare A function object with the signature bool(int64_t) which returns
* true for samples that should be removed.
*/
template <typename Function> static void