author | Jean-Yves Avenard <jyavenard@mozilla.com> |
Mon, 23 Mar 2015 21:08:05 +1100 | |
changeset 235034 | 2ee1fb53c59c8f434075ac66d55d8d982ad61924 |
parent 235033 | 43525f7e2fd9692b48f60c4ef96a3de675893a9d |
child 235035 | 5a679809898571a7bdbaeeb278fd4f75a259fe3b |
push id | 57309 |
push user | jyavenard@mozilla.com |
push date | Mon, 23 Mar 2015 10:09:49 +0000 |
treeherder | mozilla-inbound@0046e9225bbd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mattwoodrow |
bugs | 1143971 |
milestone | 39.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/mediasource/MediaSourceReader.cpp +++ b/dom/media/mediasource/MediaSourceReader.cpp @@ -780,16 +780,18 @@ void MediaSourceReader::NotifyTimeRangesChanged() { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); if (mWaitingForSeekData) { //post a task to the decode queue to try to complete the pending seek. RefPtr<nsIRunnable> task(NS_NewRunnableMethod( this, &MediaSourceReader::AttemptSeek)); GetTaskQueue()->Dispatch(task.forget()); + } else { + MaybeNotifyHaveData(); } } nsRefPtr<MediaDecoderReader::SeekPromise> MediaSourceReader::Seek(int64_t aTime, int64_t aIgnored /* Used only for ogg which is non-MSE */) { MSE_DEBUG("Seek(aTime=%lld, aEnd=%lld, aCurrent=%lld)", aTime); @@ -1016,26 +1018,34 @@ MediaSourceReader::WaitForData(MediaData return p; } void MediaSourceReader::MaybeNotifyHaveData() { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); bool haveAudio = false, haveVideo = false; - if (!IsSeeking() && mAudioTrack && HaveData(mLastAudioTime, MediaData::AUDIO_DATA)) { - haveAudio = true; - WaitPromise(MediaData::AUDIO_DATA).ResolveIfExists(MediaData::AUDIO_DATA, __func__); + bool ended = IsEnded(); + // If we are in ended mode, we will resolve any pending wait promises. + // The next Request*Data will handle END_OF_STREAM or going back into waiting + // mode. + if (!IsSeeking() && mAudioTrack) { + haveAudio = HaveData(mLastAudioTime, MediaData::AUDIO_DATA); + if (ended || haveAudio) { + WaitPromise(MediaData::AUDIO_DATA).ResolveIfExists(MediaData::AUDIO_DATA __func__); + } } - if (!IsSeeking() && mVideoTrack && HaveData(mLastVideoTime, MediaData::VIDEO_DATA)) { - haveVideo = true; - WaitPromise(MediaData::VIDEO_DATA).ResolveIfExists(MediaData::VIDEO_DATA, __func__); + if (!IsSeeking() && mVideoTrack) { + haveVideo = HaveData(mLastVideoTime, MediaData::VIDEO_DATA); + if (ended || haveVideo) { + WaitPromise(MediaData::VIDEO_DATA).ResolveIfExists(MediaData::VIDEO_DATA __func__); + } } - MSE_DEBUG("isSeeking=%d haveAudio=%d, haveVideo=%d", - IsSeeking(), haveAudio, haveVideo); + MSE_DEBUG("isSeeking=%d haveAudio=%d, haveVideo=%d ended=%d", + IsSeeking(), haveAudio, haveVideo, ended); } static void CombineEncryptionData(EncryptionInfo& aTo, const EncryptionInfo& aFrom) { if (!aFrom.mIsEncrypted) { return; } @@ -1120,16 +1130,23 @@ MediaSourceReader::ReadUpdatedMetadata(M *aInfo = mInfo; } void MediaSourceReader::Ended(bool aEnded) { mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); mEnded = aEnded; + if (aEnded) { + // post a task to the decode queue to try to complete any pending + // seek or wait + RefPtr<nsIRunnable> task(NS_NewRunnableMethod( + this, &MediaSourceReader::NotifyTimeRangesChanged)); + GetTaskQueue()->Dispatch(task.forget()); + } } bool MediaSourceReader::IsEnded() { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); return mEnded; }