Bug 1313955 - Dormant recovery seek uses wrong time. r?jwwang
Dormant mode is setting recovery seek to MDSM::mCurrentPosition which
doesn't match what MediaSink position which is used to leave the last
frame in the image container.
Switch to using mMediaSink->GetPosition for dormant recovery seek
target.
MozReview-Commit-ID: 7YLecRR8XrN
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1143,17 +1143,20 @@ public:
bool
MediaDecoderStateMachine::
StateObject::HandleDormant(bool aDormant)
{
if (!aDormant) {
return true;
}
SeekJob seekJob;
- seekJob.mTarget = SeekTarget(mMaster->mCurrentPosition,
+ int64_t seekTargetTime = mMaster->mMediaSink->IsStarted()
+ ? mMaster->GetClock() : mMaster->GetMediaTime();
+
+ seekJob.mTarget = SeekTarget(seekTargetTime,
SeekTarget::Accurate,
MediaDecoderEventVisibility::Suppressed);
// SeekJob asserts |mTarget.IsValid() == !mPromise.IsEmpty()| so we
// need to create the promise even it is not used at all.
RefPtr<MediaDecoder::SeekPromise> unused = seekJob.mPromise.Ensure(__func__);
SetState<DormantState>(Move(seekJob));
return true;
}