Bug 1371188 P2 - remove ReRequestVideoWithSkipTask;
We're going to remove synchronous decoding in
bug 1316211 and
bug 1316462.
Remove the skip-to-next-key-frame mechanism in synchronous decoding now.
MozReview-Commit-ID: Jc1tSADK3i6
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -234,43 +234,16 @@ MediaDecoderReader::AsyncReadMetadata()
static_cast<uint32_t>(rv), metadata.mInfo->HasValidMedia());
return MetadataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_METADATA_ERR, __func__);
}
// Success!
return MetadataPromise::CreateAndResolve(Move(metadata), __func__);
}
-class ReRequestVideoWithSkipTask : public Runnable
-{
-public:
- ReRequestVideoWithSkipTask(MediaDecoderReader* aReader,
- const media::TimeUnit& aTimeThreshold)
- : mReader(aReader)
- , mTimeThreshold(aTimeThreshold)
- {
- }
-
- NS_IMETHOD Run() override
- {
- MOZ_ASSERT(mReader->OnTaskQueue());
-
- // Make sure ResetDecode hasn't been called in the mean time.
- if (!mReader->mBaseVideoPromise.IsEmpty()) {
- mReader->RequestVideoData(/* aSkip = */ true, mTimeThreshold);
- }
-
- return NS_OK;
- }
-
-private:
- RefPtr<MediaDecoderReader> mReader;
- const media::TimeUnit mTimeThreshold;
-};
-
class ReRequestAudioTask : public Runnable
{
public:
explicit ReRequestAudioTask(MediaDecoderReader* aReader)
: mReader(aReader)
{
}
@@ -295,25 +268,16 @@ MediaDecoderReader::RequestVideoData(boo
const media::TimeUnit& aTimeThreshold)
{
RefPtr<VideoDataPromise> p = mBaseVideoPromise.Ensure(__func__);
bool skip = aSkipToNextKeyframe;
while (VideoQueue().GetSize() == 0 &&
!VideoQueue().IsFinished()) {
if (!DecodeVideoFrame(skip, aTimeThreshold)) {
VideoQueue().Finish();
- } else if (skip) {
- // We still need to decode more data in order to skip to the next
- // keyframe. Post another task to the decode task queue to decode
- // again. We don't just decode straight in a loop here, as that
- // would hog the decode task queue.
- RefPtr<nsIRunnable> task(
- new ReRequestVideoWithSkipTask(this, aTimeThreshold));
- mTaskQueue->Dispatch(task.forget());
- return p;
}
}
if (VideoQueue().GetSize() > 0) {
RefPtr<VideoData> v = VideoQueue().PopFront();
mBaseVideoPromise.Resolve(v, __func__);
} else if (VideoQueue().IsFinished()) {
mBaseVideoPromise.Reject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
} else {