зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1284399. Part 2 - add MDSM::mCurrentSeek to replace SeekTask::mSeekJob. r=kaku
MozReview-Commit-ID: 84KJcdoXakS --HG-- extra : rebase_source : 2f5ea74f31e95cca4e5e7371f05154e6245b612a extra : source : 2b942182822fec8376c7f042d7c6f4071ebe49fe
This commit is contained in:
Родитель
715617f21b
Коммит
f6ec26e728
|
@ -38,11 +38,11 @@ extern LazyLogModule gMediaSampleLog;
|
|||
AccurateSeekTask::AccurateSeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob,
|
||||
SeekJob& aSeekJob,
|
||||
const MediaInfo& aInfo,
|
||||
const media::TimeUnit& aEnd,
|
||||
int64_t aCurrentMediaTime)
|
||||
: SeekTask(aDecoderID, aThread, aReader, Move(aSeekJob))
|
||||
: SeekTask(aDecoderID, aThread, aReader, aSeekJob)
|
||||
, mCurrentTimeBeforeSeek(media::TimeUnit::FromMicroseconds(aCurrentMediaTime))
|
||||
, mAudioRate(aInfo.mAudio.mRate)
|
||||
, mDoneAudioSeeking(!aInfo.HasAudio() || mSeekJob.mTarget.IsVideoOnly())
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
AccurateSeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob,
|
||||
SeekJob& aSeekJob,
|
||||
const MediaInfo& aInfo,
|
||||
const media::TimeUnit& aEnd,
|
||||
int64_t aCurrentMediaTime);
|
||||
|
|
|
@ -1164,7 +1164,7 @@ MediaDecoderStateMachine::SetDormant(bool aDormant)
|
|||
if (mSeekTask->GetSeekTarget().IsVideoOnly()) {
|
||||
mSeekTask->GetSeekTarget().SetType(SeekTarget::Accurate);
|
||||
}
|
||||
mQueuedSeek = Move(mSeekTask->GetSeekJob());
|
||||
mQueuedSeek = Move(mCurrentSeek);
|
||||
mSeekTaskRequest.DisconnectIfExists();
|
||||
} else {
|
||||
mQueuedSeek.mTarget = SeekTarget(mCurrentPosition,
|
||||
|
@ -1428,9 +1428,11 @@ void MediaDecoderStateMachine::InitiateDecodeRecoverySeek(TrackSet aTracks)
|
|||
// SeekTask will register its callbacks to MediaDecoderReaderWrapper.
|
||||
CancelMediaDecoderReaderWrapperCallback();
|
||||
|
||||
MOZ_ASSERT(!mCurrentSeek.Exists());
|
||||
mCurrentSeek = Move(seekJob);
|
||||
// Create a new SeekTask instance for the incoming seek task.
|
||||
mSeekTask = new AccurateSeekTask(mDecoderID, OwnerThread(),
|
||||
mReader.get(), Move(seekJob),
|
||||
mReader.get(), mCurrentSeek,
|
||||
mInfo, Duration(), GetMediaTime());
|
||||
|
||||
mOnSeekingStart.Notify(MediaDecoderEventVisibility::Suppressed);
|
||||
|
@ -1448,8 +1450,7 @@ void MediaDecoderStateMachine::InitiateDecodeRecoverySeek(TrackSet aTracks)
|
|||
// Nobody is listening to this as OnSeekTaskResolved handles what is
|
||||
// required but the promise needs to exist or SeekJob::Exists() will
|
||||
// assert.
|
||||
RefPtr<MediaDecoder::SeekPromise> unused =
|
||||
mSeekTask->GetSeekJob().mPromise.Ensure(__func__);
|
||||
RefPtr<MediaDecoder::SeekPromise> unused = mCurrentSeek.mPromise.Ensure(__func__);
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::BufferedRangeUpdated()
|
||||
|
@ -1538,7 +1539,7 @@ MediaDecoderStateMachine::Seek(SeekTarget aTarget)
|
|||
SeekJob seekJob;
|
||||
seekJob.mTarget = aTarget;
|
||||
InitiateSeek(Move(seekJob));
|
||||
return mSeekTask->GetSeekJob().mPromise.Ensure(__func__);
|
||||
return mCurrentSeek.mPromise.Ensure(__func__);
|
||||
}
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise>
|
||||
|
@ -1632,13 +1633,15 @@ MediaDecoderStateMachine::InitiateSeek(SeekJob aSeekJob)
|
|||
CancelMediaDecoderReaderWrapperCallback();
|
||||
|
||||
// Create a new SeekTask instance for the incoming seek task.
|
||||
if (aSeekJob.mTarget.IsAccurate() || aSeekJob.mTarget.IsFast()) {
|
||||
MOZ_ASSERT(!mCurrentSeek.Exists());
|
||||
mCurrentSeek = Move(aSeekJob);
|
||||
if (mCurrentSeek.mTarget.IsAccurate() || mCurrentSeek.mTarget.IsFast()) {
|
||||
mSeekTask = new AccurateSeekTask(mDecoderID, OwnerThread(),
|
||||
mReader.get(), Move(aSeekJob),
|
||||
mReader.get(), mCurrentSeek,
|
||||
mInfo, Duration(), GetMediaTime());
|
||||
} else if (aSeekJob.mTarget.IsNextFrame()) {
|
||||
} else if (mCurrentSeek.mTarget.IsNextFrame()) {
|
||||
mSeekTask = new NextFrameSeekTask(mDecoderID, OwnerThread(), mReader.get(),
|
||||
Move(aSeekJob), mInfo, Duration(),
|
||||
mCurrentSeek, mInfo, Duration(),
|
||||
GetMediaTime(), AudioQueue(), VideoQueue());
|
||||
} else {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Cannot handle this seek task.");
|
||||
|
@ -2181,7 +2184,7 @@ MediaDecoderStateMachine::SeekCompleted()
|
|||
|
||||
// We want to resolve the seek request prior finishing the first frame
|
||||
// to ensure that the seeked event is fired prior loadeded.
|
||||
mSeekTask->GetSeekJob().Resolve(nextState == DECODER_STATE_COMPLETED, __func__);
|
||||
mCurrentSeek.Resolve(nextState == DECODER_STATE_COMPLETED, __func__);
|
||||
|
||||
// Discard and nullify the seek task.
|
||||
// Reset the MediaDecoderReaderWrapper's callbask.
|
||||
|
|
|
@ -686,6 +686,7 @@ private:
|
|||
|
||||
// Queued seek - moves to mCurrentSeek when DecodeFirstFrame completes.
|
||||
SeekJob mQueuedSeek;
|
||||
SeekJob mCurrentSeek;
|
||||
|
||||
// mSeekTask is responsible for executing the current seek request.
|
||||
RefPtr<SeekTask> mSeekTask;
|
||||
|
|
|
@ -22,13 +22,13 @@ namespace media {
|
|||
NextFrameSeekTask::NextFrameSeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob,
|
||||
SeekJob& aSeekJob,
|
||||
const MediaInfo& aInfo,
|
||||
const media::TimeUnit& aDuration,
|
||||
int64_t aCurrentTime,
|
||||
MediaQueue<MediaData>& aAudioQueue,
|
||||
MediaQueue<MediaData>& aVideoQueue)
|
||||
: SeekTask(aDecoderID, aThread, aReader, Move(aSeekJob))
|
||||
: SeekTask(aDecoderID, aThread, aReader, aSeekJob)
|
||||
, mAudioQueue(aAudioQueue)
|
||||
, mVideoQueue(aVideoQueue)
|
||||
, mCurrentTime(aCurrentTime)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NextFrameSeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob,
|
||||
SeekJob& aSeekJob,
|
||||
const MediaInfo& aInfo,
|
||||
const media::TimeUnit& aDuration,
|
||||
int64_t aCurrentTime,
|
||||
|
|
|
@ -13,11 +13,11 @@ namespace mozilla {
|
|||
SeekTask::SeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob)
|
||||
SeekJob& aSeekJob)
|
||||
: mDecoderID(aDecoderID)
|
||||
, mOwnerThread(aThread)
|
||||
, mReader(aReader)
|
||||
, mSeekJob(Move(aSeekJob))
|
||||
, mSeekJob(aSeekJob)
|
||||
, mTarget(mSeekJob.mTarget)
|
||||
, mIsDiscarded(false)
|
||||
, mIsAudioQueueFinished(false)
|
||||
|
@ -77,13 +77,6 @@ SeekTask::OwnerThread() const
|
|||
return mOwnerThread;
|
||||
}
|
||||
|
||||
SeekJob&
|
||||
SeekTask::GetSeekJob()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
return mSeekJob;
|
||||
}
|
||||
|
||||
SeekTarget&
|
||||
SeekTask::GetSeekTarget()
|
||||
{
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
|
||||
virtual bool NeedToResetMDSM() const = 0;
|
||||
|
||||
SeekJob& GetSeekJob();
|
||||
|
||||
SeekTarget& GetSeekTarget();
|
||||
|
||||
bool Exists() const;
|
||||
|
@ -66,7 +64,7 @@ protected:
|
|||
SeekTask(const void* aDecoderID,
|
||||
AbstractThread* aThread,
|
||||
MediaDecoderReaderWrapper* aReader,
|
||||
SeekJob&& aSeekJob);
|
||||
SeekJob& aSeekJob);
|
||||
|
||||
virtual ~SeekTask();
|
||||
|
||||
|
@ -88,7 +86,7 @@ protected:
|
|||
/*
|
||||
* Internal state.
|
||||
*/
|
||||
SeekJob mSeekJob;
|
||||
SeekJob& mSeekJob;
|
||||
SeekTarget& mTarget;
|
||||
MozPromiseHolder<SeekTaskPromise> mSeekTaskPromise;
|
||||
bool mIsDiscarded;
|
||||
|
|
Загрузка…
Ссылка в новой задаче