Bug 1378085 p4 - override HandleAudioDecoded(); r?jwwang
MozReview-Commit-ID: BmxePYCesTF
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1051,25 +1051,16 @@ public:
}
void HandleAudioDecoded(AudioData* aAudio) override
{
MOZ_ASSERT(!mDoneAudioSeeking || !mDoneVideoSeeking,
"Seek shouldn't be finished");
MOZ_ASSERT(aAudio);
- // Video-only seek doesn't reset audio decoder. There might be pending audio
- // requests when AccurateSeekTask::Seek() begins. We will just store the
- // data without checking |mDiscontinuity| or calling
- // DropAudioUpToSeekTarget().
- if (mSeekJob.mTarget->IsVideoOnly()) {
- mMaster->PushAudio(aAudio);
- return;
- }
-
AdjustFastSeekIfNeeded(aAudio);
if (mSeekJob.mTarget->IsFast()) {
// Non-precise seek; we can stop the seek at the first sample.
mMaster->PushAudio(aAudio);
mDoneAudioSeeking = true;
} else {
nsresult rv = DropAudioUpToSeekTarget(aAudio);
@@ -1782,16 +1773,29 @@ public:
// We are discarding this video-only seek operation now, and we still need
// to dispatch an event so that the UI can change in response to the end
// of video-only seek.
mMaster->mOnPlaybackEvent.Notify(MediaEventType::VideoOnlySeekCompleted);
}
AccurateSeekingState::Exit();
}
+
+ void HandleAudioDecoded(AudioData* aAudio) override
+ {
+ MOZ_ASSERT(mDoneAudioSeeking && !mDoneVideoSeeking,
+ "Seek shouldn't be finished");
+ MOZ_ASSERT(aAudio);
+
+ // Video-only seek doesn't reset audio decoder. There might be pending audio
+ // requests when AccurateSeekTask::Seek() begins. We will just store the
+ // data without checking |mDiscontinuity| or calling
+ // DropAudioUpToSeekTarget().
+ mMaster->PushAudio(aAudio);
+ }
};
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