Bug 1313635 part 2 - remove DispatchSetStartTime(), HaveStartTime() and StartTime(); r?jya, jwwang
MozReview-Commit-ID: 17QZU97hWVr
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -217,30 +217,16 @@ public:
virtual MediaQueue<AudioData>& AudioQueue() { return mAudioQueue; }
virtual MediaQueue<VideoData>& VideoQueue() { return mVideoQueue; }
AbstractCanonical<media::TimeIntervals>* CanonicalBuffered()
{
return &mBuffered;
}
- void DispatchSetStartTime(int64_t aStartTime)
- {
- RefPtr<MediaDecoderReader> self = this;
- nsCOMPtr<nsIRunnable> r =
- NS_NewRunnableFunction([self, aStartTime] () -> void
- {
- MOZ_ASSERT(self->OnTaskQueue());
- MOZ_ASSERT(!self->HaveStartTime());
- self->mStartTime.emplace(aStartTime);
- self->UpdateBuffered();
- });
- OwnerThread()->Dispatch(r.forget());
- }
-
TaskQueue* OwnerThread() const
{
return mTaskQueue;
}
// Returns true if the reader implements RequestAudioData()
// and RequestVideoData() asynchronously, rather than using the
// implementation in this class to adapt the old synchronous to
@@ -295,24 +281,16 @@ protected:
//
// The OggReader relies on this base implementation not performing I/O,
// since in FirefoxOS we can't do I/O on the main thread, where this is
// called.
virtual media::TimeIntervals GetBuffered();
RefPtr<MediaDataPromise> DecodeToFirstVideoData();
- bool HaveStartTime()
- {
- MOZ_ASSERT(OnTaskQueue());
- return mStartTime.isSome();
- }
-
- int64_t StartTime() { MOZ_ASSERT(HaveStartTime()); return mStartTime.ref(); }
-
// 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;
@@ -340,28 +318,16 @@ protected:
// Duration, mirrored from the state machine task queue.
Mirror<media::NullableTimeUnit> mDuration;
// Whether we should accept media that we know we can't play
// directly, because they have a number of channel higher than
// what we support.
bool mIgnoreAudioOutputFormat;
- // The start time of the media, in microseconds. This is the presentation
- // time of the first frame decoded from the media. This is initialized to -1,
- // and then set to a value >= by MediaDecoderStateMachine::SetStartTime(),
- // after which point it never changes (though SetStartTime may be called
- // multiple times with the same value).
- //
- // This is an ugly breach of abstractions - it's currently necessary for the
- // readers to return the correct value of GetBuffered. We should refactor
- // things such that all GetBuffered calls go through the MDSM, which would
- // offset the range accordingly.
- Maybe<int64_t> mStartTime;
-
// This is a quick-and-dirty way for DecodeAudioData implementations to
// communicate the presence of a decoding error to RequestAudioData. We should
// replace this with a promise-y mechanism as we make this stuff properly
// async.
bool mHitAudioDecodeError;
bool mShutdown;
// Used to send TimedMetadata to the listener.
--- a/dom/media/MediaDecoderReaderWrapper.cpp
+++ b/dom/media/MediaDecoderReaderWrapper.cpp
@@ -224,20 +224,16 @@ MediaDecoderReaderWrapper::OnMetadataRea
{
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
if (mShutdown) {
return;
}
if (mStartTime.isNothing()) {
mStartTime.emplace(aMetadata->mInfo.mStartTime);
- // Note: MFR should be able to setup its start time by itself without going
- // through here. MediaDecoderReader::DispatchSetStartTime() will be removed
- // once we remove all the legacy readers' code in the following bugs.
- mReader->DispatchSetStartTime(StartTime().ToMicroseconds());
}
}
void
MediaDecoderReaderWrapper::SetVideoBlankDecode(bool aIsBlankDecode)
{
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
nsCOMPtr<nsIRunnable> r =