Bug 1657521 - P6. Attempt to create a decoder via the PDMFactory as fallback. r=jolin

The MediaChangeMonitor would always use the selected PDM in order to create a decoder; this only worked if the Decode method returned an error if the format was unsupported and this is how the WMF decoder worked.

However, the AppleVTDecoder fails on creation instead.
Now that the VP9 profile is known at creation time, we should move the WMF decoder to do the same.

Differential Revision: https://phabricator.services.mozilla.com/D86545
This commit is contained in:
Jean-Yves Avenard 2020-08-13 02:15:58 +00:00
Родитель f3562546bb
Коммит d955b4dd6f
2 изменённых файлов: 14 добавлений и 5 удалений

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

@ -66,7 +66,7 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
bool mUse = false;
};
// Do not wrap H264 decoder in a H264Converter.
// Do not wrap decoder in a MediaChangeMonitor.
struct NoWrapper {
NoWrapper() = default;
explicit NoWrapper(bool aDontUseWrapper)

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

@ -471,10 +471,19 @@ MediaResult MediaChangeMonitor::CreateDecoder(
mDecoderOptions, mRate, &error});
if (!mDecoder) {
if (NS_FAILED(error)) {
// The decoder supports CreateDecoderParam::mError, returns the value.
return error;
} else {
// We failed to create a decoder with the existing PDM; attempt once again
// with a PDMFactory.
RefPtr<PDMFactory> factory = new PDMFactory();
mDecoder = factory->CreateDecoder(
{mCurrentConfig, mTaskQueue, aDiagnostics, mImageContainer,
mKnowsCompositor, mGMPCrashHelper, mType, mOnWaitingForKeyEvent,
mDecoderOptions, mRate, &error, CreateDecoderParams::NoWrapper(true)});
if (!mDecoder) {
if (NS_FAILED(error)) {
// The decoder supports CreateDecoderParam::mError, returns the value.
return error;
}
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Unable to create decoder"));
}