зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315144 - Add new non-fatal media error so that we recreate decoders when the GPU process crashes. r=jya
This commit is contained in:
Родитель
7afb98ff2b
Коммит
f75e8a0868
|
@ -1504,7 +1504,8 @@ MediaFormatReader::Update(TrackType aTrack)
|
|||
|
||||
if (decoder.mError && !decoder.HasFatalError()) {
|
||||
decoder.mDecodePending = false;
|
||||
if (++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) {
|
||||
bool needsNewDecoder = decoder.mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER;
|
||||
if (!needsNewDecoder && ++decoder.mNumOfConsecutiveError > decoder.mMaxConsecutiveError) {
|
||||
NotifyError(aTrack, decoder.mError.ref());
|
||||
return;
|
||||
}
|
||||
|
@ -1514,6 +1515,9 @@ MediaFormatReader::Update(TrackType aTrack)
|
|||
media::TimeUnit nextKeyframe;
|
||||
if (aTrack == TrackType::kVideoTrack && !decoder.HasInternalSeekPending() &&
|
||||
NS_SUCCEEDED(decoder.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe))) {
|
||||
if (needsNewDecoder) {
|
||||
decoder.ShutdownDecoder();
|
||||
}
|
||||
SkipVideoDemuxToNextKeyFrame(decoder.mLastSampleTime.refOr(TimeInterval()).Length());
|
||||
return;
|
||||
} else if (aTrack == TrackType::kAudioTrack) {
|
||||
|
|
|
@ -327,9 +327,21 @@ private:
|
|||
Maybe<MediaResult> mError;
|
||||
bool HasFatalError() const
|
||||
{
|
||||
return mError.isSome() &&
|
||||
(mError.ref() != NS_ERROR_DOM_MEDIA_DECODE_ERR ||
|
||||
mNumOfConsecutiveError > mMaxConsecutiveError);
|
||||
if (!mError.isSome()) {
|
||||
return false;
|
||||
}
|
||||
if (mError.ref() == NS_ERROR_DOM_MEDIA_DECODE_ERR) {
|
||||
// Allow decode errors to be non-fatal, but give up
|
||||
// if we have too many.
|
||||
return mNumOfConsecutiveError > mMaxConsecutiveError;
|
||||
} else if (mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER) {
|
||||
// If the caller asked for a new decoder we shouldn't treat
|
||||
// it as fatal.
|
||||
return false;
|
||||
} else {
|
||||
// All other error types are fatal
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// If set, all decoded samples prior mTimeThreshold will be dropped.
|
||||
|
|
|
@ -108,9 +108,9 @@ VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy)
|
|||
RefPtr<VideoDecoderChild> ref = this;
|
||||
GetManager()->RunWhenRecreated(NS_NewRunnableFunction([=]() {
|
||||
if (ref->mInitialized) {
|
||||
ref->mCallback->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR);
|
||||
ref->mCallback->Error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
|
||||
} else {
|
||||
ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__);
|
||||
ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -982,6 +982,7 @@
|
|||
ERROR(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, FAILURE(11)),
|
||||
ERROR(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, FAILURE(12)),
|
||||
ERROR(NS_ERROR_DOM_MEDIA_CDM_ERR, FAILURE(13)),
|
||||
ERROR(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, FAILURE(14)),
|
||||
|
||||
/* Internal platform-related errors */
|
||||
ERROR(NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR, FAILURE(101)),
|
||||
|
|
Загрузка…
Ссылка в новой задаче