Skip to content

Commit

Permalink
Bug 1112438 - Make newCurrentFrameTime more accurate while seeking by…
Browse files Browse the repository at this point in the history
… checking audio time boundary in addition. r=cpearce
  • Loading branch information
Kilik Kuo committed Feb 5, 2015
1 parent 965d169 commit d1e5a8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dom/media/MediaDecoderStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2550,7 +2550,18 @@ MediaDecoderStateMachine::SeekCompleted()
newCurrentTime = mAudioStartTime = seekTime;
} else if (HasAudio()) {
AudioData* audio = AudioQueue().PeekFront();
newCurrentTime = mAudioStartTime = audio ? audio->mTime : seekTime;
mAudioStartTime = audio ? audio->mTime : seekTime;

// Though we adjust the newCurrentTime in audio-based, and supplemented
// by video. For better UX, should not bind the slide position to
// mAudioStartTime directly.
// While seeking to a position where there's only either audio or video,
// Need to check the seekTime is bounded in audio duration. See Bug 1112438.
if (audio && audio->mTime <= seekTime && seekTime < audio->GetEndTime()) {
newCurrentTime = audio->mTime;
} else {
newCurrentTime = video ? video->mTime : seekTime;
}
} else {
newCurrentTime = video ? video->mTime : seekTime;
}
Expand Down

0 comments on commit d1e5a8c

Please sign in to comment.