Bug 1316211. P2 - remove dead code.
MozReview-Commit-ID: FQNyxabfhrp
--- a/dom/media/MediaDecoderReader.cpp
+++ b/dom/media/MediaDecoderReader.cpp
@@ -139,115 +139,16 @@ nsresult MediaDecoderReader::ResetDecode
if (aTracks.contains(TrackInfo::kAudioTrack)) {
AudioQueue().Reset();
mBaseAudioPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
}
return NS_OK;
}
-RefPtr<MediaDecoderReader::VideoDataPromise>
-MediaDecoderReader::DecodeToFirstVideoData()
-{
- MOZ_ASSERT(OnTaskQueue());
- typedef VideoDataPromise PromiseType;
- RefPtr<PromiseType::Private> p = new PromiseType::Private(__func__);
- RefPtr<MediaDecoderReader> self = this;
- InvokeUntil([self] () -> bool {
- MOZ_ASSERT(self->OnTaskQueue());
- NS_ENSURE_TRUE(!self->mShutdown, false);
- bool skip = false;
- if (!self->DecodeVideoFrame(skip, media::TimeUnit::Zero())) {
- self->VideoQueue().Finish();
- return !!self->VideoQueue().PeekFront();
- }
- return true;
- }, [self] () -> bool {
- MOZ_ASSERT(self->OnTaskQueue());
- return self->VideoQueue().GetSize();
- })->Then(OwnerThread(), __func__, [self, p] () {
- p->Resolve(self->VideoQueue().PeekFront(), __func__);
- }, [p] () {
- // We don't have a way to differentiate EOS, error, and shutdown here. :-(
- p->Reject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
- });
-
- return p.forget();
-}
-
-void
-MediaDecoderReader::VisibilityChanged()
-{}
-
-media::TimeIntervals
-MediaDecoderReader::GetBuffered()
-{
- MOZ_ASSERT(OnTaskQueue());
-
- if (mDuration.isNothing()) {
- return TimeIntervals();
- }
-
- AutoPinned<MediaResource> stream(mResource);
- return GetEstimatedBufferedTimeRanges(stream, mDuration->ToMicroseconds());
-}
-
-class ReRequestVideoWithSkipTask : public Runnable
-{
-public:
- ReRequestVideoWithSkipTask(MediaDecoderReader* aReader,
- const media::TimeUnit& aTimeThreshold)
- : Runnable("ReRequestVideoWithSkipTask")
- , 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(mTimeThreshold);
- }
-
- return NS_OK;
- }
-
-private:
- RefPtr<MediaDecoderReader> mReader;
- const media::TimeUnit mTimeThreshold;
-};
-
-class ReRequestAudioTask : public Runnable
-{
-public:
- explicit ReRequestAudioTask(MediaDecoderReader* aReader)
- : Runnable("ReRequestAudioTask")
- , mReader(aReader)
- {
- }
-
- NS_IMETHOD Run() override
- {
- MOZ_ASSERT(mReader->OnTaskQueue());
-
- // Make sure ResetDecode hasn't been called in the mean time.
- if (!mReader->mBaseAudioPromise.IsEmpty()) {
- mReader->RequestAudioData();
- }
-
- return NS_OK;
- }
-
-private:
- RefPtr<MediaDecoderReader> mReader;
-};
-
RefPtr<ShutdownPromise>
MediaDecoderReader::Shutdown()
{
MOZ_ASSERT(OnTaskQueue());
mShutdown = true;
mBaseAudioPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
mBaseVideoPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -80,19 +80,16 @@ struct MOZ_STACK_CLASS MediaDecoderReade
// Encapsulates the decoding and reading of media data. Reading can either
// synchronous and done on the calling "decode" thread, or asynchronous and
// performed on a background thread, with the result being returned by
// callback.
// Unless otherwise specified, methods and fields of this class can only
// be accessed on the decode task queue.
class MediaDecoderReader
{
- friend class ReRequestVideoWithSkipTask;
- friend class ReRequestAudioTask;
-
static const bool IsExclusive = true;
public:
using TrackSet = EnumSet<TrackInfo::TrackType>;
using MetadataPromise = MozPromise<MetadataHolder, MediaResult, IsExclusive>;
template <typename Type>
@@ -288,18 +285,16 @@ public:
virtual void SetVideoNullDecode(bool aIsNullDecode) = 0;
protected:
virtual ~MediaDecoderReader();
// Recomputes mBuffered.
virtual void UpdateBuffered() = 0;
- RefPtr<VideoDataPromise> DecodeToFirstVideoData();
-
// Queue of audio frames. This queue is threadsafe, and is accessed from
// the audio, decoder, state machine, and main threads.
MediaQueue<AudioData> mAudioQueue;
// Queue of video frames. This queue is threadsafe, and is accessed from
// the decoder, state machine, and main threads.
MediaQueue<VideoData> mVideoQueue;
@@ -350,57 +345,16 @@ protected:
MediaEventProducer<MediaResult> mOnDecodeWarning;
RefPtr<MediaResource> mResource;
private:
virtual nsresult InitInternal() = 0;
- // Read header data for all bitstreams in the file. Fills aInfo with
- // the data required to present the media, and optionally fills *aTags
- // with tag metadata from the file.
- // Returns NS_OK on success, or NS_ERROR_FAILURE on failure.
- virtual nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags)
- {
- MOZ_CRASH();
- }
-
- virtual void VisibilityChanged();
-
- // Overrides of this function should decodes an unspecified amount of
- // audio data, enqueuing the audio data in mAudioQueue. Returns true
- // when there's more audio to decode, false if the audio is finished,
- // end of file has been reached, or an un-recoverable read error has
- // occured. This function blocks until the decode is complete.
- virtual bool DecodeAudioData()
- {
- return false;
- }
-
- // Overrides of this function should read and decodes one video frame.
- // Packets with a timestamp less than aTimeThreshold will be decoded
- // (unless they're not keyframes and aKeyframeSkip is true), but will
- // not be added to the queue. This function blocks until the decode
- // is complete.
- virtual bool DecodeVideoFrame(bool& aKeyframeSkip,
- const media::TimeUnit& aTimeThreshold)
- {
- return false;
- }
-
- // GetBuffered estimates the time ranges buffered by interpolating the cached
- // byte ranges with the duration of the media. Reader subclasses should
- // override this method if they can quickly calculate the buffered ranges more
- // accurately.
- //
- // The primary advantage of this implementation in the reader base class is
- // that it's a fast approximation, which does not perform any I/O.
- media::TimeIntervals GetBuffered();
-
// Promises used only for the base-class (sync->async adapter) implementation
// of Request{Audio,Video}Data.
MozPromiseHolder<AudioDataPromise> mBaseAudioPromise;
MozPromiseHolder<VideoDataPromise> mBaseVideoPromise;
};
} // namespace mozilla