From f248cc3c6def71832b3d45f56ade8284fe218888 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 11 Nov 2014 20:50:22 -0800 Subject: [PATCH] Bug 1093020 - Don't use a buffering wait for MSE. r=cpearce --- dom/media/MediaDecoderReader.h | 5 +++++ dom/media/MediaDecoderStateMachine.cpp | 7 +------ dom/media/mediasource/MediaSourceReader.h | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index e32d737c684..f295f408e19 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -153,6 +153,11 @@ public: virtual int64_t ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio); + // Wait this number of seconds when buffering, then leave and play + // as best as we can if the required amount of data hasn't been + // retrieved. + virtual uint32_t GetBufferingWait() { return 30; } + // Returns the number of bytes of memory allocated by structures/frames in // the video queue. size_t SizeOfVideoQueueInBytes() const; diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 7ce55098ff4..765cda07027 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -84,11 +84,6 @@ extern PRLogModuleInfo* gMediaDecoderLog; #undef GetCurrentTime #endif -// Wait this number of seconds when buffering, then leave and play -// as best as we can if the required amount of data hasn't been -// retrieved. -static const uint32_t BUFFERING_WAIT_S = 30; - // If audio queue has less than this many usecs of decoded audio, we won't risk // trying to decode the video, we'll skip decoding video up to the next // keyframe. We may increase this value for an individual decoder if we @@ -224,7 +219,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, mAmpleVideoFrames = std::max(Preferences::GetUint("media.video-queue.default-size", 10), 3); - mBufferingWait = mScheduler->IsRealTime() ? 0 : BUFFERING_WAIT_S; + mBufferingWait = mScheduler->IsRealTime() ? 0 : mReader->GetBufferingWait(); mLowDataThresholdUsecs = mScheduler->IsRealTime() ? 0 : LOW_DATA_THRESHOLD_USECS; mVideoPrerollFrames = mScheduler->IsRealTime() ? 0 : mAmpleVideoFrames / 2; diff --git a/dom/media/mediasource/MediaSourceReader.h b/dom/media/mediasource/MediaSourceReader.h index f0988fe2e6e..9238e0f6bdd 100644 --- a/dom/media/mediasource/MediaSourceReader.h +++ b/dom/media/mediasource/MediaSourceReader.h @@ -75,6 +75,12 @@ public: // as chrome/blink and assumes that we always start at t=0. virtual int64_t ComputeStartTime(const VideoData* aVideo, const AudioData* aAudio) MOZ_OVERRIDE { return 0; } + // Buffering waits (in which we decline to present decoded frames because we + // "don't have enough") don't really make sense for MSE. The delay is + // essentially a streaming heuristic, but JS is supposed to take care of that + // in the MSE world. Avoid injecting inexplicable delays. + virtual uint32_t GetBufferingWait() { return 0; } + bool IsMediaSeekable() { return true; } nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) MOZ_OVERRIDE;