Bug 1112438 - Make newCurrentFrameTime more accurate while seeking by checking audio time boundary in addition. r=cpearce

This commit is contained in:
Kilik Kuo 2015-02-05 11:43:57 +08:00
Родитель c5ff7b0427
Коммит 0d3ad91f07
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -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;
}