Bug 1378085 p7 - override DoSeek(); r?jwwang
MozReview-Commit-ID: 3qSR1wXwVo1
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1162,25 +1162,21 @@ public:
MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking,
"Seek shouldn't be finished");
RequestVideoData();
}
void DoSeek() override
{
- mDoneAudioSeeking = !Info().HasAudio() || mSeekJob.mTarget->IsVideoOnly();
+ mDoneAudioSeeking = !Info().HasAudio();
mDoneVideoSeeking = !Info().HasVideo();
- if (mSeekJob.mTarget->IsVideoOnly()) {
- mMaster->ResetDecode(TrackInfo::kVideoTrack);
- } else {
- mMaster->ResetDecode();
- mMaster->StopMediaSink();
- }
+ mMaster->ResetDecode();
+ mMaster->StopMediaSink();
DemuxerSeek();
}
TimeUnit CalculateNewCurrentTime() const override
{
const auto seekTime = mSeekJob.mTarget->GetTime();
@@ -1790,16 +1786,27 @@ public:
void HandleAudioWaited(MediaData::Type aType) override
{
MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking,
"Seek shouldn't be finished");
// Ignore pending requests from video-only seek.
}
+
+ void DoSeek() override
+ {
+ // TODO: keep decoding audio.
+ mDoneAudioSeeking = true;
+ mDoneVideoSeeking = !Info().HasVideo();
+
+ mMaster->ResetDecode(TrackInfo::kVideoTrack);
+
+ DemuxerSeek();
+ }
};
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::DormantState::HandleSeek(SeekTarget aTarget)
{
if (aTarget.IsNextFrame()) {
// NextFrameSeekingState doesn't reset the decoder unlike
// AccurateSeekingState. So we first must come out of dormant by seeking to