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
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -262,34 +262,38 @@ H264Converter::CreateDecoder(const Video
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("No support for YUV444 format."));
}
} else {
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Invalid SPS NAL."));
}
+ MediaResult error = NS_OK;
mDecoder = mPDM->CreateVideoDecoder({
aConfig,
mTaskQueue,
aDiagnostics,
mImageContainer,
mKnowsCompositor,
mGMPCrashHelper,
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;
return NS_OK;
}
MediaResult