Bug 1400537 - P1. Don't assume that the PDM will properly report an error. r=alwu

Only the Windows H264 decoder supports CreateDecoderParam::mError, all the other PDM leave the value untouched.

As such, it can't be assumed that in case of failure, the mError attribute will be set.

MozReview-Commit-ID: GWHGP6Wv3fl

--HG--
extra : rebase_source : 081b71c7a53c41d9a13904e4182e3cfdb876ae43
This commit is contained in:
Jean-Yves Avenard 2017-09-17 18:01:37 +02:00
Родитель 1880a2c631
Коммит 3e790e2a55
1 изменённых файлов: 9 добавлений и 5 удалений

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

@ -267,6 +267,7 @@ H264Converter::CreateDecoder(const VideoInfo& aConfig,
RESULT_DETAIL("Invalid SPS NAL."));
}
MediaResult error = NS_OK;
mDecoder = mPDM->CreateVideoDecoder({
aConfig,
mTaskQueue,
@ -277,14 +278,17 @@ H264Converter::CreateDecoder(const VideoInfo& aConfig,
mType,
mOnWaitingForKeyEvent,
mDecoderOptions,
&mLastError
&error
});
if (!mDecoder) {
MOZ_ASSERT(NS_FAILED(mLastError));
return MediaResult(mLastError.Code(),
RESULT_DETAIL("Unable to create H264 decoder, reason = %s.",
mLastError.Description().get()));
if (NS_FAILED(error)) {
// The decoder supports CreateDecoderParam::mError, returns the value.
return error;
} else {
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Unable to create H264 decoder"));
}
}
mNeedKeyframe = true;