Bug 1404441 - return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR if MediaData::AdjustForStartTime() results in an invalid mTime. r=jya

MozReview-Commit-ID: 44VgbrknYbi

--HG--
extra : rebase_source : 9bfbad053a955d7fb18f12a2f6cc6d3b43ee739d
This commit is contained in:
JW Wang 2017-12-19 14:56:08 +08:00
Родитель ff35fd6ca5
Коммит 5a9ff8849d
1 изменённых файлов: 11 добавлений и 4 удалений

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

@ -62,8 +62,12 @@ ReaderProxy::OnAudioDataRequestCompleted(RefPtr<AudioData> aAudio)
int64_t offset = int64_t offset =
StartTime().ToMicroseconds() - mLoopingOffset.ToMicroseconds(); StartTime().ToMicroseconds() - mLoopingOffset.ToMicroseconds();
aAudio->AdjustForStartTime(offset); aAudio->AdjustForStartTime(offset);
mLastAudioEndTime = aAudio->mTime; if (aAudio->mTime.IsValid()) {
return AudioDataPromise::CreateAndResolve(aAudio.forget(), __func__); mLastAudioEndTime = aAudio->mTime;
return AudioDataPromise::CreateAndResolve(aAudio.forget(), __func__);
}
return AudioDataPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR,
__func__);
} }
RefPtr<ReaderProxy::AudioDataPromise> RefPtr<ReaderProxy::AudioDataPromise>
@ -149,8 +153,11 @@ ReaderProxy::RequestVideoData(const media::TimeUnit& aTimeThreshold)
__func__, __func__,
[startTime](RefPtr<VideoData> aVideo) { [startTime](RefPtr<VideoData> aVideo) {
aVideo->AdjustForStartTime(startTime); aVideo->AdjustForStartTime(startTime);
return VideoDataPromise::CreateAndResolve(aVideo.forget(), return aVideo->mTime.IsValid()
__func__); ? VideoDataPromise::CreateAndResolve(aVideo.forget(),
__func__)
: VideoDataPromise::CreateAndReject(
NS_ERROR_DOM_MEDIA_OVERFLOW_ERR, __func__);
}, },
[](const MediaResult& aError) { [](const MediaResult& aError) {
return VideoDataPromise::CreateAndReject(aError, __func__); return VideoDataPromise::CreateAndReject(aError, __func__);