Bug 1317576. Part 6 - ensure 'playbackEnded' is notified when seeking to the end on a paused media element. r=cpearce

MozReview-Commit-ID: 4fzru2oHaPV

--HG--
extra : rebase_source : 0c2c3e639ec360fe5826cd5bbcd2f0879fa3f158
This commit is contained in:
JW Wang 2016-11-15 12:06:17 +08:00
Родитель 1927c644dc
Коммит 23c537597f
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -1053,8 +1053,7 @@ public:
// is restarted correctly.
mMaster->StopPlayback();
if (mMaster->mPlayState == MediaDecoder::PLAY_STATE_PLAYING &&
!mSentPlaybackEndedEvent) {
if (!mSentPlaybackEndedEvent) {
int64_t clockTime = std::max(mMaster->AudioEndTime(), mMaster->VideoEndTime());
clockTime = std::max(int64_t(0), std::max(clockTime, mMaster->Duration().ToMicroseconds()));
mMaster->UpdatePlaybackPosition(clockTime);
@ -1507,6 +1506,12 @@ SeekingState::SeekCompleted()
// once we download more data!
AudioQueue().Finish();
VideoQueue().Finish();
// We won't start MediaSink when paused. m{Audio,Video}Completed will
// remain false and 'playbackEnded' won't be notified. Therefore we
// need to set these flags explicitly when seeking to the end.
mMaster->mAudioCompleted = true;
mMaster->mVideoCompleted = true;
}
// We want to resolve the seek request prior finishing the first frame